]> scripts.mit.edu Git - autoinstalls/wordpress.git/commitdiff
Wordpress 2.7.1 wordpress-2.7.1
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:46:13 +0000 (20:46 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 21 Nov 2009 01:46:13 +0000 (20:46 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
427 files changed:
license.txt
readme.html
wp-admin/admin-ajax.php
wp-admin/admin-footer.php
wp-admin/admin-functions.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-rtl.css
wp-admin/css/colors-fresh.css
wp-admin/css/dashboard-rtl.css
wp-admin/css/dashboard.css
wp-admin/css/farbtastic-rtl.css [new file with mode: 0644]
wp-admin/css/farbtastic.css [new file with mode: 0644]
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/install-rtl.css
wp-admin/css/install.css
wp-admin/css/login-rtl.css
wp-admin/css/login.css
wp-admin/css/media-rtl.css
wp-admin/css/media.css
wp-admin/css/plugin-install-rtl.css [new file with mode: 0644]
wp-admin/css/plugin-install.css [new file with mode: 0644]
wp-admin/css/press-this-ie-rtl.css [deleted file]
wp-admin/css/press-this-ie.css [deleted file]
wp-admin/css/press-this-rtl.css
wp-admin/css/press-this.css
wp-admin/css/theme-editor-rtl.css
wp-admin/css/theme-editor.css
wp-admin/css/upload-rtl.css [deleted file]
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-form.php [deleted file]
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-post-rows.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/archive-link.png [new file with mode: 0644]
wp-admin/images/blue-grad.png [new file with mode: 0644]
wp-admin/images/browse-happy.gif
wp-admin/images/bubble_bg-rtl.gif [new file with mode: 0644]
wp-admin/images/button-grad-active.png [new file with mode: 0644]
wp-admin/images/button-grad.png [new file with mode: 0644]
wp-admin/images/comment-pill.gif [deleted file]
wp-admin/images/comment-stalk-classic.gif [deleted file]
wp-admin/images/comment-stalk-fresh.gif [deleted file]
wp-admin/images/comment-stalk-rtl.gif [deleted file]
wp-admin/images/ed-bg.gif [new file with mode: 0644]
wp-admin/images/fav-arrow-rtl.gif [new file with mode: 0644]
wp-admin/images/fav-arrow.gif [new file with mode: 0644]
wp-admin/images/fav-top.png [new file with mode: 0644]
wp-admin/images/fav.png [new file with mode: 0644]
wp-admin/images/gear.png [deleted file]
wp-admin/images/generic.png [new file with mode: 0644]
wp-admin/images/gray-grad.png [new file with mode: 0644]
wp-admin/images/icons32-vs.png [new file with mode: 0644]
wp-admin/images/icons32.png [new file with mode: 0644]
wp-admin/images/list-vs.png [new file with mode: 0644]
wp-admin/images/list.png [new file with mode: 0644]
wp-admin/images/loading-publish.gif
wp-admin/images/logo-ghost.png
wp-admin/images/logo-login.gif
wp-admin/images/logo.gif
wp-admin/images/marker.png [new file with mode: 0644]
wp-admin/images/mask.png [new file with mode: 0644]
wp-admin/images/media-button-gallery.gif [deleted file]
wp-admin/images/media-buttons.gif [deleted file]
wp-admin/images/menu-arrows.gif [new file with mode: 0644]
wp-admin/images/menu-bits-rtl.gif [new file with mode: 0644]
wp-admin/images/menu-bits.gif [new file with mode: 0644]
wp-admin/images/menu-dark-rtl.gif [new file with mode: 0644]
wp-admin/images/menu-dark.gif [new file with mode: 0644]
wp-admin/images/menu-vs.png [new file with mode: 0644]
wp-admin/images/menu.png [new file with mode: 0644]
wp-admin/images/resize.gif [new file with mode: 0644]
wp-admin/images/screen-options-left.gif [new file with mode: 0644]
wp-admin/images/screen-options-right-up.gif [new file with mode: 0644]
wp-admin/images/screen-options-right.gif [new file with mode: 0644]
wp-admin/images/se.png [new file with mode: 0644]
wp-admin/images/star.gif [new file with mode: 0644]
wp-admin/images/tab.png [deleted file]
wp-admin/images/tail.gif [deleted file]
wp-admin/images/wheel.png [new file with mode: 0644]
wp-admin/images/white-grad-active.png [new file with mode: 0644]
wp-admin/images/white-grad.png [new file with mode: 0644]
wp-admin/images/wp-logo.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 [moved from wp-admin/link-import.php with 82% similarity]
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/admin.php
wp-admin/includes/bookmark.php
wp-admin/includes/class-ftp-pure.php
wp-admin/includes/class-ftp-sockets.php
wp-admin/includes/class-ftp.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 [new file with mode: 0644]
wp-admin/includes/comment.php
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/media.php
wp-admin/includes/misc.php
wp-admin/includes/plugin-install.php [new file with mode: 0644]
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.php
wp-admin/includes/update-core.php [new file with mode: 0644]
wp-admin/includes/update.php
wp-admin/includes/upgrade.php
wp-admin/includes/user.php
wp-admin/includes/widgets.php
wp-admin/index-extra.php
wp-admin/index.php
wp-admin/install-helper.php
wp-admin/install.php
wp-admin/js/categories.js
wp-admin/js/comment.js
wp-admin/js/common.js
wp-admin/js/dashboard.js [new file with mode: 0644]
wp-admin/js/edit-comments.js
wp-admin/js/editor.js
wp-admin/js/farbtastic.js [new file with mode: 0644]
wp-admin/js/forms.js [deleted file]
wp-admin/js/gallery.js
wp-admin/js/inline-edit-post.js [new file with mode: 0644]
wp-admin/js/inline-edit-tax.js [new file with mode: 0644]
wp-admin/js/link.js
wp-admin/js/media-upload.js
wp-admin/js/page.js
wp-admin/js/password-strength-meter.js
wp-admin/js/plugin-install.js [new file with mode: 0644]
wp-admin/js/post.js
wp-admin/js/postbox.js
wp-admin/js/revisions-js.php
wp-admin/js/slug.js
wp-admin/js/tags.js
wp-admin/js/upload.js [deleted file]
wp-admin/js/users.js
wp-admin/js/widgets.js
wp-admin/js/word-count.js
wp-admin/js/wp-gears.js
wp-admin/link-add.php
wp-admin/link-category.php
wp-admin/link-manager.php
wp-admin/link-parse-opml.php
wp-admin/link.php
wp-admin/media-new.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/moderation.php
wp-admin/options-discussion.php
wp-admin/options-general.php
wp-admin/options-head.php
wp-admin/options-media.php [new file with mode: 0644]
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-new.php
wp-admin/page.php
wp-admin/plugin-editor.php
wp-admin/plugin-install.php [new file with mode: 0644]
wp-admin/plugins.php
wp-admin/post-new.php
wp-admin/post.php
wp-admin/press-this.php
wp-admin/profile.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/themes.php
wp-admin/tools.php [new file with mode: 0644]
wp-admin/update-core.php [new file with mode: 0644]
wp-admin/update-links.php
wp-admin/update.php
wp-admin/upgrade-functions.php
wp-admin/upgrade.php
wp-admin/upload.php
wp-admin/user-edit.php
wp-admin/user-new.php [new file with mode: 0644]
wp-admin/users.php
wp-admin/widgets.php
wp-admin/wp-admin.css
wp-app.php
wp-atom.php
wp-comments-post.php
wp-commentsrss2.php
wp-config-sample.php
wp-content/plugins/akismet/akismet.php
wp-content/plugins/hello.php
wp-content/themes/classic/comments-popup.php
wp-content/themes/classic/comments.php
wp-content/themes/classic/footer.php
wp-content/themes/classic/functions.php
wp-content/themes/classic/header.php
wp-content/themes/classic/index.php
wp-content/themes/classic/rtl.css
wp-content/themes/classic/sidebar.php
wp-content/themes/default/404.php
wp-content/themes/default/archive.php
wp-content/themes/default/archives.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/images/header-img.php
wp-content/themes/default/index.php
wp-content/themes/default/links.php
wp-content/themes/default/page.php
wp-content/themes/default/search.php
wp-content/themes/default/searchform.php [deleted file]
wp-content/themes/default/sidebar.php
wp-content/themes/default/single.php
wp-content/themes/default/style.css
wp-cron.php
wp-feed.php
wp-includes/author-template.php
wp-includes/bookmark-template.php
wp-includes/bookmark.php
wp-includes/cache.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-phpass.php
wp-includes/class-phpmailer.php
wp-includes/class-pop3.php
wp-includes/class-smtp.php
wp-includes/class-snoopy.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/deprecated.php
wp-includes/feed-atom-comments.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 [new file with mode: 0644]
wp-includes/images/audio.png [deleted file]
wp-includes/images/css.png [deleted file]
wp-includes/images/default.png [deleted file]
wp-includes/images/doc.png [deleted file]
wp-includes/images/exe.png [deleted file]
wp-includes/images/html.png [deleted file]
wp-includes/images/js.png [deleted file]
wp-includes/images/pdf.png [deleted file]
wp-includes/images/swf.png [deleted file]
wp-includes/images/tar.png [deleted file]
wp-includes/images/text.png [deleted file]
wp-includes/images/upload.png [new file with mode: 0644]
wp-includes/images/video.png [deleted file]
wp-includes/images/zip.png [deleted file]
wp-includes/js/autosave.js
wp-includes/js/comment-reply.js [new file with mode: 0644]
wp-includes/js/hoverIntent.js [new file with mode: 0644]
wp-includes/js/jquery/jquery.hotkeys.js [new file with mode: 0644]
wp-includes/js/jquery/jquery.table-hotkeys.js [new file with mode: 0644]
wp-includes/js/jquery/ui.core.js
wp-includes/js/jquery/ui.dialog.js [new file with mode: 0644]
wp-includes/js/jquery/ui.draggable.js [new file with mode: 0644]
wp-includes/js/jquery/ui.resizable.js [new file with mode: 0644]
wp-includes/js/jquery/ui.sortable.js
wp-includes/js/jquery/ui.tabs.js
wp-includes/js/quicktags.js
wp-includes/js/swfupload/handlers.js
wp-includes/js/swfupload/plugins/swfupload.cookies.js
wp-includes/js/swfupload/plugins/swfupload.queue.js
wp-includes/js/swfupload/plugins/swfupload.swfobject.js [new file with mode: 0644]
wp-includes/js/swfupload/swfupload.js
wp-includes/js/swfupload/swfupload.swf [new file with mode: 0644]
wp-includes/js/thickbox/thickbox.css
wp-includes/js/thickbox/thickbox.js
wp-includes/js/tinymce/langs/wp-langs-en.js [new file with mode: 0644]
wp-includes/js/tinymce/langs/wp-langs.php
wp-includes/js/tinymce/plugins/autosave/readme.txt [deleted file]
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/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/editor_plugin.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/classes/EnchantSpell.php [new file with mode: 0644]
wp-includes/js/tinymce/plugins/spellchecker/classes/GoogleSpell.php
wp-includes/js/tinymce/plugins/spellchecker/classes/PSpell.php
wp-includes/js/tinymce/plugins/spellchecker/classes/PSpellShell.php
wp-includes/js/tinymce/plugins/spellchecker/classes/SpellChecker.php
wp-includes/js/tinymce/plugins/spellchecker/config.php
wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.js
wp-includes/js/tinymce/plugins/spellchecker/rpc.php
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpgallery/img/delete.png [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpgallery/img/edit.png [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png [new file with mode: 0644]
wp-includes/js/tinymce/plugins/wpgallery/img/t.gif [new file with mode: 0644]
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/about.js
wp-includes/js/tinymce/themes/advanced/js/image.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/default/ui.css
wp-includes/js/tinymce/themes/advanced/skins/o2k7/dialog.css
wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui.css
wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_black.css
wp-includes/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png
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_config.php [deleted file]
wp-includes/js/tinymce/tiny_mce_ext.js [deleted file]
wp-includes/js/tinymce/tiny_mce_popup.js
wp-includes/js/tinymce/wordpress.css
wp-includes/js/tinymce/wp-mce-help.php
wp-includes/js/wp-ajax-response.js
wp-includes/js/wp-lists.js
wp-includes/kses.php
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/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/wlwmanifest.xml
wp-includes/wp-db.php
wp-includes/wp-diff.php
wp-load.php
wp-login.php
wp-mail.php
wp-rdf.php
wp-rss.php
wp-rss2.php
wp-settings.php
xmlrpc.php

index b5fcfa6e7a5343eec02d2d25805773efbdf65121..d31195ab0e695f8b894f3875c57cefc227aa3af5 100644 (file)
@@ -1,8 +1,9 @@
                    GNU GENERAL PUBLIC LICENSE\r
                       Version 2, June 1991\r
 \r
                    GNU GENERAL PUBLIC LICENSE\r
                       Version 2, June 1991\r
 \r
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.\r
-                          675 Mass Ave, Cambridge, MA 02139, USA\r
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc. \r
+              51 Franklin St, Fifth Floor, Boston, MA 02110, USA\r
+\r
  Everyone is permitted to copy and distribute verbatim copies\r
  of this license document, but changing it is not allowed.\r
 \r
  Everyone is permitted to copy and distribute verbatim copies\r
  of this license document, but changing it is not allowed.\r
 \r
index 45fd3f888b3c4ead84d6beda4dbc8e31372f0da6..5f8c13dfc02292f8e7c8dff512a3fc867e09d8ab 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.6.1
+       <br /> Version 2.7
 </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.6.1:</h2>
+<h2>Upgrading from any previous WordPress to 2.7:</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 4485935147ed90a97b3f8cb89a57f5c84e5a2551..b72ff61dcddb7bef04b72eee29910ced2527d0b9 100644 (file)
@@ -1,29 +1,67 @@
 <?php
 <?php
+/**
+ * WordPress AJAX Process Execution.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Executing AJAX process.
+ *
+ * @since unknown
+ */
 define('DOING_AJAX', true);
 define('DOING_AJAX', true);
+define('WP_ADMIN', true);
 
 require_once('../wp-load.php');
 require_once('includes/admin.php');
 
 
 require_once('../wp-load.php');
 require_once('includes/admin.php');
 
-if ( !is_user_logged_in() )
+if ( ! is_user_logged_in() ) {
+
+       if ( $_POST['action'] == 'autosave' ) {
+               $id = isset($_POST['post_ID'])? (int) $_POST['post_ID'] : 0;
+
+               if ( ! $id )
+                       die('-1');
+
+               $message = sprintf( __('<strong>ALERT: You are logged out!</strong> Could not save draft. <a href="%s" target="blank">Please log in again.</a>'), wp_login_url() );
+                       $x = new WP_Ajax_Response( array(
+                               'what' => 'autosave',
+                               'id' => $id,
+                               'data' => $message
+                       ) );
+                       $x->send();
+       }
+
        die('-1');
        die('-1');
+}
 
 
-if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) {
+if ( isset( $_GET['action'] ) ) :
+switch ( $action = $_GET['action'] ) :
+case 'ajax-tag-search' :
        if ( !current_user_can( 'manage_categories' ) )
                die('-1');
 
        $s = $_GET['q']; // is this slashed already?
 
        if ( !current_user_can( 'manage_categories' ) )
                die('-1');
 
        $s = $_GET['q']; // is this slashed already?
 
-       if ( strstr( $s, ',' ) ) { 
-               $s = explode( ',', $s ); 
-               $s = $s[count( $s ) - 1]; 
+       if ( false !== strpos( $s, ',' ) ) {
+               $s = explode( ',', $s );
+               $s = $s[count( $s ) - 1];
        }
        $s = trim( $s );
        if ( strlen( $s ) < 2 )
        }
        $s = trim( $s );
        if ( strlen( $s ) < 2 )
-        die; // require 2 chars for matching
-       $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%". $s . "%')" );
+               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 . "%')" );
        echo join( $results, "\n" );
        die;
        echo join( $results, "\n" );
        die;
-}
+       break;
+default :
+       do_action( 'wp_ajax_' . $_GET['action'] );
+       die('0');
+       break;
+endswitch;
+endif;
 
 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
 switch ( $action = $_POST['action'] ) :
 
 $id = isset($_POST['id'])? (int) $_POST['id'] : 0;
 switch ( $action = $_POST['action'] ) :
@@ -170,7 +208,7 @@ case 'dim-comment' :
        if ( $_POST['new'] == $current )
                die('1');
 
        if ( $_POST['new'] == $current )
                die('1');
 
-       if ( 'unapproved' == $current ) {
+       if ( in_array( $current, array( 'unapproved', 'spam' ) ) ) {
                check_ajax_referer( "approve-comment_$id" );
                if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
                        die('1');
                check_ajax_referer( "approve-comment_$id" );
                if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
                        die('1');
@@ -278,7 +316,7 @@ case 'add-cat' : // From Manage->Categories
                ) );
                $x->send();
        }
                ) );
                $x->send();
        }
-       
+
        $cat = wp_insert_category( $_POST, true );
 
        if ( is_wp_error($cat) ) {
        $cat = wp_insert_category( $_POST, true );
 
        if ( is_wp_error($cat) ) {
@@ -305,6 +343,7 @@ case 'add-cat' : // From Manage->Categories
        $x = new WP_Ajax_Response( array(
                'what' => 'cat',
                'id' => $cat->term_id,
        $x = new WP_Ajax_Response( array(
                'what' => 'cat',
                'id' => $cat->term_id,
+               'position' => -1,
                'data' => _cat_row( $cat, $level, $cat_full_name ),
                'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->term_id", $cat_full_name))
        ) );
                'data' => _cat_row( $cat, $level, $cat_full_name ),
                'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->term_id", $cat_full_name))
        ) );
@@ -340,6 +379,7 @@ case 'add-link-cat' : // From Blogroll -> Categories
        $x = new WP_Ajax_Response( array(
                'what' => 'link-cat',
                'id' => $term_id,
        $x = new WP_Ajax_Response( array(
                'what' => 'link-cat',
                'id' => $term_id,
+               'position' => -1,
                'data' => $link_cat
        ) );
        $x->send();
                'data' => $link_cat
        ) );
        $x->send();
@@ -376,11 +416,38 @@ case 'add-tag' : // From Manage->Tags
        $x = new WP_Ajax_Response( array(
                'what' => 'tag',
                'id' => $tag->term_id,
        $x = new WP_Ajax_Response( array(
                'what' => 'tag',
                'id' => $tag->term_id,
+               'position' => '-1',
                'data' => _tag_row( $tag ),
                '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;
                'data' => _tag_row( $tag ),
                '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' ) )
+               die('-1');
+
+       $tags = get_tags( array( 'number' => 45, 'orderby' => 'count', 'order' => 'DESC' ) );
+
+       if ( empty( $tags ) )
+               die( __('No tags found!') );
+
+       if ( is_wp_error($tags) )
+               die($tags->get_error_message());
+
+       foreach ( $tags as $key => $tag ) {
+               $tags[ $key ]->link = '#';
+               $tags[ $key ]->id = $tag->term_id;
+       }
+
+       $return = wp_generate_tag_cloud( $tags );
+
+       if ( empty($return) )
+               die('0');
+
+       echo $return;
+
+       exit;
+       break;
 case 'add-comment' :
        check_ajax_referer( $action );
        if ( !current_user_can( 'edit_post', $id ) )
 case 'add-comment' :
        check_ajax_referer( $action );
        if ( !current_user_can( 'edit_post', $id ) )
@@ -389,8 +456,9 @@ case 'add-comment' :
        $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24;
        $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
        $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
        $start = isset($_POST['page']) ? intval($_POST['page']) * 25 - 1: 24;
        $status = isset($_POST['comment_status']) ? $_POST['comment_status'] : false;
        $mode = isset($_POST['mode']) ? $_POST['mode'] : 'detail';
-
-       list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1 );
+       $p = isset($_POST['p']) ? $_POST['p'] : 0;
+       $comment_type = isset($_POST['comment_type']) ? $_POST['comment_type'] : '';
+       list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1, $p, $comment_type );
 
        if ( get_option('show_avatars') )
                add_filter( 'comment_author', 'floated_admin_avatar' );
 
        if ( get_option('show_avatars') )
                add_filter( 'comment_author', 'floated_admin_avatar' );
@@ -401,7 +469,7 @@ case 'add-comment' :
        foreach ( (array) $comments as $comment ) {
                get_comment( $comment );
                ob_start();
        foreach ( (array) $comments as $comment ) {
                get_comment( $comment );
                ob_start();
-                       _wp_comment_row( $comment->comment_ID, $mode, $status );
+                       _wp_comment_row( $comment->comment_ID, $mode, $status, true, true );
                        $comment_list_item = ob_get_contents();
                ob_end_clean();
                $x->add( array(
                        $comment_list_item = ob_get_contents();
                ob_end_clean();
                $x->add( array(
@@ -410,6 +478,142 @@ case 'add-comment' :
                        'data' => $comment_list_item
                ) );
        }
                        'data' => $comment_list_item
                ) );
        }
+       $x->send();
+       break;
+case 'get-comments' :
+       check_ajax_referer( $action );
+
+       $post_ID = (int) $_POST['post_ID'];
+       if ( !current_user_can( 'edit_post', $post_ID ) )
+               die('-1');
+
+       $start = isset($_POST['start']) ? intval($_POST['start']) : 0;
+       $num = isset($_POST['num']) ? intval($_POST['num']) : 10;
+
+       list($comments, $total) = _wp_get_comment_list( false, false, $start, $num, $post_ID );
+
+       if ( !$comments )
+               die('1');
+
+       $comment_list_item = '';
+       $x = new WP_Ajax_Response();
+       foreach ( (array) $comments as $comment ) {
+               get_comment( $comment );
+               ob_start();
+                       _wp_comment_row( $comment->comment_ID, 'single', false, false );
+                       $comment_list_item .= ob_get_contents();
+               ob_end_clean();
+       }
+       $x->add( array(
+               'what' => 'comments',
+               'data' => $comment_list_item
+       ) );
+       $x->send();
+       break;
+case 'replyto-comment' :
+       check_ajax_referer( $action );
+
+       $comment_post_ID = (int) $_POST['comment_post_ID'];
+       if ( !current_user_can( 'edit_post', $comment_post_ID ) )
+               die('-1');
+
+       $status = $wpdb->get_var( $wpdb->prepare("SELECT post_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) );
+
+       if ( empty($status) )
+               die('1');
+       elseif ( in_array($status, array('draft', 'pending') ) )
+               die( __('Error: you are replying to a comment on a draft post.') );
+
+       $user = wp_get_current_user();
+       if ( $user->ID ) {
+               $comment_author       = $wpdb->escape($user->display_name);
+               $comment_author_email = $wpdb->escape($user->user_email);
+               $comment_author_url   = $wpdb->escape($user->user_url);
+               $comment_content      = trim($_POST['content']);
+               if ( current_user_can('unfiltered_html') ) {
+                       if ( wp_create_nonce('unfiltered-html-comment_' . $comment_post_ID) != $_POST['_wp_unfiltered_html_comment'] ) {
+                               kses_remove_filters(); // start with a clean slate
+                               kses_init_filters(); // set up the filters
+                       }
+               }
+       } else {
+               die( __('Sorry, you must be logged in to reply to a comment.') );
+       }
+
+       if ( '' == $comment_content )
+               die( __('Error: please type a comment.') );
+
+       $comment_parent = absint($_POST['comment_ID']);
+       $commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
+
+       $comment_id = wp_new_comment( $commentdata );
+       $comment = get_comment($comment_id);
+       if ( ! $comment ) die('1');
+
+       $modes = array( 'single', 'detail', 'dashboard' );
+       $mode = isset($_POST['mode']) && in_array( $_POST['mode'], $modes ) ? $_POST['mode'] : 'detail';
+       $position = ( isset($_POST['position']) && (int) $_POST['position']) ? (int) $_POST['position'] : '-1';
+       $checkbox = ( isset($_POST['checkbox']) && true == $_POST['checkbox'] ) ? 1 : 0;
+
+       if ( get_option('show_avatars') && 'single' != $mode )
+               add_filter( 'comment_author', 'floated_admin_avatar' );
+
+       $x = new WP_Ajax_Response();
+
+       ob_start();
+               if ( 'dashboard' == $mode ) {
+                       require_once( ABSPATH . 'wp-admin/includes/dashboard.php' );
+                       _wp_dashboard_recent_comments_row( $comment, false );
+               } else {
+                       _wp_comment_row( $comment->comment_ID, $mode, false, $checkbox );
+               }
+               $comment_list_item = ob_get_contents();
+       ob_end_clean();
+
+       $x->add( array(
+               'what' => 'comment',
+               'id' => $comment->comment_ID,
+               'data' => $comment_list_item,
+               'position' => $position
+       ));
+
+       $x->send();
+       break;
+case 'edit-comment' :
+       check_ajax_referer( 'replyto-comment' );
+
+       $comment_post_ID = (int) $_POST['comment_post_ID'];
+       if ( ! current_user_can( 'edit_post', $comment_post_ID ) )
+               die('-1');
+
+       if ( '' == $_POST['content'] )
+               die( __('Error: please type a comment.') );
+
+       $comment_id = (int) $_POST['comment_ID'];
+       $_POST['comment_status'] = $_POST['status'];
+       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;
+
+       if ( get_option('show_avatars') && 'single' != $mode )
+               add_filter( 'comment_author', 'floated_admin_avatar' );
+
+       $x = new WP_Ajax_Response();
+
+       ob_start();
+               _wp_comment_row( $comment_id, $mode, true, $checkbox );
+               $comment_list_item = ob_get_contents();
+       ob_end_clean();
+
+       $x->add( array(
+               'what' => 'edit_comment',
+               'id' => $comment->comment_ID,
+               'data' => $comment_list_item,
+               'position' => $position
+       ));
+
        $x->send();
        break;
 case 'add-meta' :
        $x->send();
        break;
 case 'add-meta' :
@@ -519,7 +723,7 @@ 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( __('g:i:s a'), current_time( 'timestamp', true ) ) );
+       $message = sprintf( __('Draft Saved at %s.'), date_i18n( __('g:i:s a') ) );
 
        $supplemental = array();
 
 
        $supplemental = array();
 
@@ -616,13 +820,29 @@ case 'closed-postboxes' :
        check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
        $closed = isset( $_POST['closed'] )? $_POST['closed'] : '';
        $closed = explode( ',', $_POST['closed'] );
        check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
        $closed = isset( $_POST['closed'] )? $_POST['closed'] : '';
        $closed = explode( ',', $_POST['closed'] );
+       $hidden = isset( $_POST['hidden'] )? $_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();
+       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;
+case 'hidden-columns' :
+       check_ajax_referer( 'hiddencolumns', 'hiddencolumnsnonce' );
+       $hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : '';
+       $hidden = explode( ',', $_POST['hidden'] );
        $page = isset( $_POST['page'] )? $_POST['page'] : '';
        $page = isset( $_POST['page'] )? $_POST['page'] : '';
-       if ( !preg_match( '/^[a-z-]+$/', $page ) ) {
+       if ( !preg_match( '/^[a-z-_]+$/', $page ) ) {
                die(-1);
        }
                die(-1);
        }
-       if (!is_array($closed)) break;
        $current_user = wp_get_current_user();
        $current_user = wp_get_current_user();
-       update_usermeta($current_user->ID, 'closedpostboxes_'.$page, $closed);
+       if ( is_array($hidden) )
+               update_usermeta($current_user->ID, "manage-$page-columns-hidden", $hidden);
 break;
 case 'get-permalink':
        check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
 break;
 case 'get-permalink':
        check_ajax_referer( 'getpermalink', 'getpermalinknonce' );
@@ -636,6 +856,189 @@ case 'sample-permalink':
        $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : '';
        die(get_sample_permalink_html($post_id, $title, $slug));
 break;
        $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : '';
        die(get_sample_permalink_html($post_id, $title, $slug));
 break;
+case 'inline-save':
+       check_ajax_referer( 'inlineeditnonce', '_inline_edit' );
+
+       if ( ! isset($_POST['post_ID']) || ! ( $post_ID = (int) $_POST['post_ID'] ) )
+               exit;
+
+       if ( 'page' == $_POST['post_type'] ) {
+               if ( ! current_user_can( 'edit_page', $post_ID ) )
+                       die( __('You are not allowed to edit this page.') );
+       } else {
+               if ( ! current_user_can( 'edit_post', $post_ID ) )
+                       die( __('You are not allowed to edit this post.') );
+       }
+
+       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 ) );
+               exit;
+       }
+
+       $data = &$_POST;
+       $post = get_post( $post_ID, ARRAY_A );
+       $data['content'] = $post['post_content'];
+       $data['excerpt'] = $post['post_excerpt'];
+
+       // rename
+       $data['user_ID'] = $GLOBALS['user_ID'];
+
+       if ( isset($data['post_parent']) )
+               $data['parent_id'] = $data['post_parent'];
+
+       // status
+       if ( isset($data['keep_private']) && 'private' == $data['keep_private'] )
+               $data['post_status'] = 'private';
+       else
+               $data['post_status'] = $data['_status'];
+
+       if ( empty($data['comment_status']) )
+               $data['comment_status'] = 'closed';
+       if ( empty($data['ping_status']) )
+               $data['ping_status'] = 'closed';
+
+       // update the post
+       $_POST = $data;
+       edit_post();
+
+       $post = array();
+       if ( 'page' == $_POST['post_type'] ) {
+               $post[] = get_post($_POST['post_ID']);
+               page_rows($post);
+       } elseif ( 'post' == $_POST['post_type'] ) {
+               $mode = $_POST['post_view'];
+               $post[] = get_post($_POST['post_ID']);
+               post_rows($post);
+       }
+
+       exit;
+       break;
+case 'inline-save-tax':
+       check_ajax_referer( 'taxinlineeditnonce', '_inline_edit' );
+
+       if ( ! current_user_can('manage_categories') )
+               die( __('Cheatin&#8217; uh?') );
+
+       if ( ! isset($_POST['tax_ID']) || ! ( $id = (int) $_POST['tax_ID'] ) )
+               die(-1);
+
+       switch ($_POST['tax_type']) {
+               case 'cat' :
+                       $data = array();
+                       $data['cat_ID'] = $id;
+                       $data['cat_name'] = $_POST['name'];
+                       $data['category_nicename'] = $_POST['slug'];
+                       if ( isset($_POST['parent']) && (int) $_POST['parent'] > 0 )
+                               $data['category_parent'] = $_POST['parent'];
+
+                       $cat = get_category($id, ARRAY_A);
+                       $data['category_description'] = $cat['category_description'];
+
+                       $updated = wp_update_category($data);
+
+                       if ( $updated && !is_wp_error($updated) )
+                               echo _cat_row( $updated, 0 );
+                       else
+                               die( __('Category not updated.') );
+
+                       break;
+               case 'link-cat' :
+                       $updated = wp_update_term($id, 'link_category', $_POST);
+
+                       if ( $updated && !is_wp_error($updated) )
+                               echo link_cat_row($updated['term_id']);
+                       else
+                               die( __('Category not updated.') );
+
+                       break;
+               case 'tag' :
+                       $updated = wp_update_term($id, 'post_tag', $_POST);
+                       if ( $updated && !is_wp_error($updated) ) {
+                               $tag = get_term( $updated['term_id'], 'post_tag' );
+                               if ( !$tag || is_wp_error( $tag ) )
+                                       die( __('Tag not updated.') );
+
+                               echo _tag_row($tag);
+                       } else {
+                               die( __('Tag not updated.') );
+                       }
+
+                       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' );
+
+       if ( empty($_POST['ps']) )
+               exit;
+
+       $what = isset($_POST['pages']) ? 'page' : 'post';
+       $s = stripslashes($_POST['ps']);
+       preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches);
+       $search_terms = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
+
+       $searchand = $search = '';
+       foreach( (array) $search_terms as $term) {
+               $term = addslashes_gpc($term);
+               $search .= "{$searchand}(($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%'))";
+               $searchand = ' AND ';
+       }
+       $term = $wpdb->escape($s);
+       if ( count($search_terms) > 1 && $search_terms[0] != $s )
+               $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";
+
+       $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND $search ORDER BY post_date_gmt DESC LIMIT 50" );
+
+       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>';
+       foreach ( $posts as $post ) {
+
+               switch ( $post->post_status ) {
+                       case 'publish' :
+                       case 'private' :
+                               $stat = __('Published');
+                               break;
+                       case 'future' :
+                               $stat = __('Scheduled');
+                               break;
+                       case 'pending' :
+                               $stat = __('Pending Review');
+                               break;
+                       case 'draft' :
+                               $stat = __('Unpublished');
+                               break;
+               }
+
+               if ( '0000-00-00 00:00:00' == $post->post_date ) {
+                       $time = '';
+               } else {
+                       $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 .= '</tbody></table>';
+
+       $x = new WP_Ajax_Response();
+       $x->add( array(
+               'what' => $what,
+               'data' => $html
+       ));
+       $x->send();
+
+       break;
 default :
        do_action( 'wp_ajax_' . $_POST['action'] );
        die('0');
 default :
        do_action( 'wp_ajax_' . $_POST['action'] );
        die('0');
index d5f129f3be2dc9010252d5f64d84ac1f070843c3..87d953fa22bdb75a5ca5ddb5d0bd06b8f7060092 100644 (file)
@@ -1,14 +1,28 @@
-</div><!-- wpbody -->
-</div><!-- wpcontent -->
+<?php
+/**
+ * WordPress Administration Template Footer
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+?>
+
+<div class="clear"></div></div><!-- wpbody-content -->
+<div class="clear"></div></div><!-- wpbody -->
+<div class="clear"></div></div><!-- wpcontent -->
 </div><!-- wpwrap -->
 </div><!-- wpwrap -->
+
 <div id="footer">
 <div id="footer">
-<p><?php
-do_action('in_admin_footer', '');
+<p id="footer-left" class="alignleft"><?php
+do_action( 'in_admin_footer' );
 $upgrade = apply_filters( 'update_footer', '' );
 $upgrade = apply_filters( 'update_footer', '' );
-echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>').' | '.__('<a href="http://codex.wordpress.org/">Documentation</a>').' | '.__('<a href="http://wordpress.org/support/forum/4">Feedback</a>').' '.$upgrade;
-?></p>
+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>'); ?>
+</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', ''); ?>
 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
 </body>
 </div>
 <?php do_action('admin_footer', ''); ?>
 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
 </body>
-</html>
+</html>
\ No newline at end of file
index 4a0d327b3befbad50193be176c9727c833d43165..b8c84fdad7065bcebf1035ee8ec828ef8f862de0 100644 (file)
@@ -1,5 +1,16 @@
 <?php
 <?php
-// Deprecated.  Use includes/admin.php.
+/**
+ * Administration Functions
+ *
+ * This file is deprecated, use 'wp-admin/includes/admin.php' instead.
+ *
+ * @deprecated 2.5
+ * @package WordPress
+ * @subpackage Administration
+ */
+
 _deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/admin.php' );
 _deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/admin.php' );
+
+/** WordPress Administration API: Includes all Administration functions. */
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
-?>
+?>
\ No newline at end of file
index 54fdea489274eab7098d13fe6fd1378781714d59..33e88732c3af25d946396bf65c7c9df02ac97d86 100644 (file)
@@ -1,33 +1,23 @@
 <?php
 <?php
+/**
+ * WordPress Administration Template Header
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 if (!isset($_GET["page"])) require_once('admin.php');
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 if (!isset($_GET["page"])) require_once('admin.php');
-if ( $editing ) {
-       if ( user_can_richedit() )
-               wp_enqueue_script( 'wp_tiny_mce' );
-}
-wp_enqueue_script( 'wp-gears' );
-
-$min_width_pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php', 'widgets.php', 'comment.php', 'link.php' );
-$the_current_page = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
-$ie6_no_scrollbar = true;
-
-function add_minwidth($c) {
-       return $c . 'minwidth ';
-}
-
-if ( in_array( $the_current_page, $min_width_pages ) ) {
-               $ie6_no_scrollbar = false;
-               add_filter( 'admin_body_class', 'add_minwidth' );
-}
 
 get_admin_page_title();
 
 get_admin_page_title();
-
+$title = wp_specialchars( strip_tags( $title ) );
+wp_user_settings();
 ?>
 <!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 wp_specialchars( strip_tags( $title ) ); ?> &#8212; WordPress</title>
+<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title; ?> &#8212; WordPress</title>
 <?php
 
 wp_admin_css( 'css/global' );
 <?php
 
 wp_admin_css( 'css/global' );
@@ -39,94 +29,104 @@ wp_admin_css( 'css/ie' );
 <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();}}};
 <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;
+};
 //]]>
 </script>
 //]]>
 </script>
-<?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') && $ie6_no_scrollbar ) : ?>
-<style type="text/css">* html { overflow-x: hidden; }</style>
-<?php endif;
+<?php
 
 
-$hook_suffixes = array();
+if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
+       add_action( 'admin_head', 'wp_tiny_mce' );
+}
 
 
+$hook_suffix = '';
 if ( isset($page_hook) )
 if ( isset($page_hook) )
-       $hook_suffixes[] = "-$page_hook";
+       $hook_suffix = "$page_hook";
 else if ( isset($plugin_page) )
 else if ( isset($plugin_page) )
-       $hook_suffixes[] = "-$plugin_page";
+       $hook_suffix = "$plugin_page";
 else if ( isset($pagenow) )
 else if ( isset($pagenow) )
-       $hook_suffixes[] = "-$pagenow";
-
-$hook_suffixes[] = '';
+       $hook_suffix = "$pagenow";
 
 
-foreach ( $hook_suffixes as $hook_suffix )
-       do_action("admin_print_styles$hook_suffix"); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
-foreach ( $hook_suffixes as $hook_suffix )
-       do_action("admin_print_scripts$hook_suffix"); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
-foreach ( $hook_suffixes as $hook_suffix )
-       do_action("admin_head$hook_suffix"); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
-unset($hook_suffixes, $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_scripts');
+do_action("admin_head-$hook_suffix");
+do_action('admin_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', '' ); ?>">
 </head>
 <body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
+
 <div id="wpwrap">
 <div id="wpcontent">
 <div id="wphead">
 <div id="wpwrap">
 <div id="wpcontent">
 <div id="wphead">
-<h1><?php if ( '' == get_bloginfo('name', 'display') ) echo '&nbsp;'; else echo get_bloginfo('name', 'display'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
-</div>
-
 <?php
 <?php
-if ( ! $is_opera ) { 
+$blog_name = get_bloginfo('name', 'display');
+if ( '' == $blog_name ) {
+       $blog_name = '&nbsp;';
+} else {
+       $blog_name_excerpt = wp_html_excerpt($blog_name, 40);
+       if ( $blog_name != $blog_name_excerpt )
+               $blog_name_excerpt = trim($blog_name_excerpt) . '&hellip;';
+       $blog_name = $blog_name_excerpt;
+}
+$title_class = '';
+if ( function_exists('mb_strlen') ) {
+       if ( mb_strlen($blog_name, 'UTF-8') > 30 )
+               $title_class = 'class="long-title"';
+} else {
+       if ( strlen($blog_name) > 30 )
+               $title_class = 'class="long-title"';
+}
 ?>
 ?>
-       <div id="gears-info-box" class="info-box" style="display:none;">
-       <img src="images/gear.png" title="Gear" alt="" class="gears-img" />
-       <div id="gears-msg1">
-       <h3 class="info-box-title"><?php _e('Speed up WordPress'); ?></h3>
-       <p><?php _e('WordPress now has support for Gears, which adds new features to your web browser.'); ?><br />
-       <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a></p>
-       <p><?php _e('After you install and enable Gears most of WordPress&#8217; images, scripts, and CSS files will be stored locally on your computer. This speeds up page load time.'); ?></p>
-       <p><strong><?php _e('Don&#8217;t install on a public or shared computer.'); ?></strong></p>     <div class="submit"><button onclick="window.location = 'http://gears.google.com/?action=install&amp;return=<?php echo urlencode( admin_url() ); ?>';" class="button"><?php _e('Install Now'); ?></button>
-       <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
-       </div>
-
-       <div id="gears-msg2" style="display:none;">
-       <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
-       <p><?php _e('Gears is installed on this computer but is not enabled for use with WordPress.'); ?></p> 
-       <p><?php 
-       
-       if ( $is_safari )
-               _e('To enable it, make sure this web site is not on the denied list in Gears Settings under the Safari menu, then click the button below.');
-       else
-               _e('To enable it, make sure this web site is not on the denied list in Gears Settings under your browser Tools menu, then click the button below.'); 
-       
-       ?></p>
-       <p><strong><?php _e('However if this is a public or shared computer, Gears should not be enabled.'); ?></strong></p>
-       <div class="submit"><button class="button" onclick="wpGears.getPermission();"><?php _e('Enable Gears'); ?></button>
-       <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
-       </div>
-
-       <div id="gears-msg3" style="display:none;">
-       <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
-       <p><?php
-       
-       if ( $is_safari )
-               _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
-       else
-               _e('Gears is installed and enabled on this computer. You can disable it from your browser Tools menu.'); 
-       
-       ?></p>
-       <p><?php _e('If there are any errors, try disabling Gears, then reload the page and enable it again.'); ?></p>
-       <p><?php _e('Local storage status:'); ?> <span id="gears-wait"><span style="color:#f00;"><?php _e('Please wait! Updating files:'); ?></span> <span id="gears-upd-number"></span></span></p>
-       <div class="submit"><button class="button" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Close'); ?></button></div>
-       </div>
-       </div>
+
+<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>
+
+<div id="wphead-info">
+<div id="user_info">
+<p><?php printf(__('Howdy, <a href="%1$s" title="Edit your profile">%2$s</a>'), 'profile.php', $user_identity) ?>
+<?php if ( ! $is_opera ) { ?><span class="turbo-nag hidden"> | <a href="tools.php"><?php _e('Turbo') ?></a></span><?php } ?> |
+<a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a></p>
+</div>
+
+<?php favorite_actions(); ?>
+</div>
+</div>
+
+<?php if ( get_user_setting('mfold') == 'f' ) { ?>
+<script type="text/javascript">jQuery('#wpcontent').addClass('folded');</script>
 <?php } ?>
 
 <?php } ?>
 
-<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>'); if ( ! $is_opera ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Turbo') ?></a></span><?php } ?></p></div>
+<div id="wpbody">
+<?php require(ABSPATH . 'wp-admin/menu-header.php'); ?>
 
 
+<div id="wpbody-content">
 <?php
 <?php
-require(ABSPATH . 'wp-admin/menu-header.php');
+screen_meta($hook_suffix);
+
+do_action('admin_notices');
 
 if ( $parent_file == 'options-general.php' ) {
        require(ABSPATH . 'wp-admin/options-head.php');
 }
 
 if ( $parent_file == 'options-general.php' ) {
        require(ABSPATH . 'wp-admin/options-head.php');
 }
-?>
-<div id="wpbody">
index f45fc62ecd7843a4431f9aa059cdda10d1aa73ad..55c7d9f3686d20053637b8e28b957dd8ee97cd22 100644 (file)
@@ -1,5 +1,13 @@
 <?php
 <?php
-define('WP_ADMIN', TRUE);
+/**
+ * WordPress Administration Generic POST Handler.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** We are located in WordPress Administration Panels */
+define('WP_ADMIN', true);
 
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
 
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
index 20ff3693f5562b4e1d21c8ba6bee960223d995e0..fc6f70780dd028c91f4499eac976210f0e313249 100644 (file)
@@ -1,4 +1,16 @@
 <?php
 <?php
+/**
+ * WordPress Administration Bootstrap
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * In WordPress Administration Panels
+ *
+ * @since unknown
+ */
 define('WP_ADMIN', TRUE);
 
 if ( defined('ABSPATH') )
 define('WP_ADMIN', TRUE);
 
 if ( defined('ABSPATH') )
@@ -26,8 +38,8 @@ $time_format = get_option('time_format');
 
 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
 
 
 wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
 
-wp_admin_css_color('classic', __('Classic'), admin_url("css/colors-classic.css"), array('#07273E', '#14568A', '#D54E21', '#2683AE'));
-wp_admin_css_color('fresh', __('Fresh'), admin_url("css/colors-fresh.css"), array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
+wp_admin_css_color('classic', __('Blue'), admin_url("css/colors-classic.css"), array('#073447', '#21759B', '#EAF3FA', '#BBD8E7'));
+wp_admin_css_color('fresh', __('Gray'), admin_url("css/colors-fresh.css"), array('#464646', '#6D6D6D', '#F1F1F1', '#DFDFDF'));
 
 wp_enqueue_script( 'common' );
 wp_enqueue_script( 'jquery-color' );
 
 wp_enqueue_script( 'common' );
 wp_enqueue_script( 'jquery-color' );
@@ -45,7 +57,19 @@ do_action('admin_init');
 
 // Handle plugin admin pages.
 if (isset($plugin_page)) {
 
 // Handle plugin admin pages.
 if (isset($plugin_page)) {
-       $page_hook = get_plugin_page_hook($plugin_page, $pagenow);
+       if( ! $page_hook = get_plugin_page_hook($plugin_page, $pagenow) ) {
+               $page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
+               // backwards compatibility for plugins using add_management_page
+               if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
+                       // There could be plugin specific params on the URL, so we need the whole query string
+                       if ( !empty($_SERVER[ 'QUERY_STRING' ]) )
+                               $query_string = $_SERVER[ 'QUERY_STRING' ];
+                       else
+                               $query_string = 'page=' . $plugin_page;
+                       wp_redirect( 'tools.php?' . $query_string );
+                       exit;
+               }
+       }
 
        if ( $page_hook ) {
                do_action('load-' . $page_hook);
 
        if ( $page_hook ) {
                do_action('load-' . $page_hook);
@@ -84,7 +108,7 @@ if (isset($plugin_page)) {
        }
 
        // Allow plugins to define importers as well
        }
 
        // Allow plugins to define importers as well
-       if (! is_callable($wp_importers[$importer][2]))
+       if ( !isset($wp_importers) || !isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]))
        {
                if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
                {
        {
                if (! file_exists(ABSPATH . "wp-admin/import/$importer.php"))
                {
@@ -93,7 +117,7 @@ if (isset($plugin_page)) {
                include(ABSPATH . "wp-admin/import/$importer.php");
        }
 
                include(ABSPATH . "wp-admin/import/$importer.php");
        }
 
-       $parent_file = 'edit.php';
+       $parent_file = 'tools.php';
        $submenu_file = 'import.php';
        $title = __('Import');
 
        $submenu_file = 'import.php';
        $title = __('Import');
 
@@ -108,6 +132,10 @@ if (isset($plugin_page)) {
 
        include(ABSPATH . 'wp-admin/admin-footer.php');
 
 
        include(ABSPATH . 'wp-admin/admin-footer.php');
 
+       // Make sure rules are flushed
+       global $wp_rewrite;
+       $wp_rewrite->flush_rules();
+
        exit();
 } else {
        do_action("load-$pagenow");
        exit();
 } else {
        do_action("load-$pagenow");
index 18b810414168c571a4bc7e864b921885a89c6ac9..8ee85fc1f838924581e9fe78efcba146389d5145 100644 (file)
@@ -1,8 +1,10 @@
 <?php
 <?php
-
-/* This accepts file uploads from swfupload or other asynchronous upload methods.
-
-*/
+/**
+ * Accepts file uploads from swfupload or other asynchronous upload methods.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
 
 if ( defined('ABSPATH') )
        require_once(ABSPATH . 'wp-load.php');
@@ -22,9 +24,14 @@ header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
 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.'));
 
-// just fetch the detail form for that attachment      
-if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
-       echo get_media_item($id);
+// just fetch the detail form for that attachment
+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 ));
+       } else {
+               echo get_media_item($id);
+       }
        exit;
 }
 
        exit;
 }
 
@@ -46,4 +53,4 @@ else {
        echo apply_filters("async_upload_{$type}", $id);
 }
 
        echo apply_filters("async_upload_{$type}", $id);
 }
 
-?>
+?>
\ No newline at end of file
index d2e8fb3720f45eef84691d3928a941c124463556..e704248025e668eae37a0e8a882079b25a58710f 100644 (file)
@@ -1,12 +1,19 @@
 <?php
 <?php
+/**
+ * Categories Management Panel
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once('admin.php');
 
 $title = __('Categories');
 require_once('admin.php');
 
 $title = __('Categories');
-$parent_file = 'edit.php';
 
 
-wp_reset_vars(array('action', 'cat'));
+wp_reset_vars( array('action', 'cat') );
 
 
-if ( isset($_GET['deleteit']) && isset($_GET['delete']) )
+if ( isset( $_GET['action'] ) && isset($_GET['delete']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
        $action = 'bulk-delete';
 
 switch($action) {
        $action = 'bulk-delete';
 
 switch($action) {
@@ -63,7 +70,6 @@ case 'bulk-delete':
        }
 
        $sendback = wp_get_referer();
        }
 
        $sendback = wp_get_referer();
-       $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
 
        wp_redirect($sendback);
        exit();
 
        wp_redirect($sendback);
        exit();
@@ -71,6 +77,8 @@ case 'bulk-delete':
 break;
 case 'edit':
 
 break;
 case 'edit':
 
+       $title = __('Edit Category');
+
        require_once ('admin-header.php');
        $cat_ID = (int) $_GET['cat_ID'];
        $category = get_category_to_edit($cat_ID);
        require_once ('admin-header.php');
        $cat_ID = (int) $_GET['cat_ID'];
        $category = get_category_to_edit($cat_ID);
@@ -85,23 +93,32 @@ case 'editedcat':
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
+       $location = 'categories.php';
+       if ( $referer = wp_get_original_referer() ) {
+               if ( false !== strpos($referer, 'categories.php') )
+                       $location = $referer;
+       }
+
        if ( wp_update_category($_POST) )
        if ( wp_update_category($_POST) )
-               wp_redirect('categories.php?message=3');
+               $location = add_query_arg('message', 3, $location);
        else
        else
-               wp_redirect('categories.php?message=5');
+               $location = add_query_arg('message', 5, $location);
+
+       wp_redirect($location);
 
        exit;
 break;
 
 default:
 
 
        exit;
 break;
 
 default:
 
-if ( !empty($_GET['_wp_http_referer']) ) {
-        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
         exit;
 }
 
-wp_enqueue_script( 'admin-categories' );
-wp_enqueue_script('admin-forms');
+wp_enqueue_script('admin-categories');
+if ( current_user_can('manage_categories') )
+       wp_enqueue_script('inline-edit-tax');
 
 require_once ('admin-header.php');
 
 
 require_once ('admin-header.php');
 
@@ -112,39 +129,47 @@ $messages[4] = __('Category not added.');
 $messages[5] = __('Category not updated.');
 ?>
 
 $messages[5] = __('Category not updated.');
 ?>
 
-<?php if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<div class="wrap nosubsub">
+<?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( stripslashes($_GET['s']) ) ); ?>
+</h2>
+
+<?php
+if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 
-<div class="wrap">
-<form id="posts-filter" action="" method="get">
-<?php if ( current_user_can('manage_categories') ) : ?>
-       <h2><?php printf(__('Manage Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
-<?php else : ?>
-       <h2><?php _e('Manage Categories') ?> </h2>
-<?php endif; ?>
-
-<p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e('Search Categories'); ?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
+<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" />
 </p>
        <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
 </p>
-
+</form>
 <br class="clear" />
 
 <br class="clear" />
 
+<div id="col-container">
+
+<div id="col-right">
+<div class="col-wrap">
+<form id="posts-filter" action="" method="get">
 <div class="tablenav">
 
 <?php
 <div class="tablenav">
 
 <?php
-$pagenum = absint( $_GET['pagenum'] );
+$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 if ( empty($pagenum) )
        $pagenum = 1;
-if( !$catsperpage || $catsperpage < 0 )
+if( ! isset( $catsperpage ) || $catsperpage < 0 )
        $catsperpage = 20;
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
        $catsperpage = 20;
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
        'total' => ceil(wp_count_terms('category') / $catsperpage),
        'current' => $pagenum
 ));
        'total' => ceil(wp_count_terms('category') / $catsperpage),
        'current' => $pagenum
 ));
@@ -153,56 +178,135 @@ if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+<div class="alignleft actions">
+<select name="action">
+<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" />
 <?php wp_nonce_field('bulk-categories'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
 <?php wp_nonce_field('bulk-categories'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
-<br class="clear" />
+<div class="clear"></div>
 
 
-<table class="widefat">
+<table class="widefat fixed" cellspacing="0">
        <thead>
        <tr>
        <thead>
        <tr>
-               <th scope="col" class="check-column"><input type="checkbox" /></th>
-        <th scope="col"><?php _e('Name') ?></th>
-        <th scope="col"><?php _e('Description') ?></th>
-        <th scope="col" class="num"><?php _e('Posts') ?></th>
+<?php print_column_headers('categories'); ?>
        </tr>
        </thead>
        </tr>
        </thead>
+
+       <tfoot>
+       <tr>
+<?php print_column_headers('categories', false); ?>
+       </tr>
+       </tfoot>
+
        <tbody id="the-list" class="list:cat">
 <?php
 cat_rows(0, 0, 0, $pagenum, $catsperpage);
 ?>
        </tbody>
 </table>
        <tbody id="the-list" class="list:cat">
 <?php
 cat_rows(0, 0, 0, $pagenum, $catsperpage);
 ?>
        </tbody>
 </table>
-</form>
 
 <div class="tablenav">
 
 <div class="tablenav">
-
 <?php
 if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 <?php
 if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
-<br class="clear" />
+
+<div class="alignleft actions">
+<select name="action2">
+<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" />
+<?php wp_nonce_field('bulk-categories'); ?>
 </div>
 </div>
-<br class="clear" />
 
 
+<br class="clear" />
 </div>
 
 </div>
 
-<?php if ( current_user_can('manage_categories') ) : ?>
-<div class="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(__('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(__('<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(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), 'admin.php?import=wp-cat2tag') ?></p>
 </div>
 
-<?php include('edit-category-form.php'); ?>
+</div>
+</div><!-- /col-right -->
+
+<div id="col-left">
+<div class="col-wrap">
+
+<?php if ( current_user_can('manage_categories') ) { ?>
+<?php $category = (object) array(); $category->parent = 0; do_action('add_category_form_pre', $category); ?>
+
+<div class="form-wrap">
+<h3><?php _e('Add Category'); ?></h3>
+<div id="ajax-response"></div>
+<form name="addcat" id="addcat" method="post" action="categories.php" class="add:the-list: validate">
+<input type="hidden" name="action" value="addcat" />
+<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-category'); ?>
+
+<div class="form-field form-required">
+       <label for="cat_name"><?php _e('Category Name') ?></label>
+       <input name="cat_name" id="cat_name" type="text" value="" size="40" aria-required="true" />
+    <p><?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></p>
+</div>
+
+<div class="form-field">
+       <label for="category_nicename"><?php _e('Category Slug') ?></label>
+       <input name="category_nicename" id="category_nicename" 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>
+
+<div class="form-field">
+       <label for="category_parent"><?php _e('Category Parent') ?></label>
+       <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?>
+    <p><?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.'); ?></p>
+</div>
+
+<div class="form-field">
+       <label for="category_description"><?php _e('Description') ?></label>
+       <textarea name="category_description" id="category_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 _e('Add Category'); ?>" /></p>
+<?php do_action('edit_category_form', $category); ?>
+</form></div>
 
 
-<?php endif; ?>
+<?php } ?>
+
+</div>
+</div><!-- /col-left -->
+
+</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
 
 <?php
+inline_edit_term_row('categories');
+
 break;
 }
 
 break;
 }
 
index d1e394ea9a3d7f6d77ba8f481b43a89026e6ab7e..129d62113770b37146873e2231c5a7f25d4f809c 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Comment Management Panel
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once('admin.php');
 
 $parent_file = 'edit-comments.php';
 require_once('admin.php');
 
 $parent_file = 'edit-comments.php';
@@ -9,7 +17,12 @@ wp_reset_vars( array('action') );
 if ( isset( $_POST['deletecomment'] ) )
        $action = 'deletecomment';
 
 if ( isset( $_POST['deletecomment'] ) )
        $action = 'deletecomment';
 
-function comment_footer_die( $msg ) {  // $msg is assumed to contain HTML and be sanitized
+/**
+ * Display error message at bottom of comments.
+ *
+ * @param string $msg Error Message. Assumed to contain HTML and be sanitized.
+ */
+function comment_footer_die( $msg ) {  //
        echo "<div class='wrap'><p>$msg</p></div>";
        include('admin-footer.php');
        die;
        echo "<div class='wrap'><p>$msg</p></div>";
        include('admin-footer.php');
        die;
@@ -21,7 +34,6 @@ case 'editcomment' :
        $title = __('Edit Comment');
 
        wp_enqueue_script('comment');
        $title = __('Edit Comment');
 
        wp_enqueue_script('comment');
-
        require_once('admin-header.php');
 
        $comment_id = absint( $_GET['c'] );
        require_once('admin-header.php');
 
        $comment_id = absint( $_GET['c'] );
@@ -111,7 +123,7 @@ if ( 'spam' == $_GET['dt'] ) {
 </tr>
 <?php } ?>
 <tr>
 </tr>
 <?php } ?>
 <tr>
-<th scope="row" valign="top"><?php _e('Comment'); ?></th>
+<th scope="row" valign="top"><?php echo _c('Comment|noun'); ?></th>
 <td><?php echo $comment->comment_content; ?></td>
 </tr>
 </table>
 <td><?php echo $comment->comment_content; ?></td>
 </tr>
 </table>
@@ -171,7 +183,7 @@ case 'unapprovecomment' :
        if ( '' != wp_get_referer() && false == $noredir )
                wp_redirect( wp_get_referer() );
        else
        if ( '' != wp_get_referer() && false == $noredir )
                wp_redirect( wp_get_referer() );
        else
-               wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
+               wp_redirect( admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
 
        exit();
        break;
 
        exit();
        break;
@@ -196,7 +208,7 @@ case 'approvecomment' :
        if ( '' != wp_get_referer() && false == $noredir )
                wp_redirect( wp_get_referer() );
        else
        if ( '' != wp_get_referer() && false == $noredir )
                wp_redirect( wp_get_referer() );
        else
-               wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
+               wp_redirect( admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
 
        exit();
        break;
 
        exit();
        break;
@@ -210,7 +222,7 @@ case 'editedcomment' :
 
        edit_comment();
 
 
        edit_comment();
 
-       $location = ( empty( $_POST['referredby'] ) ? "edit.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id;
+       $location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id;
        $location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
        wp_redirect( $location );
 
        $location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
        wp_redirect( $location );
 
@@ -225,4 +237,4 @@ default:
 
 include('admin-footer.php');
 
 
 include('admin-footer.php');
 
-?>
+?>
\ No newline at end of file
index 4c6f3271d9342986b460f184e1b9bcb4fb5f6288..4a550afdc10211e002b9026be7e8066afc92da33 100644 (file)
@@ -1,24 +1,80 @@
-.post-com-count {
-}
-#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
-       background-image: url(../images/comment-stalk-rtl.gif);
-       background-position:right bottom;
-}
-#footer {
-       background-position:99% 10px;
-}
-#poststuff .closed .togbox, #poststuff .togbox {
-       background-image: url(../images/toggle-arrow-rtl.gif) !important;
-}
 .bar {
        border-right-color: transparent;
        border-left-color: #99d;
 }
 .bar {
        border-right-color: transparent;
        border-left-color: #99d;
 }
+
 .plugins .togl {
        border-right-color: transparent;
        border-left-color: #ccc;
 }
 .plugins .togl {
        border-right-color: transparent;
        border-left-color: #ccc;
 }
+
+.post-com-count {
+       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;
+}
 #upload-menu li.current {
        border-right-color: transparent;
        border-left-color: #448abd;
 }
 #upload-menu li.current {
        border-right-color: transparent;
        border-left-color: #448abd;
 }
+
+#adminmenu .wp-submenu .current a.current {
+       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
+}
+
+#adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
+}
+
+.folded #adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
+}
+
+#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;
+}
+
+#adminmenu .wp-has-current-submenu ul li a.current {
+       background: url(../images/menu-dark-rtl.gif) top right no-repeat !important;
+}
+
+#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;
+}
+
+#adminmenu li.wp-has-current-submenu ul li a {
+       background: url(../images/menu-dark-rtl.gif) bottom right no-repeat !important;
+}
+
+#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;
+}
+
+#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;
+}
+
+#adminmenu a.wp-has-submenu {
+       background: #f1f1f1 url(../images/menu-bits-rtl.gif) repeat-x scroll right -379px;
+}
+
+#adminmenu .wp-submenu a {
+       background: #FFFFFF url(../images/menu-bits-rtl.gif) no-repeat scroll right -310px;
+}
+
+#adminmenu li.current a,
+#adminmenu .wp-submenu a:hover {
+       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
+}
+
+#adminmenu li.wp-has-current-submenu a.wp-has-submenu {
+       background: #b5b5b5 url(../images/menu-bits-rtl.gif) repeat-x scroll right top;
+}
+
+.meta-box-sortables .postbox:hover .handlediv {
+       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll right -111px;
+}
index 65d0f3831420af13aa75ce541ee8447a9355ded8..49ba5f8f7021a247553a6c25f2dd49beebddcdbd 100644 (file)
@@ -1,9 +1,27 @@
+html {
+       background-color: #F5FCFD;
+}
+
+.find-box-search {
+       border-color: #dfdfdf;
+       background-color: #f1f1f1;
+}
+
+.find-box {
+       background-color: #f1f1f1;
+}
+
+.find-box-inside {
+       background-color: #fff;
+}
+
 a.page-numbers:hover {
        border-color: #999;
 }
 
 a.page-numbers:hover {
        border-color: #999;
 }
 
-body, .form-table .pre {
-       background-color: #fff;
+body,
+#wpbody,
+.form-table .pre {
        color: #333;
 }
 
        color: #333;
 }
 
@@ -11,51 +29,118 @@ body > #upload-menu {
        border-bottom-color: #fff;
 }
 
        border-bottom-color: #fff;
 }
 
-div#current-widgets, #postcustomstuff table, #your-profile fieldset, a.page-numbers, #rightnow, div.dashboard-widget, .widefat {
+kbd, code {
+       background: #eaeaea;
+}
+
+div#current-widgets,
+#postcustomstuff table,
+#your-profile fieldset,
+#rightnow,
+div.dashboard-widget,
+#dashboard-widgets p.dashboard-widget-links,
+#replyrow #ed_reply_toolbar input {
        border-color: #ccc;
 }
 
        border-color: #ccc;
 }
 
+#poststuff .inside label.spam {
+       color: red;
+}
+
+#poststuff .inside label.waiting {
+       color: orange;
+}
+
+#poststuff .inside label.approved {
+       color: green;
+}
+
+#postcustomstuff table {
+       border-color: #dfdfdf;
+       background-color: #F9F9F9;
+}
+
+#postcustomstuff thead th {
+       background-color: #F1F1F1;
+}
+
+#postcustomstuff table input,
+#postcustomstuff table textarea {
+       border-color: #dfdfdf;
+       background-color: #fff;
+}
+
+.widefat {
+       border-color: #BBD8E7;
+       background-color: #fff;
+}
+
 div.dashboard-widget-error {
        background-color: #c43;
 }
 
 div.dashboard-widget-notice {
 div.dashboard-widget-error {
        background-color: #c43;
 }
 
 div.dashboard-widget-notice {
-       background-color: #F0F6FB;
+       background-color: #cfe1ef;
 }
 
 }
 
-div.dashboard-widget-submit, ul.widget-control-list div.widget-control-actions {
+div.dashboard-widget-submit,
+ul.widget-control-list div.widget-control-actions {
        border-top-color: #ccc;
 }
 
        border-top-color: #ccc;
 }
 
-input.disabled, textarea.disabled {
-       background-color: #ccc;
+div.ui-tabs-panel {
+       border-color: #f1f1f1;
+}
+
+ul#category-tabs li.ui-tabs-selected {
+       background-color: #f1f1f1;
 }
 
 }
 
-#user_info a:hover, li.widget-list-control-item h4.widget-title a:hover, .submit a, #dashmenu a:hover, #footer a, #upload-menu li a.upload-tab-link, li.widget-list-control-item h4.widget-title a,
+input.disabled,
+textarea.disabled {
+       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,
-#draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover {
+#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,
+#plugin-information .action-button a:visited {
        color: #fff;
 }
 
        color: #fff;
 }
 
-ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
-       background-color: #cfebf7;
+li.widget-list-control-item div.widget-control {
+       background-color: #fff;
+       border-color: #dfdfdf;
 }
 
 }
 
-div.ui-tabs-panel {
-       border-color: #cfebf7;
+.metabox-holder .postbox h3,
+#poststuff .postbox h3,
+#poststuff .stuffbox h3 {
+       background: #dfdfdf url("../images/blue-grad.png") repeat-x left top;
+       text-shadow: #fff 0 1px 0;
+}
+
+.form-table th,
+.form-wrap label {
+       color: #222;
+       text-shadow: #fff 0 1px 0;
+}
+
+.setting-description, .form-wrap p {
+       color: #666;
 }
 
 select {
        background-color: #fff;
 }
 
 select {
        background-color: #fff;
-       border-color: #ddd;
+       border-color: #8CBDD5;
 }
 
 strong .post-com-count span {
 }
 
 strong .post-com-count span {
-       background-color: #2583ad;
-}
-
-.button-secondary, #login form .submit input {
-       background-color: #8ebddc !important;
+       background-color: #21759b;
 }
 
 ul#widget-list li.widget-list-item h4.widget-title {
 }
 
 ul#widget-list li.widget-list-item h4.widget-title {
@@ -67,10 +152,14 @@ ul#widget-list li.widget-list-item h4.widget-title {
        background-color: #ccf3fa;
 }
 
        background-color: #ccf3fa;
 }
 
-.ac_match, .subsubsub a.current, h2 {
+.ac_match, .subsubsub a.current {
        color: #000;
 }
 
        color: #000;
 }
 
+.wrap h2 {
+       color: #093E56;
+}
+
 .ac_over {
        background-color: #f0f0b8;
 }
 .ac_over {
        background-color: #f0f0b8;
 }
@@ -84,13 +173,13 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #101010;
 }
 
        color: #101010;
 }
 
-.alternate {
-       background-color: #f9f9f9;
+.alternate, .alt {
+       background-color: #EDFBFC;
 }
 
 .available-theme a.screenshot {
        background-color: #f1f1f1;
 }
 
 .available-theme a.screenshot {
        background-color: #f1f1f1;
-       border-color: #ccc;
+       border-color: #ddd;
 }
 
 .bar {
 }
 
 .bar {
@@ -98,8 +187,11 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-right-color: #99d;
 }
 
        border-right-color: #99d;
 }
 
-.describe {
-       border-top-color: #d0d0d0;
+#media-upload {
+       background: #fff;
+}
+#media-upload .slidetoggle {
+       border-top-color: #dfdfdf;
 }
 
 .error, #login #login_error {
 }
 
 .error, #login #login_error {
@@ -119,44 +211,45 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-color: #c00 !important;
 }
 
        border-color: #c00 !important;
 }
 
-.form-table input, .form-table textarea {
-       border-color: #c6d9e9;
-}
-
-.form-table td, .form-table th {
-       border-bottom-color: #fff;
+.form-table input,
+.form-table textarea,
+.search-input,
+.form-field input,
+.form-field textarea,
+.submit {
+       border-color: #8CBDD5;
 }
 
 .highlight {
 }
 
 .highlight {
-       background-color: #cfebf7;
+       background-color: #e4f2fd;
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
-.howto, .nonessential, #sidemenu, #edit-slug-box, .form-input-tip, #dashboard_primary span.rss-date, .subsubsub, #dashboard_secondary div.dashboard-widget-content ul li a cite {
-       color: #999;
-}
-
-#dashmenu a, #user_info a {
-       color: #88b4d7;
+.howto,
+.nonessential,
+#edit-slug-box,
+.form-input-tip,
+.rss-widget span.rss-date,
+.subsubsub {
+       color: #666;
 }
 
 .media-item {
 }
 
 .media-item {
-       border-bottom-color: #d0d0d0;
+       border-bottom-color: #dfdfdf;
 }
 
 }
 
-.media-upload-form label.form-help, td.help {
-       color: #9a9a9a;
+#wpbody-content #media-items .describe {
+       border-top-color: #dfdfdf;
 }
 
 }
 
-.page-numbers {
-       background-color: #fff;
-       border-color: #fff;
+.describe input[type="text"],
+.describe textarea {
+       border-color: #dfdfdf;
 }
 
 }
 
-.page-numbers.current {
-       background-color: #328ab2;
-       border-color: #328ab2;
-       color: #fff;
+.media-upload-form label.form-help,
+td.help {
+       color: #9a9a9a;
 }
 
 .post-com-count {
 }
 
 .post-com-count {
@@ -186,46 +279,100 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #666;
 }
 
        color: #666;
 }
 
-.submit input, .button, .button-secondary, #login form .submit input, div.dashboard-widget-submit input, #edit-slug-buttons a.save {
-       background-color: #e5e5e5;
-       color: #07273e;
-       border-color: #a3a3a3;
+.button,
+.button-secondary,
+.submit input,
+input[type=button],
+input[type=submit] {
+       border-color: #8CBDD5;
+       color: #093E56;
 }
 
 }
 
-.button[disabled], .button:disabled {
-       background-color: #999;
+.button:hover,
+.button-secondary:hover,
+.submit input:hover,
+input[type=button]:hover,
+input[type=submit]:hover {
+       color: #000;
+       border-color: #21759B;
 }
 
 }
 
-.tablenav .button-secondary {
-       border-color: #5396c5;
+.button,
+.submit input,
+.button-secondary {
+       background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
 }
 
 }
 
-.submit input:hover, .button:hover, #edit-slug-buttons a.save:hover {
-       border-color: #535353;
+.button:active,
+.submit input:active,
+.button-secondary:active {
+       background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
 }
 
 }
 
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.del-link:hover {
+.button-primary,
+.submit .button-primary,
+#login form .submit input {
+       border-color: #298cba !important;
+       font-weight: bold;
+       color: #FFF !important;
+       background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
+}
+
+.button-primary:active,
+#login form .submit input:active {
+       background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top !important;
+}
+
+.button[disabled],
+.button:disabled,
+.button-secondary[disabled],
+.button-secondary:disabled,
+a.button.disabled {
+       color: #ccc !important;
+       border-color: #ccc;
+}
+
+.button-primary[disabled],
+.button-primary:disabled {
+       color: #2fa0d5 !important;
+}
+
+a:active,
+a:focus {
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
-#adminmenu a:hover, #sidemenu a:hover, .ui-tabs-nav a:hover {
-       color: #97c4d8;
+a:hover,
+#wphead #viewsite a:hover,
+#adminmenu 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,
+div.dashboard-widget-submit input:hover,
+#media-upload a.del-link:hover,
+.ui-tabs-nav a:hover {
+       color: #d54e21;
 }
 
 }
 
-.button-secondary:hover, #login form .submit input:hover {
-       border-color: #328ab2;
-       background-color: #a6d2e5 !important;
+#the-comment-list .comment-item,
+#dashboard-widgets #dashboard_quick_press form p.submit {
+       border-color: #dfdfdf;
 }
 
 }
 
-.submitbox #autosave .error, ul.view-switch li.current a {
-       color: #333;
+.button-primary:hover,
+#login form .submit input:hover {
+       border-color: #13455b !important;
+       color: #EAF2FA !important;
 }
 
 }
 
-.submitbox #previewview {
-       background-color: #5488af;
+#side-info-column #category-tabs .ui-tabs-selected a {
+       color: #333;
 }
 
 }
 
-.submitbox #previewview a, #rightnow .rbutton {
+#rightnow .rbutton {
        background-color: #ebebeb;
        color: #264761;
 }
        background-color: #ebebeb;
        color: #264761;
 }
@@ -235,8 +382,9 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #ccc;
 }
 
        color: #ccc;
 }
 
-.submitbox .submitdelete {
-       border-bottom-color: #999;
+.submitbox .submitdelete, a.delete {
+       color: #f00;
+       border-bottom-color: #f00;
 }
 
 .submitbox .submitdelete:hover,
 }
 
 .submitbox .submitdelete:hover,
@@ -246,94 +394,136 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-bottom-color: #f00;
 }
 
        border-bottom-color: #f00;
 }
 
+#normal-sortables .submitbox .submitdelete:hover {
+       color: #000;
+       background-color: #f00;
+       border-bottom-color: #f00;
+}
+
 .tablenav .dots {
 .tablenav .dots {
-       background-color: #cfebf7;
-       border-color: #cfebf7;
+       border-color: transparent;
 }
 
 }
 
-.tablenav .next, .tablenav .prev{
-       background-color: #cfebf7;
-       border-bottom-color: #cfebf7;
-       border-color: #cfebf7;
-       color: #2583ad;
+.tablenav .next,
+.tablenav .prev {
+       border-color: transparent;
+       color: #21759b;
 }
 
 }
 
-.tablenav .next:hover, .tablenav .prev:hover {
-       border-bottom-color: #d54e21;
-       border-color: #cfebf7;
+.tablenav .next:hover,
+.tablenav .prev:hover {
+       border-color: transparent;
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
-.updated, .login #login_error, .login .message {
+.updated,
+.login #login_error,
+.login .message {
        background-color: #ffffe0;
        border-color: #e6db55;
 }
 
        background-color: #ffffe0;
        border-color: #e6db55;
 }
 
-.updated a {
-       border-bottom-color: #2583ad;
+a.page-numbers {
+       border-bottom-color: #B8D3E2;
 }
 
 }
 
-.widefat td, .widefat th, div#available-widgets-filter, ul#widget-list li.widget-list-item, .commentlist li {
+div#available-widgets-filter,
+ul#widget-list li.widget-list-item,
+.commentlist li {
        border-bottom-color: #ccc;
 }
 
        border-bottom-color: #ccc;
 }
 
-.widefat thead, .thead {
-       background-color: #464646;
-       color: #d7d7d7;
+.widefat td,
+.widefat th {
+       border-bottom-color: #BBD8E7;
 }
 
 }
 
-.widget-control-save, .widget-control-remove {
-       background-color: #83b4d5;
-       color: #246;
+.widefat th {
+       text-shadow: rgba(255,255,255,0.8) 0 1px 0;
 }
 
 }
 
-.wrap h2 {
-       border-bottom-color: #dadada;
-       color: #5a5a5a;
+.widefat thead tr th,
+.widefat tfoot tr th,
+h3.dashboard-widget-title,
+h3.dashboard-widget-title span,
+h3.dashboard-widget-title small,
+.find-box-head {
+       color: #333;
+       background: #dfdfdf url(../images/blue-grad.png) repeat-x scroll left top;
 }
 
 }
 
-#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, a {
-       color: #2e7ca0;
+h3.dashboard-widget-title small a {
+       color: #d7d7d7;
 }
 
 }
 
-#adminmenu a, .ui-tabs-nav a {
-       color: #cfebf6;
+h3.dashboard-widget-title small a:hover {
+       color: #fff;
 }
 
 }
 
-#submenu a {
-       color: #2782af
+#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;
 }
 }
+
 /* Because we don't want visited on these links */
 /* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
+body.press-this .ui-tabs-selected a,
+body.press-this .ui-tabs-selected a:hover {
        background-color: #fff;
        background-color: #fff;
-       border-color: #07273e;
+       border-color: #c6d9e9;
        border-bottom-color: #fff;
        color: #d54e21;
        border-bottom-color: #fff;
        color: #d54e21;
-       font-weight: bold;
 }
 
 }
 
-#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
-       background-image: url(../images/comment-stalk-classic.gif);
-}
-
-#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
+#adminmenu #awaiting-mod,
+#adminmenu .update-plugins,
+#sidemenu a .update-plugins,
+#rightnow .reallynow,
+#plugin-information .action-button {
        background-color: #d54e21;
        color: #fff;
 }
 
        background-color: #d54e21;
        color: #fff;
 }
 
-#rightnow .reallynow {
-       background-color: #114973;
+#adminmenu li a:hover #awaiting-mod,
+#adminmenu li a:hover .update-plugins,
+#sidemenu li a:hover .update-plugins {
+       background-color: #264761;
        color: #fff;
 }
 
        color: #fff;
 }
 
+#adminmenu li.current a #awaiting-mod,
+#adminmenu li.current a .update-plugins,
+#adminmenu li.wp-has-current-submenu a .update-plugins,
+#adminmenu li.wp-has-current-submenu a .update-plugins {
+       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;
+}
+
+#adminmenu li.current a:hover #awaiting-mod,
+#adminmenu li.current a:hover .update-plugins,
+#adminmenu li.wp-has-current-submenu a:hover #awaiting-mod,
+#adminmenu li.wp-has-current-submenu a:hover .update-plugins {
+       background-color: #264761;
+       color: #fff;
+}
 
 
-#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
-       background-color: #07273E;
+div#media-upload-header {
+       background-color: #f9f9f9;
+       border-bottom-color: #dfdfdf;
 }
 
 }
 
-#adminmenu, div#media-upload-header {
-       background-color: #14568a;
-       border-bottom-color: #07273e;
+div#plugin-information-header {
+       background-color: #e4f2fd;
+       border-bottom-color: #c6d9e9;
 }
 
 #currenttheme img {
 }
 
 #currenttheme img {
@@ -348,108 +538,136 @@ ul#widget-list li.widget-list-item h4.widget-title {
        background-color: #f9f9f9;
 }
 
        background-color: #f9f9f9;
 }
 
-input.readonly {
+input.readonly, textarea.readonly {
        background-color: #ddd;
 }
 
        background-color: #ddd;
 }
 
-#dashmenu a.current {
-       background-color: #14568a;
-       color: #cfebf6;
-}
-
-#dragHelper h4.widget-title, li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4 {
+#dragHelper h4.widget-title,
+li.widget-list-control-item h4,
+#dragHelper li.widget-list-control-item h4 {
        background-color: #2683ae;
        color: #fff;
 }
 
        background-color: #2683ae;
        color: #fff;
 }
 
-#ed_toolbar input {
-       background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
+#ed_toolbar input,
+#ed_reply_toolbar input {
+       background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
 }
 
 #editable-post-name {
        background-color: #fffbcc;
 }
 
 }
 
 #editable-post-name {
        background-color: #fffbcc;
 }
 
-#edit-slug-box strong, .login #nav a {
+#edit-slug-box strong,
+.tablenav .displaying-num,
+#submitted-on {
        color: #777;
 }
 
        color: #777;
 }
 
-#edit-slug-buttons a.save {
-       background-color: #ebebeb;
+.login #nav a {
+       color: #21759b !important;
+}
+
+.login #nav a:hover {
+       color: #d54e21 !important;
 }
 
 }
 
-#footer {
-       background: url(../images/logo-ghost.png) #464646 no-repeat 20px 10px;
+#footer,
+#footer-upgrade {
+       background: #073447;
        color: #999;
 }
 
 #media-items {
        color: #999;
 }
 
 #media-items {
-       border-color: #c0c0c0;
+       border-color: #dfdfdf;
 }
 
 #pass-strength-result {
 }
 
 #pass-strength-result {
-       background-color: #e3e3e3;
-       border-color: #000;
+       background-color: #eee;
+       border-color: #ddd !important;
 }
 
 #pass-strength-result.bad {
 }
 
 #pass-strength-result.bad {
-       background-color: #ffeff7;
-       border-color: #c69;
+       background-color: #ffb78c;
+       border-color: #ff853c !important;
 }
 
 #pass-strength-result.good {
 }
 
 #pass-strength-result.good {
-       background-color: #effff4;
-       border-color: #66cc87;
+       background-color: #ffec8b;
+       border-color: #fc0 !important;
 }
 
 #pass-strength-result.short {
 }
 
 #pass-strength-result.short {
-       background-color: #e3e3e3;
+       background-color: #ffa0a0;
+       border-color: #f04040 !important;
 }
 
 #pass-strength-result.strong {
 }
 
 #pass-strength-result.strong {
-       background-color: #59ef86;
-       border-color: #319f52;
+       background-color: #c3ff88;
+       border-color: #8dff1c !important;
 }
 
 }
 
-.checkbox, .side-info, #your-profile #rich_editing {
+.checkbox,
+.side-info,
+#your-profile #rich_editing {
        background-color: #fff;
 }
 
        background-color: #fff;
 }
 
-.plugins .active {
-       background-color: #BBEEBB;
+.plugins .active,
+.plugins .active th,
+.plugins .active td {
+       background-color: #e7f7d3;
 }
 
 }
 
-.plugins .togl {
-       border-right-color: #ccc;
+#the-comment-list .unapproved,
+#the-comment-list .unapproved th,
+#the-comment-list .unapproved td {
+       background-color: #ffffe0;
 }
 
 }
 
-#the-comment-list .unapproved {
-       background-color: #ffffe0;
+#the-comment-list .approve a {
+       color: #006505;
+}
+
+#the-comment-list .unapprove a {
+       color: #d98500;
+}
+
+#the-comment-list .delete a {
+       color: #bc0b0b;
 }
 
 .plugins tr {
        background-color: #fff;
 }
 
 }
 
 .plugins tr {
        background-color: #fff;
 }
 
-#poststuff #editor-toolbar .active {
-       background-color: #83b4d5;
-       color: #333;
+.metabox-holder .postbox,
+#poststuff .postbox,
+#titlediv,
+#poststuff .postarea,
+#poststuff .stuffbox,
+.postbox input[type="text"],
+.postbox textarea,
+.stuffbox input[type="text"],
+.stuffbox textarea {
+       border-color: #BBD8E7;
 }
 
 }
 
-#poststuff .closed .togbox {
-       background-color: #2583ad;
-       background-image: url(../images/toggle-arrow.gif);
+.metabox-holder .postbox,
+#poststuff .postbox {
+       background-color: #FFF;
 }
 
 }
 
-#poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox {
-       border-color: #ebebeb;
-       border-right-color: #ccc;
-       border-bottom-color: #ccc;
+.ui-sortable .postbox h3 {
+       color: #093E56;
+}
+
+.ui-sortable .postbox h3:hover {
+       color: #000;
 }
 
 }
 
-#poststuff .togbox {
-       background-color: #b2b2b2;
-       background-image: url(../images/toggle-arrow.gif);
+.curtime #timestamp {
+       background-image: url(../images/date-button.gif);
 }
 
 #quicktags #ed_link {
 }
 
 #quicktags #ed_link {
@@ -464,26 +682,16 @@ input.readonly {
        color: #448abd;
 }
 
        color: #448abd;
 }
 
-#sidemenu a {
-       background-color: #14568a;
-       border-bottom-color: #07273e;
-       border-top-color: #14568a;
-       color: #cfebf6;
-}
-
-#tagchecklist span a {
+#tagchecklist span a,
+#bulk-titles div a {
        background: url(../images/xit.gif) no-repeat;
 }
 
        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;
 }
 
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
-#the-comment-list .comment a {
-       border-bottom-color: #ababab;
-       color: #666;
-}
-
 #update-nag, .plugin-update {
        background-color: #fffeeb;
        border-bottom-color: #ccc;
 #update-nag, .plugin-update {
        background-color: #fffeeb;
        border-bottom-color: #ccc;
@@ -491,159 +699,185 @@ input.readonly {
        color: #555;
 }
 
        color: #555;
 }
 
-#upload-files a.file-link {
-       background-color: #d1e2ef;
+.login #backtoblog a {
+       color: #ccc;
 }
 
 }
 
-#upload-file-view a img {
-       border-bottom-color: #69c;
+#wphead {
+       background-color: #073447;
 }
 
 }
 
-#upload-menu li #current-tab-nav, #upload-file {
-       background-color: #f9fcfe;
+body.login {
+       border-top-color: #093E56;
 }
 
 }
 
-#upload-menu li span a.page-numbers {
-       color: #00019b;
+#wphead h1 a {
+       color: #fff;
 }
 
 }
 
-#upload-menu li.current {
-       border-right-color: #448abd;
-       color: #000;
+#login form input {
+       color: #555;
 }
 
 }
 
-#upload-menu li.current a.upload-tab-link, #upload-menu li a:hover {
-       background-color: #f9fcfe;
-       color: #000;
+#wphead h1 a:hover {
+       text-decoration: underline;
 }
 
 }
 
-#upload-menu, #upload-menu li {
-       border-top-color: #247fab;
+#user_info {
+       color: #999;
 }
 
 }
 
-#user_info, .login #backtoblog a {
+#user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited {
        color: #ccc;
        color: #ccc;
+       text-decoration: none;
 }
 
 }
 
-#wphead {
-       background-color: #14568a;
+#user_info a:hover, #footer a:hover {
+       color: #fff;
+       text-decoration: underline !important;
 }
 
 }
 
-#wphead, body.login {
-       border-top-color: #07273e;
+#user_info a:active, #footer a:active {
+       color: #ccc !important;
 }
 
 }
 
-#wphead #viewsite a {
-       background-color: #5488af;
-       color: #cfebf7;
-       border-color: #0b3d64;
+div#media-upload-error,
+.file-error,
+abbr.required,
+.widget-control-remove:hover,
+.delete a:hover {
+       color: #f00;
 }
 
 }
 
-#wphead #viewsite a:hover {
-       color: #07273e;
+#media-upload a.delete {
+       color: #888;
 }
 
 }
 
-#wphead h1, #dashmenu a.current:hover {
-       color: #cfebf6;
+/* editors */
+#quicktags {
+       border-color: #dfdfdf;
+       background-color: #dfdfdf;
 }
 
 }
 
-div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover, .delete:hover {
-       color: #f00;
+#ed_toolbar input {
+       border-color: #C3C3C3;
+}
+
+#ed_toolbar input:hover {
+       border-color: #aaa;
+       background: #ddd;
+}
+
+#poststuff .wp_themeSkin .mceStatusbar {
+       border-color: #EDEDED;
+}
+
+#poststuff #edButtonPreview,
+#poststuff #edButtonHTML {
+       background-color: #f1f1f1;
+       border-color: #dfdfdf;
+       color: #999;
+}
+
+#poststuff #editor-toolbar .active {
+       border-bottom-color: #e9e9e9;
+       background-color: #e9e9e9;
+       color: #333;
 }
 
 /* TinyMCE */
 }
 
 /* TinyMCE */
+#post-status-info {
+       background-color: #EDEDED;
+}
+
 .wp_themeSkin *,
 .wp_themeSkin *,
-.wp_themeSkin a:hover, 
-.wp_themeSkin a:link, 
-.wp_themeSkin a:visited, 
+.wp_themeSkin a:hover,
+.wp_themeSkin a:link,
+.wp_themeSkin a:visited,
 .wp_themeSkin a:active {
         color: #000;
 }
 
 /* Containers */
 .wp_themeSkin a:active {
         color: #000;
 }
 
 /* Containers */
-.wp_themeSkin table, #wp_editbtns {
-       background: #83B4D5;
-}
-
 .wp_themeSkin iframe {
        background: #fff;
 }
 
 /* Layout */
 .wp_themeSkin .mceStatusbar {
 .wp_themeSkin iframe {
        background: #fff;
 }
 
 /* Layout */
 .wp_themeSkin .mceStatusbar {
-        color:#000;
-        background-color: #eaf3fa;
+       color: #000;
+       background-color: #f5f5f5;
 }
 
 /* Button */
 }
 
 /* Button */
-.wp_themeSkin .mceButton { 
+.wp_themeSkin .mceButton {
        background-color: #e9e8e8;
        background-color: #e9e8e8;
-       border-color: #83B4D5;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin a.mceButtonEnabled:hover,
 }
 
 .wp_themeSkin a.mceButtonEnabled:hover,
-.wp_themeSkin a.mceButtonActive, 
+.wp_themeSkin a.mceButtonActive,
 .wp_themeSkin a.mceButtonSelected {
 .wp_themeSkin a.mceButtonSelected {
-       background-color: #d6d8da;
-       border-color: #7789ba !important;
+       background-color: #d5d5d5;
+       border-color: #777 !important;
 }
 
 .wp_themeSkin .mceButtonDisabled {
 }
 
 .wp_themeSkin .mceButtonDisabled {
-       border-color: #83B4D5 !important;
+       border-color: #ccc !important;
 }
 
 /* ListBox */
 .wp_themeSkin .mceListBox .mceText,
 .wp_themeSkin .mceListBox .mceOpen  {
 }
 
 /* ListBox */
 .wp_themeSkin .mceListBox .mceText,
 .wp_themeSkin .mceListBox .mceOpen  {
-       border-color: #83B4D5;
-       background-color: #e9e8e8;
+       border-color: #B2B2B2;
+       background-color: #d5d5d5;
 }
 
 }
 
-.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, 
+.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
 .wp_themeSkin .mceListBoxHover .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceText {
 .wp_themeSkin .mceListBoxHover .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceText {
-       border-color: #7789ba !important;
-       background-color: #d6d8da;
+       border-color: #777 !important;
+       background-color: #d5d5d5;
 }
 
 }
 
-.wp_themeSkin table.mceListBoxEnabled:hover .mceText, 
+.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
 .wp_themeSkin .mceListBoxHover .mceText {
 .wp_themeSkin .mceListBoxHover .mceText {
-       border-color: #7789ba !important;
+       border-color: #777 !important;
 }
 
 .wp_themeSkin select.mceListBox {
 }
 
 .wp_themeSkin select.mceListBox {
-       border-color: #b3c7e1; 
+       border-color: #B2B2B2;
        background-color: #fff;
 }
 
 /* SplitButton */
        background-color: #fff;
 }
 
 /* SplitButton */
-.wp_themeSkin .mceSplitButton a.mceAction, 
+.wp_themeSkin .mceSplitButton a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceOpen {
 .wp_themeSkin .mceSplitButton a.mceOpen {
-       background-color: #e9e8e8;
-       border-color: #83B4D5;
+       background-color: #e8e8e8;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin .mceSplitButton a.mceOpen:hover,
 .wp_themeSkin .mceSplitButtonSelected a.mceOpen,
 .wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceAction:hover {
 }
 
 .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-color: #d6d8da;
-       border-color: #7789ba !important;
-} 
+       background-color: #d5d5d5;
+       border-color: #777 !important;
+}
 
 .wp_themeSkin .mceSplitButtonActive {
 
 .wp_themeSkin .mceSplitButtonActive {
-       background-color: #d6d8da;
+       background-color: #B2B2B2;
 }
 
 /* ColorSplitButton */
 .wp_themeSkin div.mceColorSplitMenu table {
 }
 
 /* ColorSplitButton */
 .wp_themeSkin div.mceColorSplitMenu table {
-       background-color: #ebeaeb;
-       border-color: #808080;
+       background-color: #ebebeb;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin .mceColorSplitMenu a {
 }
 
 .wp_themeSkin .mceColorSplitMenu a {
-       border-color: #808080;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
@@ -669,18 +903,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 }
 
 .wp_themeSkin .mceMenu .mceText {
 }
 
 .wp_themeSkin .mceMenu .mceText {
-       color: #000; 
+       color: #000;
 }
 
 .wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
 }
 
 .wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
-.wp_themeSkin .mceMenu .mceMenuItemActive, #quicktags {
-       background-color: #83B4D5;
+.wp_themeSkin .mceMenu .mceMenuItemActive {
+       background-color: #f5f5f5;
 }
 .wp_themeSkin td.mceMenuItemSeparator {
        background-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle a {
 }
 .wp_themeSkin td.mceMenuItemSeparator {
        background-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle a {
-       background-color: #ccc; 
+       background-color: #ccc;
        border-bottom-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle span.mceText {
        border-bottom-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle span.mceText {
@@ -690,23 +924,80 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
        color: #888;
 }
 
        color: #888;
 }
 
-/* pop-up */
-.clearlooks2 .mceTop .mceLeft, .clearlooks2 .mceTop .mceRight {
-       background-color: #cee1ef;
-       border-color: #c6d9e9;
+.wp_themeSkin tr.mceFirst td.mceToolbar {
+       background-color: #dfdfdf;
+       border-color: #dfdfdf;
 }
 
 }
 
-.clearlooks2 .mceFocus .mceTop .mceLeft, .clearlooks2 .mceFocus .mceTop .mceRight {
-       background-color: #5488AF;
-       border-color: #464646;
+.wp-admin #mceModalBlocker {
+       background: #000;
 }
 
 }
 
-#editorcontainer {
-       border-color: #ccc;
+.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft {
+       background: #444444;
+       border-left: 1px solid #999;
+       border-top: 1px solid #999;
+       -moz-border-radius: 4px 0 0 0;
+       -webkit-border-top-left-radius: 4px;
+       -khtml-border-top-left-radius: 4px;
+       border-top-left-radius: 4px;
 }
 
 }
 
-#poststuff #titlewrap {
-       border-color: #ccc;
+.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight {
+       background: #444444;
+       border-right: 1px solid #999;
+       border-top: 1px solid #999;
+       border-top-right-radius: 4px;
+       -khtml-border-top-right-radius: 4px;
+       -webkit-border-top-right-radius: 4px;
+       -moz-border-radius: 0 4px 0 0;
+}
+
+.wp-admin .clearlooks2 .mceMiddle .mceLeft {
+       background: #f1f1f1;
+       border-left: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceMiddle .mceRight {
+       background: #f1f1f1;
+       border-right: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom .mceLeft {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+       border-left: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom .mceCenter {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom .mceRight {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+       border-right: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceFocus .mceTop span {
+       color: #e5e5e5;
+}
+/* end TinyMCE */
+
+#editorcontainer,
+#post-status-info,
+#titlediv #title {
+       border-color: #dfdfdf;
+}
+
+#titlediv #title {
+       background-color: #fff;
 }
 
 #tTips p#tTips_inside {
 }
 
 #tTips p#tTips_inside {
@@ -714,8 +1005,223 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
        color: #333;
 }
 
        color: #333;
 }
 
-/* Diff */
+#timestampdiv input,
+#namediv input,
+#tagsdiv #the-tagcloud {
+       border-color: #ddd;
+}
+
+/* menu */
+#adminmenu * {
+       border-color: #BBD8E7;
+}
+
+#adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
+}
+
+.folded #adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
+}
+
+#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;
+}
+
+#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;
+}
+
+#adminmenu a.menu-top {
+       background: #EAF3FA url(../images/menu-bits.gif) repeat-x scroll left -379px;
+}
+
+#adminmenu .wp-submenu a {
+       background: #FFFFFF url(../images/menu-bits.gif) no-repeat scroll 0 -310px;
+}
+
+#adminmenu .wp-has-current-submenu ul li a {
+       background: none;
+}
+
+#adminmenu .wp-has-current-submenu ul li a.current {
+       background: url(../images/menu-dark.gif) top left no-repeat !important;
+}
+
+#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;
+       color: #fff;
+       text-shadow: rgba(0,0,0,0.4) 0px -1px 0px;
+}
+
+#adminmenu li.wp-has-current-submenu .wp-submenu,
+#adminmenu li.wp-has-current-submenu ul li a {
+       border-color: #aaa !important;
+}
+
+#adminmenu li.wp-has-current-submenu ul li a {
+       background: url(../images/menu-dark.gif) bottom left no-repeat !important;
+}
+
+#adminmenu li.wp-has-current-submenu ul {
+       border-bottom-color: #aaa;
+}
+
+#adminmenu li.menu-top .current:hover {
+       border-color: #B5B5B5;
+}
+
+#adminmenu .wp-submenu .current a.current {
+       background: transparent url(../images/menu-bits.gif) no-repeat scroll  0 -289px;
+}
+
+#adminmenu .wp-submenu a:hover {
+       background-color: #EAF2FA !important;
+       color: #333 !important;
+}
+
+#adminmenu .wp-submenu li.current,
+#adminmenu .wp-submenu li.current a,
+#adminmenu .wp-submenu li.current a:hover {
+       color: #333;
+       background-color: #f5f5f5;
+       background-image: none;
+       border-color: #e3e3e3;
+       text-shadow: rgba(255,255,255,1) 0px 1px 0px;
+}
+
+#adminmenu .wp-submenu ul {
+       background-color: #fff;
+}
+
+.folded #adminmenu li.menu-top,
+#adminmenu .wp-submenu .wp-submenu-head {
+       background-color: #EAF2FA;
+}
+
+.folded #adminmenu li.wp-has-current-submenu,
+.folded #adminmenu li.menu-top.current {
+       background-color: #BBD8E7;
+}
+
+#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head {
+       background-color: #BBD8E7;
+       border-color: #8CBDD5;
+}
+
+#adminmenu div.wp-submenu {
+       background-color: transparent;
+}
+
+/* menu icons */
+#adminmenu #menu-dashboard div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -61px -33px;
+}
+
+#adminmenu #menu-dashboard:hover div.wp-menu-image,
+#adminmenu  #menu-dashboard.wp-has-current-submenu div.wp-menu-image,
+#adminmenu  #menu-dashboard.current div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -61px -1px;
+}
+
+#adminmenu #menu-posts div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -272px -33px;
+}
+
+#adminmenu #menu-posts:hover div.wp-menu-image,
+#adminmenu #menu-posts.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -272px -1px;
+}
+
+#adminmenu #menu-media div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -121px -33px;
+}
+
+#adminmenu #menu-media:hover div.wp-menu-image,
+#adminmenu #menu-media.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -121px -1px;
+}
+
+#adminmenu #menu-links div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -91px -33px;
+}
+
+#adminmenu #menu-links:hover div.wp-menu-image,
+#adminmenu #menu-links.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -91px -1px;
+}
+
+#adminmenu #menu-pages div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -151px -33px;
+}
+
+#adminmenu #menu-pages:hover div.wp-menu-image,
+#adminmenu #menu-pages.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -151px -1px;
+}
+
+#adminmenu #menu-comments div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -31px -33px;
+}
+
+#adminmenu #menu-comments:hover div.wp-menu-image,
+#adminmenu #menu-comments.wp-has-current-submenu div.wp-menu-image,
+#adminmenu #menu-comments.current div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -31px -1px;
+}
+
+#adminmenu #menu-appearance div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -1px -33px;
+}
+
+#adminmenu #menu-appearance:hover div.wp-menu-image,
+#adminmenu #menu-appearance.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -1px -1px;
+}
+
+#adminmenu #menu-plugins div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -181px -33px;
+}
+
+#adminmenu #menu-plugins:hover div.wp-menu-image,
+#adminmenu #menu-plugins.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -181px -1px;
+}
+
+#adminmenu #menu-users div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -301px -33px;
+}
+
+#adminmenu #menu-users:hover div.wp-menu-image,
+#adminmenu #menu-users.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -301px -1px;
+}
+
+#adminmenu #menu-tools div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -211px -33px;
+}
+
+#adminmenu #menu-tools:hover div.wp-menu-image,
+#adminmenu #menu-tools.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -211px -1px;
+}
+
+#adminmenu #menu-settings div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -241px -33px;
+}
+
+#adminmenu #menu-settings:hover div.wp-menu-image,
+#adminmenu #menu-settings.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu-vs.png") no-repeat scroll -241px -1px;
+}
+/* end menu */
+
 
 
+/* Diff */
 table.diff .diff-deletedline {
        background-color: #ffdddd;
 }
 table.diff .diff-deletedline {
        background-color: #ffdddd;
 }
@@ -728,3 +1234,344 @@ table.diff .diff-addedline {
 table.diff .diff-addedline ins {
        background-color: #99ff99;
 }
 table.diff .diff-addedline ins {
        background-color: #99ff99;
 }
+
+#att-info {
+       background-color: #E4F2FD;
+}
+
+/* edit image */
+#sidemenu a {
+       background-color: #f9f9f9;
+       border-color: #f9f9f9;
+       border-bottom-color: #dfdfdf;
+}
+
+#sidemenu a.current {
+       background-color: #fff;
+       border-color: #dfdfdf #dfdfdf #fff;
+       color: #D54E21;
+}
+
+
+#screen-options-wrap,
+#contextual-help-wrap {
+       background-color: #f1f1f1;
+       border-color: #dfdfdf;
+}
+
+#screen-meta-links a.show-settings {
+       color: #606060;
+}
+
+#screen-meta-links a.show-settings:hover {
+       color: #000;
+}
+
+#replysubmit {
+       background-color: #f1f1f1;
+       border-top-color: #ddd;
+}
+
+#replyerror {
+       border-color: #ddd;
+       background-color: #f9f9f9;
+}
+
+#edithead,
+#replyhead {
+       background-color: #f1f1f1;
+}
+
+#ed_reply_toolbar {
+       background-color: #e9e9e9;
+}
+
+/* table vim shortcuts */
+.vim-current {
+       background-color: #E4F2FD !important;
+}
+
+/* Install Plugins */
+.star-average,
+.star.star-rating {
+       background-color: #fc0;
+}
+
+div.star.select:hover {
+       background-color: #d00;
+}
+
+#plugin-information .fyi ul {
+       background-color: #eaf3fa;
+}
+
+#plugin-information .fyi h2.mainheader {
+       background-color: #cee1ef;
+}
+
+#plugin-information pre,
+#plugin-information code {
+       background-color: #ededff;
+}
+
+#plugin-information pre {
+       border: 1px solid #ccc;
+}
+
+/* inline editor */
+.inline-edit-row fieldset input[type="text"],
+.inline-edit-row fieldset textarea,
+#bulk-titles,
+#replyrow input {
+       border-color: #ddd;
+}
+
+.inline-editor div.title {
+       background-color: #EAF3FA;
+}
+
+.inline-editor ul.cat-checklist {
+       background-color: #FFFFFF;
+       border-color: #ddd;
+}
+
+.inline-edit-row p.submit {
+       background-color: #f1f1f1;
+}
+
+.inline-editor .categories .catshow,
+.inline-editor .categories .cathide {
+       color: #21759b;
+}
+
+.inline-editor .quick-edit-save {
+       background-color: #f1f1f1;
+}
+
+#replyrow #ed_reply_toolbar input:hover {
+       border-color: #aaa;
+       background: #ddd;
+}
+
+fieldset.inline-edit-col-right .inline-edit-col {
+       border-color: #dfdfdf;
+}
+
+.attention {
+       color: #D54E21;
+}
+
+.meta-box-sortables .postbox:hover .handlediv {
+       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -111px;
+}
+
+#major-publishing-actions {
+       background: #eaf2fa;
+}
+
+.tablenav .tablenav-pages {
+       color: #555;
+}
+
+.tablenav .tablenav-pages a {
+       border-color: #e3e3e3;
+       background: #eee url('../images/menu-bits.gif') repeat-x scroll left -379px;
+}
+
+.tablenav .tablenav-pages a:hover {
+       color: #d54e21;
+       border-color: #d54321;
+}
+
+.tablenav .tablenav-pages a:active {
+       color: #fff !important;
+}
+
+.tablenav .tablenav-pages .current {
+       background: #dfdfdf;
+       border-color: #d3d3d3;
+}
+
+#availablethemes,
+#availablethemes td {
+       border-color: #ddd;
+}
+
+#current-theme img {
+       border-color: #999;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link,
+#TB_window #TB_title a.tb-theme-preview-link:visited {
+       color: #999;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link:hover,
+#TB_window #TB_title a.tb-theme-preview-link:focus {
+       color: #ccc;
+}
+
+.misc-pub-section {
+       border-bottom-color: #eee;
+}
+
+#minor-publishing {
+       border-bottom-color: #ddd;
+}
+
+#post-body .misc-pub-section {
+       border-right-color: #eee;
+}
+
+.post-com-count span {
+       background-color: #bbb;
+}
+
+.form-table .color-palette td {
+       border-color: #fff;
+}
+
+.sortable-placeholder {
+       border-color: #bbb;
+       background-color: #f5f5f5;
+}
+
+#post-body ul#category-tabs li.ui-tabs-selected a {
+       color: #333;
+}
+
+#wp_editimgbtn,
+#wp_delimgbtn,
+#wp_editgallery,
+#wp_delgallery {
+       border-color: #999;
+       background-color: #eee;
+}
+
+#wp_editimgbtn:hover,
+#wp_delimgbtn:hover,
+#wp_editgallery:hover,
+#wp_delgallery:hover {
+       border-color: #555;
+       background-color: #ccc;
+}
+
+#favorite-first {
+       background: #797979 url(../images/fav.png) repeat-x 0 center;
+       border-color: #777 !important;
+       border-bottom-color: #666 !important;
+}
+
+#favorite-inside {
+       border-color: #797979;
+       background-color: #797979;
+}
+
+#favorite-toggle {
+       background: transparent url(../images/fav-arrow.gif) no-repeat 0 -4px;
+}
+
+#favorite-actions a {
+       color: #ddd;
+}
+
+#favorite-actions a:hover {
+       color: #fff;
+}
+
+#favorite-inside a:hover {
+       text-decoration: underline;
+}
+
+#favorite-actions .slide-down {
+       border-bottom-color: #626262;
+}
+
+.submit input,
+.button,
+.button-primary,
+.button-secondary,
+.button-highlighted,
+#postcustomstuff .submit input {
+       text-shadow: rgba(255,255,255,1) 0 1px 0;
+}
+
+.button-primary,
+.submit .button-primary {
+       text-shadow: rgba(0,0,0,0.3) 0 -1px 0;
+}
+
+#screen-meta a.show-settings {
+       background-color: transparent;
+       text-shadow: rgba(255,255,255,0.7) 0 1px 0;
+}
+
+#icon-edit,
+#icon-post {
+       background: transparent url(../images/icons32-vs.png) no-repeat -552px -5px;
+}
+
+#icon-index {
+       background: transparent url(../images/icons32-vs.png) no-repeat -137px -5px;
+}
+
+#icon-upload {
+       background: transparent url(../images/icons32-vs.png) no-repeat -251px -5px;
+}
+
+#icon-link-manager,
+#icon-link,
+#icon-link-category {
+       background: transparent url(../images/icons32-vs.png) no-repeat -190px -5px;
+}
+
+#icon-edit-pages,
+#icon-page {
+       background: transparent url(../images/icons32-vs.png) no-repeat -312px -5px;
+}
+
+#icon-edit-comments {
+       background: transparent url(../images/icons32-vs.png) no-repeat -72px -5px;
+}
+
+#icon-themes {
+       background: transparent url(../images/icons32-vs.png) no-repeat -11px -5px;
+}
+
+#icon-plugins {
+       background: transparent url(../images/icons32-vs.png) no-repeat -370px -5px;
+}
+
+#icon-users,
+#icon-user-edit {
+       background: transparent url(../images/icons32-vs.png) no-repeat -600px -5px;
+}
+
+#icon-tools,
+#icon-admin {
+       background: transparent url(../images/icons32-vs.png) no-repeat -432px -5px;
+}
+
+#icon-options-general {
+       background: transparent url(../images/icons32-vs.png) no-repeat -492px -5px;
+}
+
+.view-switch #view-switch-list {
+       background: transparent url(../images/list-vs.png) no-repeat 0 0;
+}
+
+.view-switch #view-switch-list.current {
+       background: transparent url(../images/list-vs.png) no-repeat -40px 0;
+}
+
+.view-switch #view-switch-excerpt {
+       background: transparent url(../images/list-vs.png) no-repeat -20px 0;
+}
+
+.view-switch #view-switch-excerpt.current {
+       background: transparent url(../images/list-vs.png) no-repeat -60px 0;
+}
+
+#header-logo {
+       background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
+}
index d7b7afbb705b2ad68ad4dca329a16a7415315b50..b6d88bb24d1523a2dae30a79c891d4948e19065b 100644 (file)
@@ -2,23 +2,82 @@
        border-right-color: transparent;
        border-left-color: #99d;
 }
        border-right-color: transparent;
        border-left-color: #99d;
 }
-.post-com-count {
-}
-#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
-       background-image: url(../images/comment-stalk-rtl.gif);
-       background-position:right bottom;
-}
-#footer {
-       background-position:99% 10px;
-}
+
 .plugins .togl {
        border-right-color: transparent;
        border-left-color: #ccc;
 }
 .plugins .togl {
        border-right-color: transparent;
        border-left-color: #ccc;
 }
-#poststuff .closed .togbox, #poststuff .togbox {
-       background-image: url(../images/toggle-arrow-rtl.gif);
+
+.post-com-count {
+       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;
 }
 #upload-menu li.current {
 }
 #upload-menu li.current {
-       border-right-color:transparent;
+       border-right-color: transparent;
        border-left-color: #448abd;
 }
        border-left-color: #448abd;
 }
+
+#adminmenu .wp-submenu .current a.current {
+       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
+}
+
+#adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
+}
+
+.folded #adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
+}
+
+#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;
+}
+
+#adminmenu .wp-has-current-submenu ul li a.current {
+       background: url(../images/menu-dark-rtl.gif) top right no-repeat !important;
+}
+
+#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;
+}
+
+#adminmenu li.wp-has-current-submenu ul li a {
+       background: url(../images/menu-dark-rtl.gif) bottom right no-repeat !important;
+}
+
+#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;
+}
+
+#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;
+}
+
+#adminmenu a.wp-has-submenu {
+       background: #f1f1f1 url(../images/menu-bits-rtl.gif) repeat-x scroll right -379px;
+}
+
+#adminmenu .wp-submenu a {
+       background: #FFFFFF url(../images/menu-bits-rtl.gif) no-repeat scroll right -310px;
+}
+
+#adminmenu li.current a,
+#adminmenu .wp-submenu a:hover {
+       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll  right -289px;
+}
+
+#adminmenu li.wp-has-current-submenu a.wp-has-submenu {
+       background: #b5b5b5 url(../images/menu-bits-rtl.gif) repeat-x scroll right top;
+}
+
+.meta-box-sortables .postbox:hover .handlediv {
+       background: transparent url(../images/menu-bits-rtl.gif) no-repeat scroll right -111px;
+}
+#favorite-toggle {
+       background: transparent url(../images/fav-arrow-rtl.gif) no-repeat right -4px;
+}
index 09e0c58226b7683020c54bc187f7ab16bc64cde2..2a42c71248da44ec62604f738a7fff9e435f90f2 100644 (file)
@@ -1,9 +1,27 @@
+html {
+       background-color: #f9f9f9;
+}
+
+.find-box-search {
+       border-color: #dfdfdf;
+       background-color: #f1f1f1;
+}
+
+.find-box {
+       background-color: #f1f1f1;
+}
+
+.find-box-inside {
+       background-color: #fff;
+}
+
 a.page-numbers:hover {
        border-color: #999;
 }
 
 a.page-numbers:hover {
        border-color: #999;
 }
 
-body, .form-table .pre {
-       background-color: #fff;
+body,
+#wpbody,
+.form-table .pre {
        color: #333;
 }
 
        color: #333;
 }
 
@@ -11,10 +29,52 @@ body > #upload-menu {
        border-bottom-color: #fff;
 }
 
        border-bottom-color: #fff;
 }
 
-div#current-widgets, #postcustomstuff table, #your-profile fieldset, a.page-numbers, #rightnow, div.dashboard-widget, .widefat {
+kbd, code {
+       background: #eaeaea;
+}
+
+div#current-widgets,
+#postcustomstuff table,
+#your-profile fieldset,
+#rightnow,
+div.dashboard-widget,
+#dashboard-widgets p.dashboard-widget-links,
+#replyrow #ed_reply_toolbar input {
        border-color: #ccc;
 }
 
        border-color: #ccc;
 }
 
+#poststuff .inside label.spam {
+       color: red;
+}
+
+#poststuff .inside label.waiting {
+       color: orange;
+}
+
+#poststuff .inside label.approved {
+       color: green;
+}
+
+#postcustomstuff table {
+       border-color: #dfdfdf;
+       background-color: #F9F9F9;
+}
+
+#postcustomstuff thead th {
+       background-color: #F1F1F1;
+}
+
+#postcustomstuff table input,
+#postcustomstuff table textarea {
+       border-color: #dfdfdf;
+       background-color: #fff;
+}
+
+.widefat {
+       border-color: #dfdfdf;
+       background-color: #fff;
+}
+
 div.dashboard-widget-error {
        background-color: #c43;
 }
 div.dashboard-widget-error {
        background-color: #c43;
 }
@@ -23,26 +83,55 @@ 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,
+ul.widget-control-list div.widget-control-actions {
        border-top-color: #ccc;
 }
 
 div.ui-tabs-panel {
        border-top-color: #ccc;
 }
 
 div.ui-tabs-panel {
-       border-color: #cee1ef;
+       border-color: #f1f1f1;
 }
 
 }
 
-input.disabled, textarea.disabled {
-       background-color: #ccc;
+ul#category-tabs li.ui-tabs-selected {
+       background-color: #f1f1f1;
 }
 
 }
 
-#user_info a:hover, li.widget-list-control-item h4.widget-title a:hover, .submit a, #dashmenu a:hover, #footer a, #upload-menu li a.upload-tab-link, li.widget-list-control-item h4.widget-title a,
+input.disabled,
+textarea.disabled {
+       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,
-#draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover {
+#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,
+#plugin-information .action-button a:visited {
        color: #fff;
 }
 
        color: #fff;
 }
 
-li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
-       background-color: #eaf3fa;
+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/gray-grad.png") repeat-x left top;
+       text-shadow: #fff 0 1px 0;
+}
+
+.form-table th,
+.form-wrap label {
+       color: #222;
+       text-shadow: #fff 0 1px 0;
+}
+
+.setting-description, .form-wrap p {
+       color: #666;
 }
 
 select {
 }
 
 select {
@@ -51,11 +140,7 @@ select {
 }
 
 strong .post-com-count span {
 }
 
 strong .post-com-count span {
-       background-color: #2583ad;
-}
-
-ul#category-tabs li.ui-tabs-selected, .button-secondary, #quicktags, #login form .submit input {
-       background-color: #cee1ef !important;
+       background-color: #21759b;
 }
 
 ul#widget-list li.widget-list-item h4.widget-title {
 }
 
 ul#widget-list li.widget-list-item h4.widget-title {
@@ -67,10 +152,14 @@ ul#widget-list li.widget-list-item h4.widget-title {
        background-color: #ccf3fa;
 }
 
        background-color: #ccf3fa;
 }
 
-.ac_match, .subsubsub a.current, h2 {
+.ac_match, .subsubsub a.current {
        color: #000;
 }
 
        color: #000;
 }
 
+.wrap h2 {
+       color: #464646;
+}
+
 .ac_over {
        background-color: #f0f0b8;
 }
 .ac_over {
        background-color: #f0f0b8;
 }
@@ -84,13 +173,13 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #101010;
 }
 
        color: #101010;
 }
 
-.alternate {
+.alternate, .alt {
        background-color: #f9f9f9;
 }
 
 .available-theme a.screenshot {
        background-color: #f1f1f1;
        background-color: #f9f9f9;
 }
 
 .available-theme a.screenshot {
        background-color: #f1f1f1;
-       border-color: #ccc;
+       border-color: #ddd;
 }
 
 .bar {
 }
 
 .bar {
@@ -98,8 +187,11 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-right-color: #99d;
 }
 
        border-right-color: #99d;
 }
 
-.describe {
-       border-top-color: #d0d0d0;
+#media-upload {
+       background: #fff;
+}
+#media-upload .slidetoggle {
+       border-top-color: #dfdfdf;
 }
 
 .error, #login #login_error {
 }
 
 .error, #login #login_error {
@@ -119,12 +211,13 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-color: #c00 !important;
 }
 
        border-color: #c00 !important;
 }
 
-.form-table input, .form-table textarea {
-       border-color: #c6d9e9;
-}
-
-.form-table td, .form-table th {
-       border-bottom-color: #fff;
+.form-table input,
+.form-table textarea,
+.search-input,
+.form-field input,
+.form-field textarea,
+.submit {
+       border-color: #DFDFDF;
 }
 
 .highlight {
 }
 
 .highlight {
@@ -132,27 +225,31 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
-#user_info, .howto, .nonessential, #dashmenu a, #sidemenu, #edit-slug-box, .form-input-tip, #dashboard_primary span.rss-date, .subsubsub, #dashboard_secondary div.dashboard-widget-content ul li a cite {
-       color: #999;
+.howto,
+.nonessential,
+#edit-slug-box,
+.form-input-tip,
+.rss-widget span.rss-date,
+.subsubsub {
+       color: #666;
 }
 
 .media-item {
 }
 
 .media-item {
-       border-bottom-color: #d0d0d0;
+       border-bottom-color: #dfdfdf;
 }
 
 }
 
-.media-upload-form label.form-help, td.help {
-       color: #9a9a9a;
+#wpbody-content #media-items .describe {
+       border-top-color: #dfdfdf;
 }
 
 }
 
-.page-numbers {
-       background-color: #fff;
-       border-color: #fff;
+.describe input[type="text"],
+.describe textarea {
+       border-color: #dfdfdf;
 }
 
 }
 
-.page-numbers.current {
-       background-color: #328ab2;
-       border-color: #328ab2;
-       color: #fff;
+.media-upload-form label.form-help,
+td.help {
+       color: #9a9a9a;
 }
 
 .post-com-count {
 }
 
 .post-com-count {
@@ -182,37 +279,100 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #666;
 }
 
        color: #666;
 }
 
-.submit input, .button, .button-secondary, #login form .submit input, div.dashboard-widget-submit input, #edit-slug-buttons a.save {
-       background-color: #e5e5e5;
-       color: #246;
-       border-color: #80b5d0;
+.button,
+.button-secondary,
+.submit input,
+input[type=button],
+input[type=submit] {
+       border-color: #bbb;
+       color: #464646;
+}
+
+.button:hover,
+.button-secondary:hover,
+.submit input:hover,
+input[type=button]:hover,
+input[type=submit]:hover {
+       color: #000;
+       border-color: #666;
+}
+
+.button,
+.submit input,
+.button-secondary {
+       background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
+}
+
+.button:active,
+.submit input:active,
+.button-secondary:active {
+       background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
+}
+
+.button-primary,
+.submit .button-primary,
+#login form .submit input {
+       border-color: #298cba !important;
+       font-weight: bold;
+       color: #FFF !important;
+       background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
+}
+
+.button-primary:active,
+#login form .submit input:active {
+       background: #21759b url(../images/button-grad-active.png) repeat-x scroll left top !important;
 }
 
 }
 
-.button[disabled], .button:disabled {
-       background-color: #999;
+.button[disabled],
+.button:disabled,
+.button-secondary[disabled],
+.button-secondary:disabled,
+a.button.disabled {
+       color: #ccc !important;
+       border-color: #ccc;
 }
 
 }
 
-.submit input:hover, .button:hover, #edit-slug-buttons a.save:hover {
-       border-color: #535353;
+.button-primary[disabled],
+.button-primary:disabled {
+       color: #2fa0d5 !important;
 }
 
 }
 
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover, #media-upload a.del-link:hover, .ui-tabs-nav a:hover {
+a:active,
+a:focus {
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
-.button-secondary:hover, #login form .submit input:hover {
-       border-color: #328ab2;
+a:hover,
+#wphead #viewsite a:hover,
+#adminmenu 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,
+div.dashboard-widget-submit input:hover,
+#media-upload a.del-link:hover,
+.ui-tabs-nav a:hover {
+       color: #d54e21;
 }
 
 }
 
-.submitbox #autosave .error, ul.view-switch li.current a {
-       color: #333;
+#the-comment-list .comment-item,
+#dashboard-widgets #dashboard_quick_press form p.submit {
+       border-color: #dfdfdf;
 }
 
 }
 
-.submitbox #previewview {
-       background-color: #2683ae;
+.button-primary:hover,
+#login form .submit input:hover {
+       border-color: #13455b !important;
+       color: #EAF2FA !important;
+}
+
+#side-info-column #category-tabs .ui-tabs-selected a {
+       color: #333;
 }
 
 }
 
-.submitbox #previewview a, #rightnow .rbutton {
+#rightnow .rbutton {
        background-color: #ebebeb;
        color: #264761;
 }
        background-color: #ebebeb;
        color: #264761;
 }
@@ -222,8 +382,9 @@ ul#widget-list li.widget-list-item h4.widget-title {
        color: #ccc;
 }
 
        color: #ccc;
 }
 
-.submitbox .submitdelete {
-       border-bottom-color: #999;
+.submitbox .submitdelete, a.delete {
+       color: #f00;
+       border-bottom-color: #f00;
 }
 
 .submitbox .submitdelete:hover,
 }
 
 .submitbox .submitdelete:hover,
@@ -233,78 +394,134 @@ ul#widget-list li.widget-list-item h4.widget-title {
        border-bottom-color: #f00;
 }
 
        border-bottom-color: #f00;
 }
 
+#normal-sortables .submitbox .submitdelete:hover {
+       color: #000;
+       background-color: #f00;
+       border-bottom-color: #f00;
+}
+
 .tablenav .dots {
 .tablenav .dots {
-       background-color: #e4f2fd;
-       border-color: #e4f2fd;
+       border-color: transparent;
 }
 
 }
 
-.tablenav .next, .tablenav .prev{
-       background-color: #e4f2fd;
-       border-bottom-color: #2583ad;
-       border-color: #e4f2fd;
-       color: #2583ad;
+.tablenav .next,
+.tablenav .prev {
+       border-color: transparent;
+       color: #21759b;
 }
 
 }
 
-.tablenav .next:hover, .tablenav .prev:hover {
-       border-bottom-color: #d54e21;
-       border-color: #e4f2fd;
+.tablenav .next:hover,
+.tablenav .prev:hover {
+       border-color: transparent;
        color: #d54e21;
 }
 
        color: #d54e21;
 }
 
-.updated, .login #login_error, .login .message {
+.updated,
+.login #login_error,
+.login .message {
        background-color: #ffffe0;
        border-color: #e6db55;
 }
 
        background-color: #ffffe0;
        border-color: #e6db55;
 }
 
-.updated a {
-       border-bottom-color: #2583ad;
+a.page-numbers {
+       border-bottom-color: #B8D3E2;
 }
 
 }
 
-.widefat td, .widefat th, div#available-widgets-filter, ul#widget-list li.widget-list-item, .commentlist li {
+div#available-widgets-filter,
+ul#widget-list li.widget-list-item,
+.commentlist li {
        border-bottom-color: #ccc;
 }
 
        border-bottom-color: #ccc;
 }
 
-.widefat thead, .thead {
-       background-color: #464646;
-       color: #d7d7d7;
+.widefat td,
+.widefat th {
+       border-color: #dfdfdf;
 }
 
 }
 
-.widget-control-save, .widget-control-remove {
-       background-color: #cee1ef;
-       color: #246;
+.widefat th {
+       text-shadow: rgba(255,255,255,0.8) 0 1px 0;
 }
 
 }
 
-.wrap h2 {
-       border-bottom-color: #dadada;
-       color: #666;
+.widefat thead tr th,
+.widefat tfoot tr th,
+h3.dashboard-widget-title,
+h3.dashboard-widget-title span,
+h3.dashboard-widget-title small,
+.find-box-head {
+       color: #333;
+       background: #dfdfdf url(../images/gray-grad.png) repeat-x scroll left top;
 }
 
 }
 
-#adminmenu a, #submenu 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: #2583ad;
+h3.dashboard-widget-title small a {
+       color: #d7d7d7;
+}
+
+h3.dashboard-widget-title small a:hover {
+       color: #fff;
+}
+
+#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: #21759b;
 }
 
 /* Because we don't want visited on these links */
 }
 
 /* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
+body.press-this .ui-tabs-selected a,
+body.press-this .ui-tabs-selected a:hover {
        background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
        color: #d54e21;
 }
 
        background-color: #fff;
        border-color: #c6d9e9;
        border-bottom-color: #fff;
        color: #d54e21;
 }
 
-#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
-       background-image: url(../images/comment-stalk-fresh.gif);
+#adminmenu #awaiting-mod,
+#adminmenu .update-plugins,
+#sidemenu a .update-plugins,
+#rightnow .reallynow,
+#plugin-information .action-button {
+       background-color: #d54e21;
+       color: #fff;
 }
 
 }
 
-#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow {
-       background-color: #d54e21;
+#adminmenu li a:hover #awaiting-mod,
+#adminmenu li a:hover .update-plugins,
+#sidemenu li a:hover .update-plugins {
+       background-color: #264761;
        color: #fff;
 }
 
        color: #fff;
 }
 
-#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
+#adminmenu li.current a #awaiting-mod,
+#adminmenu li.current a .update-plugins,
+#adminmenu li.wp-has-current-submenu a .update-plugins,
+#adminmenu li.wp-has-current-submenu a .update-plugins {
+       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;
+}
+
+#adminmenu li.current a:hover #awaiting-mod,
+#adminmenu li.current a:hover .update-plugins,
+#adminmenu li.wp-has-current-submenu a:hover #awaiting-mod,
+#adminmenu li.wp-has-current-submenu a:hover .update-plugins {
        background-color: #264761;
        background-color: #264761;
+       color: #fff;
 }
 
 }
 
-#adminmenu, div#media-upload-header {
+div#media-upload-header {
+       background-color: #f9f9f9;
+       border-bottom-color: #dfdfdf;
+}
+
+div#plugin-information-header {
        background-color: #e4f2fd;
        border-bottom-color: #c6d9e9;
 }
        background-color: #e4f2fd;
        border-bottom-color: #c6d9e9;
 }
@@ -321,104 +538,136 @@ ul#widget-list li.widget-list-item h4.widget-title {
        background-color: #f9f9f9;
 }
 
        background-color: #f9f9f9;
 }
 
-input.readonly {
+input.readonly, textarea.readonly {
        background-color: #ddd;
 }
 
        background-color: #ddd;
 }
 
-#dashmenu a.current {
-       background-color: #e4f2fd;
-       color: #555;
-}
-
-#dragHelper h4.widget-title, li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4 {
+#dragHelper h4.widget-title,
+li.widget-list-control-item h4,
+#dragHelper li.widget-list-control-item h4 {
        background-color: #2683ae;
        color: #fff;
 }
 
        background-color: #2683ae;
        color: #fff;
 }
 
-#ed_toolbar input {
-       background: url( ../images/fade-butt.png ) #fff repeat-x 0 -2px;
+#ed_toolbar input,
+#ed_reply_toolbar input {
+       background: #fff url("../images/fade-butt.png") repeat-x 0 -2px;
 }
 
 #editable-post-name {
        background-color: #fffbcc;
 }
 
 }
 
 #editable-post-name {
        background-color: #fffbcc;
 }
 
-#edit-slug-box strong, .login #nav a {
+#edit-slug-box strong,
+.tablenav .displaying-num,
+#submitted-on {
        color: #777;
 }
 
        color: #777;
 }
 
-#footer {
-       background: url(../images/logo-ghost.png) #464646 no-repeat 20px 10px;
+.login #nav a {
+       color: #21759b !important;
+}
+
+.login #nav a:hover {
+       color: #d54e21 !important;
+}
+
+#footer,
+#footer-upgrade {
+       background: #464646;
        color: #999;
 }
 
 #media-items {
        color: #999;
 }
 
 #media-items {
-       border-color: #c0c0c0;
+       border-color: #dfdfdf;
 }
 
 #pass-strength-result {
 }
 
 #pass-strength-result {
-       background-color: #e3e3e3;
-       border-color: #000;
+       background-color: #eee;
+       border-color: #ddd !important;
 }
 
 #pass-strength-result.bad {
 }
 
 #pass-strength-result.bad {
-       background-color: #ffeff7;
-       border-color: #c69;
+       background-color: #ffb78c;
+       border-color: #ff853c !important;
 }
 
 #pass-strength-result.good {
 }
 
 #pass-strength-result.good {
-       background-color: #effff4;
-       border-color: #66cc87;
+       background-color: #ffec8b;
+       border-color: #fc0 !important;
 }
 
 #pass-strength-result.short {
 }
 
 #pass-strength-result.short {
-       background-color: #e3e3e3;
+       background-color: #ffa0a0;
+       border-color: #f04040 !important;
 }
 
 #pass-strength-result.strong {
 }
 
 #pass-strength-result.strong {
-       background-color: #59ef86;
-       border-color: #319f52;
+       background-color: #c3ff88;
+       border-color: #8dff1c !important;
 }
 
 }
 
-.checkbox, .side-info, #your-profile #rich_editing {
+.checkbox,
+.side-info,
+#your-profile #rich_editing {
        background-color: #fff;
 }
 
        background-color: #fff;
 }
 
-.plugins .active {
+.plugins .active,
+.plugins .active th,
+.plugins .active td {
        background-color: #e7f7d3;
 }
 
        background-color: #e7f7d3;
 }
 
-.plugins .togl {
-       border-right-color: #ccc;
+#the-comment-list .unapproved,
+#the-comment-list .unapproved th,
+#the-comment-list .unapproved td {
+       background-color: #ffffe0;
 }
 
 }
 
-#the-comment-list .unapproved {
-       background-color: #ffffe0;
+#the-comment-list .approve a {
+       color: #006505;
+}
+
+#the-comment-list .unapprove a {
+       color: #d98500;
+}
+
+#the-comment-list .delete a {
+       color: #bc0b0b;
 }
 
 .plugins tr {
        background-color: #fff;
 }
 
 }
 
 .plugins tr {
        background-color: #fff;
 }
 
-#poststuff #editor-toolbar .active {
-       background-color: #cee1ef;
-       color: #333;
+.metabox-holder .postbox,
+#poststuff .postbox,
+#titlediv,
+#poststuff .postarea,
+#poststuff .stuffbox,
+.postbox input[type="text"],
+.postbox textarea,
+.stuffbox input[type="text"],
+.stuffbox textarea {
+       border-color: #dfdfdf;
 }
 
 }
 
-#poststuff .closed .togbox {
-       background-color: #2583ad;
-       background-image: url(../images/toggle-arrow.gif);
+.metabox-holder .postbox,
+#poststuff .postbox {
+       background-color: #FFF;
 }
 
 }
 
-#poststuff .postbox, #titlediv, #poststuff .postarea, #poststuff .stuffbox {
-       border-color: #ebebeb;
-       border-right-color: #ccc;
-       border-bottom-color: #ccc;
+.ui-sortable .postbox h3 {
+       color: #464646;
 }
 
 }
 
-#poststuff .togbox {
-       background-color: #b2b2b2;
-       background-image: url(../images/toggle-arrow.gif);
+.ui-sortable .postbox h3:hover {
+       color: #000;
+}
+
+.curtime #timestamp {
+       background-image: url(../images/date-button.gif);
 }
 
 #quicktags #ed_link {
 }
 
 #quicktags #ed_link {
@@ -433,25 +682,16 @@ input.readonly {
        color: #448abd;
 }
 
        color: #448abd;
 }
 
-#sidemenu a {
-       background-color: #e4f2fd;
-       border-bottom-color: #c6d9e9;
-       border-top-color: #e4f2fd;
-}
-
-#tagchecklist span a {
+#tagchecklist span a,
+#bulk-titles div a {
        background: url(../images/xit.gif) no-repeat;
 }
 
        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;
 }
 
        background: url(../images/xit.gif) no-repeat -10px 0;
 }
 
-#the-comment-list .comment a {
-       border-bottom-color: #ababab;
-       color: #666;
-}
-
 #update-nag, .plugin-update {
        background-color: #fffeeb;
        border-bottom-color: #ccc;
 #update-nag, .plugin-update {
        background-color: #fffeeb;
        border-bottom-color: #ccc;
@@ -459,163 +699,185 @@ input.readonly {
        color: #555;
 }
 
        color: #555;
 }
 
-#upload-files a.file-link {
-       background-color: #d1e2ef;
+.login #backtoblog a {
+       color: #ccc;
 }
 
 }
 
-#upload-file-view a img {
-       border-bottom-color: #69c;
+#wphead {
+       background-color: #464646;
 }
 
 }
 
-#upload-menu li #current-tab-nav, #upload-file {
-       background-color: #f9fcfe;
+body.login {
+       border-top-color: #464646;
 }
 
 }
 
-#upload-menu li span a.page-numbers {
-       color: #00019b;
+#wphead h1 a {
+       color: #fff;
 }
 
 }
 
-#upload-menu li.current {
-       border-right-color: #448abd;
-       color: #000;
+#login form input {
+       color: #555;
 }
 
 }
 
-#upload-menu li.current a.upload-tab-link, #upload-menu li a:hover {
-       background-color: #f9fcfe;
-       color: #000;
+#wphead h1 a:hover {
+       text-decoration: underline;
 }
 
 }
 
-#upload-menu, #upload-menu li {
-       border-top-color: #247fab;
+#user_info {
+       color: #999;
 }
 
 }
 
-.login #backtoblog a, .curtime, #user_info a {
+#user_info a:link, #user_info a:visited, #footer a:link, #footer a:visited {
        color: #ccc;
        color: #ccc;
+       text-decoration: none;
 }
 
 }
 
-#wphead {
-       background-color: #e4f2fd;
+#user_info a:hover, #footer a:hover {
+       color: #fff;
+       text-decoration: underline !important;
 }
 
 }
 
-#wphead, body.login {
-       border-top-color: #464646;
+#user_info a:active, #footer a:active {
+       color: #ccc !important;
 }
 
 }
 
-#wphead #viewsite a {
-       background-color: #c6d9e9;
-       color: #246;
-       border-color: #80b5d0;
+div#media-upload-error,
+.file-error,
+abbr.required,
+.widget-control-remove:hover,
+.delete a:hover {
+       color: #f00;
 }
 
 }
 
-#wphead #viewsite a:hover {
-       border-color: #328ab2;
+#media-upload a.delete {
+       color: #888;
 }
 
 }
 
-#wphead h1, #dashmenu a.current:hover, #login form input {
-       color: #555;
+/* editors */
+#quicktags {
+       border-color: #dfdfdf;
+       background-color: #dfdfdf;
 }
 
 }
 
-div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover, .delete:hover {
-       color: #f00;
+#ed_toolbar input {
+       border-color: #C3C3C3;
 }
 
 }
 
-#media-upload a.delete {
-       color: #888;
+#ed_toolbar input:hover {
+       border-color: #aaa;
+       background: #ddd;
+}
+
+#poststuff .wp_themeSkin .mceStatusbar {
+       border-color: #EDEDED;
+}
+
+#poststuff #edButtonPreview,
+#poststuff #edButtonHTML {
+       background-color: #f1f1f1;
+       border-color: #dfdfdf;
+       color: #999;
+}
+
+#poststuff #editor-toolbar .active {
+       border-bottom-color: #e9e9e9;
+       background-color: #e9e9e9;
+       color: #333;
 }
 
 /* TinyMCE */
 }
 
 /* TinyMCE */
+#post-status-info {
+       background-color: #EDEDED;
+}
+
 .wp_themeSkin *,
 .wp_themeSkin *,
-.wp_themeSkin a:hover, 
-.wp_themeSkin a:link, 
-.wp_themeSkin a:visited, 
+.wp_themeSkin a:hover,
+.wp_themeSkin a:link,
+.wp_themeSkin a:visited,
 .wp_themeSkin a:active {
         color: #000;
 }
 
 /* Containers */
 .wp_themeSkin a:active {
         color: #000;
 }
 
 /* Containers */
-.wp_themeSkin table, #wp_editbtns {
-       background: #cee1ef;
-}
-
 .wp_themeSkin iframe {
        background: #fff;
 }
 
 /* Layout */
 .wp_themeSkin .mceStatusbar {
 .wp_themeSkin iframe {
        background: #fff;
 }
 
 /* Layout */
 .wp_themeSkin .mceStatusbar {
-        color:#000;
-        background-color: #eaf3fa;
+       color: #000;
+       background-color: #f5f5f5;
 }
 
 /* Button */
 }
 
 /* Button */
-.wp_themeSkin .mceButton { 
+.wp_themeSkin .mceButton {
        background-color: #e9e8e8;
        background-color: #e9e8e8;
-       border-color: #abc0fb;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin a.mceButtonEnabled:hover,
 }
 
 .wp_themeSkin a.mceButtonEnabled:hover,
-.wp_themeSkin a.mceButtonActive, 
+.wp_themeSkin a.mceButtonActive,
 .wp_themeSkin a.mceButtonSelected {
 .wp_themeSkin a.mceButtonSelected {
-       background-color: #d6d8da;
-       border-color: #7789ba !important;
+       background-color: #d5d5d5;
+       border-color: #777 !important;
 }
 
 .wp_themeSkin .mceButtonDisabled {
 }
 
 .wp_themeSkin .mceButtonDisabled {
-       border-color: #bdd !important;
+       border-color: #ccc !important;
 }
 
 /* ListBox */
 .wp_themeSkin .mceListBox .mceText,
 .wp_themeSkin .mceListBox .mceOpen  {
 }
 
 /* ListBox */
 .wp_themeSkin .mceListBox .mceText,
 .wp_themeSkin .mceListBox .mceOpen  {
-       border-color: #abc0fb;
-       background-color: #e9e8e8;
+       border-color: #B2B2B2;
+       background-color: #d5d5d5;
 }
 
 }
 
-.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen, 
+.wp_themeSkin table.mceListBoxEnabled:hover .mceOpen,
 .wp_themeSkin .mceListBoxHover .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceText {
 .wp_themeSkin .mceListBoxHover .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceOpen,
 .wp_themeSkin .mceListBoxSelected .mceText {
-       border-color: #7789ba !important;
-       background-color: #d6d8da;
+       border-color: #777 !important;
+       background-color: #d5d5d5;
 }
 
 }
 
-.wp_themeSkin table.mceListBoxEnabled:hover .mceText, 
+.wp_themeSkin table.mceListBoxEnabled:hover .mceText,
 .wp_themeSkin .mceListBoxHover .mceText {
 .wp_themeSkin .mceListBoxHover .mceText {
-       border-color: #7789ba !important;
+       border-color: #777 !important;
 }
 
 .wp_themeSkin select.mceListBox {
 }
 
 .wp_themeSkin select.mceListBox {
-       border-color: #b3c7e1; 
+       border-color: #B2B2B2;
        background-color: #fff;
 }
 
 /* SplitButton */
        background-color: #fff;
 }
 
 /* SplitButton */
-.wp_themeSkin .mceSplitButton a.mceAction, 
+.wp_themeSkin .mceSplitButton a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceOpen {
 .wp_themeSkin .mceSplitButton a.mceOpen {
-       background-color: #e9e8e8;
-       border-color: #abc0fb;
+       background-color: #e8e8e8;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin .mceSplitButton a.mceOpen:hover,
 .wp_themeSkin .mceSplitButtonSelected a.mceOpen,
 .wp_themeSkin table.mceSplitButtonEnabled:hover a.mceAction,
 .wp_themeSkin .mceSplitButton a.mceAction:hover {
 }
 
 .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-color: #d6d8da;
-       border-color: #7789ba !important;
-} 
+       background-color: #d5d5d5;
+       border-color: #777 !important;
+}
 
 .wp_themeSkin .mceSplitButtonActive {
 
 .wp_themeSkin .mceSplitButtonActive {
-       background-color: #d6d8da;
+       background-color: #B2B2B2;
 }
 
 /* ColorSplitButton */
 .wp_themeSkin div.mceColorSplitMenu table {
 }
 
 /* ColorSplitButton */
 .wp_themeSkin div.mceColorSplitMenu table {
-       background-color: #ebeaeb;
-       border-color: #808080;
+       background-color: #ebebeb;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin .mceColorSplitMenu a {
 }
 
 .wp_themeSkin .mceColorSplitMenu a {
-       border-color: #808080;
+       border-color: #B2B2B2;
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
 }
 
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {
@@ -641,18 +903,18 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
 }
 
 .wp_themeSkin .mceMenu .mceText {
 }
 
 .wp_themeSkin .mceMenu .mceText {
-       color: #000; 
+       color: #000;
 }
 
 .wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
 .wp_themeSkin .mceMenu .mceMenuItemActive {
 }
 
 .wp_themeSkin .mceMenu .mceMenuItemEnabled a:hover,
 .wp_themeSkin .mceMenu .mceMenuItemActive {
-       background-color: #CEE1EF;
+       background-color: #f5f5f5;
 }
 .wp_themeSkin td.mceMenuItemSeparator {
        background-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle a {
 }
 .wp_themeSkin td.mceMenuItemSeparator {
        background-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle a {
-       background-color: #ccc; 
+       background-color: #ccc;
        border-bottom-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle span.mceText {
        border-bottom-color: #aaa;
 }
 .wp_themeSkin .mceMenuItemTitle span.mceText {
@@ -662,27 +924,80 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
        color: #888;
 }
 
        color: #888;
 }
 
-/* pop-up */
-.clearlooks2 .mceTop .mceLeft, .clearlooks2 .mceTop .mceRight {
-       background-color: #cee1ef;
-       border-color: #c6d9e9;
+.wp_themeSkin tr.mceFirst td.mceToolbar {
+       background-color: #dfdfdf;
+       border-color: #dfdfdf;
 }
 
 }
 
-.clearlooks2 .mceFocus .mceTop .mceLeft, .clearlooks2 .mceFocus .mceTop .mceRight {
-       background-color: #2683ae;
-       border-color: #464646;
+.wp-admin #mceModalBlocker {
+       background: #000;
 }
 
 }
 
-#editorcontainer {
-       border-color: #ccc;
+.wp-admin .clearlooks2 .mceFocus .mceTop .mceLeft {
+       background: #444444;
+       border-left: 1px solid #999;
+       border-top: 1px solid #999;
+       -moz-border-radius: 4px 0 0 0;
+       -webkit-border-top-left-radius: 4px;
+       -khtml-border-top-left-radius: 4px;
+       border-top-left-radius: 4px;
 }
 
 }
 
-#poststuff #titlewrap {
-       border-color: #ccc;
+.wp-admin .clearlooks2 .mceFocus .mceTop .mceRight {
+       background: #444444;
+       border-right: 1px solid #999;
+       border-top: 1px solid #999;
+       border-top-right-radius: 4px;
+       -khtml-border-top-right-radius: 4px;
+       -webkit-border-top-right-radius: 4px;
+       -moz-border-radius: 0 4px 0 0;
 }
 
 }
 
-.curtime {
-       color: #666;
+.wp-admin .clearlooks2 .mceMiddle .mceLeft {
+       background: #f1f1f1;
+       border-left: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceMiddle .mceRight {
+       background: #f1f1f1;
+       border-right: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom .mceLeft {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+       border-left: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom .mceCenter {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceBottom .mceRight {
+       background: #f1f1f1;
+       border-bottom: 1px solid #999;
+       border-right: 1px solid #999;
+}
+
+.wp-admin .clearlooks2 .mceFocus .mceTop span {
+       color: #e5e5e5;
+}
+/* end TinyMCE */
+
+#editorcontainer,
+#post-status-info,
+#titlediv #title {
+       border-color: #dfdfdf;
+}
+
+#titlediv #title {
+       background-color: #fff;
 }
 
 #tTips p#tTips_inside {
 }
 
 #tTips p#tTips_inside {
@@ -690,8 +1005,223 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
        color: #333;
 }
 
        color: #333;
 }
 
-/* Diff */
+#timestampdiv input,
+#namediv input,
+#tagsdiv #the-tagcloud {
+       border-color: #ddd;
+}
+
+/* menu */
+#adminmenu * {
+       border-color: #e3e3e3;
+}
+
+#adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll left 5px;
+}
+
+.folded #adminmenu li.wp-menu-separator {
+       background: transparent url(../images/menu-arrows.gif) no-repeat scroll right -34px;
+}
+
+#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;
+}
+
+#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;
+}
+
+#adminmenu a.menu-top {
+       background: #f1f1f1 url(../images/menu-bits.gif) repeat-x scroll left -379px;
+}
+
+#adminmenu .wp-submenu a {
+       background: #FFFFFF url(../images/menu-bits.gif) no-repeat scroll 0 -310px;
+}
+
+#adminmenu .wp-has-current-submenu ul li a {
+       background: none;
+}
+
+#adminmenu .wp-has-current-submenu ul li a.current {
+       background: url(../images/menu-dark.gif) top left no-repeat !important;
+}
+
+#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;
+       color: #fff;
+       text-shadow: rgba(0,0,0,0.4) 0px -1px 0px;
+}
+
+#adminmenu li.wp-has-current-submenu .wp-submenu,
+#adminmenu li.wp-has-current-submenu ul li a {
+       border-color: #aaa !important;
+}
+
+#adminmenu li.wp-has-current-submenu ul li a {
+       background: url(../images/menu-dark.gif) bottom left no-repeat !important;
+}
+
+#adminmenu li.wp-has-current-submenu ul {
+       border-bottom-color: #aaa;
+}
+
+#adminmenu li.menu-top .current:hover {
+       border-color: #B5B5B5;
+}
+
+#adminmenu .wp-submenu .current a.current {
+       background: transparent url(../images/menu-bits.gif) no-repeat scroll  0 -289px;
+}
+
+#adminmenu .wp-submenu a:hover {
+       background-color: #EAF2FA !important;
+       color: #333 !important;
+}
+
+#adminmenu .wp-submenu li.current,
+#adminmenu .wp-submenu li.current a,
+#adminmenu .wp-submenu li.current a:hover {
+       color: #333;
+       background-color: #f5f5f5;
+       background-image: none;
+       border-color: #e3e3e3;
+       text-shadow: rgba(255,255,255,1) 0px 1px 0px;
+}
+
+#adminmenu .wp-submenu ul {
+       background-color: #fff;
+}
+
+.folded #adminmenu li.menu-top,
+#adminmenu .wp-submenu .wp-submenu-head {
+       background-color: #F1F1F1;
+}
+
+.folded #adminmenu li.wp-has-current-submenu,
+.folded #adminmenu li.menu-top.current {
+       background-color: #e6e6e6;
+}
+
+#adminmenu .wp-has-current-submenu .wp-submenu .wp-submenu-head {
+       background-color: #EAEAEA;
+       border-color: #aaa;
+}
+
+#adminmenu div.wp-submenu {
+       background-color: transparent;
+}
+
+/* menu icons */
+#adminmenu #menu-dashboard div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -61px -33px;
+}
+
+#adminmenu #menu-dashboard:hover div.wp-menu-image,
+#adminmenu  #menu-dashboard.wp-has-current-submenu div.wp-menu-image,
+#adminmenu  #menu-dashboard.current div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -61px -1px;
+}
+
+#adminmenu #menu-posts div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -272px -33px;
+}
+
+#adminmenu #menu-posts:hover div.wp-menu-image,
+#adminmenu #menu-posts.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -272px -1px;
+}
+
+#adminmenu #menu-media div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -121px -33px;
+}
+
+#adminmenu #menu-media:hover div.wp-menu-image,
+#adminmenu #menu-media.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -121px -1px;
+}
+
+#adminmenu #menu-links div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -91px -33px;
+}
+
+#adminmenu #menu-links:hover div.wp-menu-image,
+#adminmenu #menu-links.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -91px -1px;
+}
+
+#adminmenu #menu-pages div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -151px -33px;
+}
+
+#adminmenu #menu-pages:hover div.wp-menu-image,
+#adminmenu #menu-pages.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -151px -1px;
+}
+
+#adminmenu #menu-comments div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -31px -33px;
+}
+
+#adminmenu #menu-comments:hover div.wp-menu-image,
+#adminmenu #menu-comments.wp-has-current-submenu div.wp-menu-image,
+#adminmenu #menu-comments.current div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -31px -1px;
+}
+
+#adminmenu #menu-appearance div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -1px -33px;
+}
+
+#adminmenu #menu-appearance:hover div.wp-menu-image,
+#adminmenu #menu-appearance.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -1px -1px;
+}
+
+#adminmenu #menu-plugins div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -181px -33px;
+}
+
+#adminmenu #menu-plugins:hover div.wp-menu-image,
+#adminmenu #menu-plugins.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -181px -1px;
+}
+
+#adminmenu #menu-users div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -301px -33px;
+}
+
+#adminmenu #menu-users:hover div.wp-menu-image,
+#adminmenu #menu-users.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -301px -1px;
+}
+
+#adminmenu #menu-tools div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -211px -33px;
+}
+
+#adminmenu #menu-tools:hover div.wp-menu-image,
+#adminmenu #menu-tools.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -211px -1px;
+}
+
+#adminmenu #menu-settings div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -241px -33px;
+}
+
+#adminmenu #menu-settings:hover div.wp-menu-image,
+#adminmenu #menu-settings.wp-has-current-submenu div.wp-menu-image {
+       background: transparent url("../images/menu.png") no-repeat scroll -241px -1px;
+}
+/* end menu */
+
 
 
+/* Diff */
 table.diff .diff-deletedline {
        background-color: #ffdddd;
 }
 table.diff .diff-deletedline {
        background-color: #ffdddd;
 }
@@ -704,3 +1234,344 @@ table.diff .diff-addedline {
 table.diff .diff-addedline ins {
        background-color: #99ff99;
 }
 table.diff .diff-addedline ins {
        background-color: #99ff99;
 }
+
+#att-info {
+       background-color: #E4F2FD;
+}
+
+/* edit image */
+#sidemenu a {
+       background-color: #f9f9f9;
+       border-color: #f9f9f9;
+       border-bottom-color: #dfdfdf;
+}
+
+#sidemenu a.current {
+       background-color: #fff;
+       border-color: #dfdfdf #dfdfdf #fff;
+       color: #D54E21;
+}
+
+
+#screen-options-wrap,
+#contextual-help-wrap {
+       background-color: #f1f1f1;
+       border-color: #dfdfdf;
+}
+
+#screen-meta-links a.show-settings {
+       color: #606060;
+}
+
+#screen-meta-links a.show-settings:hover {
+       color: #000;
+}
+
+#replysubmit {
+       background-color: #f1f1f1;
+       border-top-color: #ddd;
+}
+
+#replyerror {
+       border-color: #ddd;
+       background-color: #f9f9f9;
+}
+
+#edithead,
+#replyhead {
+       background-color: #f1f1f1;
+}
+
+#ed_reply_toolbar {
+       background-color: #e9e9e9;
+}
+
+/* table vim shortcuts */
+.vim-current {
+       background-color: #E4F2FD !important;
+}
+
+/* Install Plugins */
+.star-average,
+.star.star-rating {
+       background-color: #fc0;
+}
+
+div.star.select:hover {
+       background-color: #d00;
+}
+
+#plugin-information .fyi ul {
+       background-color: #eaf3fa;
+}
+
+#plugin-information .fyi h2.mainheader {
+       background-color: #cee1ef;
+}
+
+#plugin-information pre,
+#plugin-information code {
+       background-color: #ededff;
+}
+
+#plugin-information pre {
+       border: 1px solid #ccc;
+}
+
+/* inline editor */
+.inline-edit-row fieldset input[type="text"],
+.inline-edit-row fieldset textarea,
+#bulk-titles,
+#replyrow input {
+       border-color: #ddd;
+}
+
+.inline-editor div.title {
+       background-color: #EAF3FA;
+}
+
+.inline-editor ul.cat-checklist {
+       background-color: #FFFFFF;
+       border-color: #ddd;
+}
+
+.inline-edit-row p.submit {
+       background-color: #f1f1f1;
+}
+
+.inline-editor .categories .catshow,
+.inline-editor .categories .cathide {
+       color: #21759b;
+}
+
+.inline-editor .quick-edit-save {
+       background-color: #f1f1f1;
+}
+
+#replyrow #ed_reply_toolbar input:hover {
+       border-color: #aaa;
+       background: #ddd;
+}
+
+fieldset.inline-edit-col-right .inline-edit-col {
+       border-color: #dfdfdf;
+}
+
+.attention {
+       color: #D54E21;
+}
+
+.meta-box-sortables .postbox:hover .handlediv {
+       background: transparent url(../images/menu-bits.gif) no-repeat scroll left -111px;
+}
+
+#major-publishing-actions {
+       background: #eaf2fa;
+}
+
+.tablenav .tablenav-pages {
+       color: #555;
+}
+
+.tablenav .tablenav-pages a {
+       border-color: #e3e3e3;
+       background: #eee url('../images/menu-bits.gif') repeat-x scroll left -379px;
+}
+
+.tablenav .tablenav-pages a:hover {
+       color: #d54e21;
+       border-color: #d54321;
+}
+
+.tablenav .tablenav-pages a:active {
+       color: #fff !important;
+}
+
+.tablenav .tablenav-pages .current {
+       background: #dfdfdf;
+       border-color: #d3d3d3;
+}
+
+#availablethemes,
+#availablethemes td {
+       border-color: #ddd;
+}
+
+#current-theme img {
+       border-color: #999;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link,
+#TB_window #TB_title a.tb-theme-preview-link:visited {
+       color: #999;
+}
+
+#TB_window #TB_title a.tb-theme-preview-link:hover,
+#TB_window #TB_title a.tb-theme-preview-link:focus {
+       color: #ccc;
+}
+
+.misc-pub-section {
+       border-bottom-color: #eee;
+}
+
+#minor-publishing {
+       border-bottom-color: #ddd;
+}
+
+#post-body .misc-pub-section {
+       border-right-color: #eee;
+}
+
+.post-com-count span {
+       background-color: #bbb;
+}
+
+.form-table .color-palette td {
+       border-color: #fff;
+}
+
+.sortable-placeholder {
+       border-color: #bbb;
+       background-color: #f5f5f5;
+}
+
+#post-body ul#category-tabs li.ui-tabs-selected a {
+       color: #333;
+}
+
+#wp_editimgbtn,
+#wp_delimgbtn,
+#wp_editgallery,
+#wp_delgallery {
+       border-color: #999;
+       background-color: #eee;
+}
+
+#wp_editimgbtn:hover,
+#wp_delimgbtn:hover,
+#wp_editgallery:hover,
+#wp_delgallery:hover {
+       border-color: #555;
+       background-color: #ccc;
+}
+
+#favorite-first {
+       background: #797979 url(../images/fav.png) repeat-x left center;
+       border-color: #777 !important;
+       border-bottom-color: #666 !important;
+}
+
+#favorite-inside {
+       border-color: #797979;
+       background-color: #797979;
+}
+
+#favorite-toggle {
+       background: transparent url(../images/fav-arrow.gif) no-repeat 0 -4px;
+}
+
+#favorite-actions a {
+       color: #ddd;
+}
+
+#favorite-actions a:hover {
+       color: #fff;
+}
+
+#favorite-inside a:hover {
+       text-decoration: underline;
+}
+
+#favorite-actions .slide-down {
+       border-bottom-color: #626262;
+}
+
+.submit input,
+.button,
+.button-primary,
+.button-secondary,
+.button-highlighted,
+#postcustomstuff .submit input {
+       text-shadow: rgba(255,255,255,1) 0 1px 0;
+}
+
+.button-primary,
+.submit .button-primary {
+       text-shadow: rgba(0,0,0,0.3) 0 -1px 0;
+}
+
+#screen-meta a.show-settings {
+       background-color: transparent;
+       text-shadow: rgba(255,255,255,0.7) 0 1px 0;
+}
+
+#icon-edit,
+#icon-post {
+       background: transparent url(../images/icons32.png) no-repeat -552px -5px;
+}
+
+#icon-index {
+       background: transparent url(../images/icons32.png) no-repeat -137px -5px;
+}
+
+#icon-upload {
+       background: transparent url(../images/icons32.png) no-repeat -251px -5px;
+}
+
+#icon-link-manager,
+#icon-link,
+#icon-link-category {
+       background: transparent url(../images/icons32.png) no-repeat -190px -5px;
+}
+
+#icon-edit-pages,
+#icon-page {
+       background: transparent url(../images/icons32.png) no-repeat -312px -5px;
+}
+
+#icon-edit-comments {
+       background: transparent url(../images/icons32.png) no-repeat -72px -5px;
+}
+
+#icon-themes {
+       background: transparent url(../images/icons32.png) no-repeat -11px -5px;
+}
+
+#icon-plugins {
+       background: transparent url(../images/icons32.png) no-repeat -370px -5px;
+}
+
+#icon-users,
+#icon-user-edit {
+       background: transparent url(../images/icons32.png) no-repeat -600px -5px;
+}
+
+#icon-tools,
+#icon-admin {
+       background: transparent url(../images/icons32.png) no-repeat -432px -5px;
+}
+
+#icon-options-general {
+       background: transparent url(../images/icons32.png) no-repeat -492px -5px;
+}
+
+.view-switch #view-switch-list {
+       background: transparent url(../images/list.png) no-repeat 0 0;
+}
+
+.view-switch #view-switch-list.current {
+       background: transparent url(../images/list.png) no-repeat -40px 0;
+}
+
+.view-switch #view-switch-excerpt {
+       background: transparent url(../images/list.png) no-repeat -20px 0;
+}
+
+.view-switch #view-switch-excerpt.current {
+       background: transparent url(../images/list.png) no-repeat -60px 0;
+}
+
+#header-logo {
+       background: transparent url(../images/wp-logo.gif) no-repeat scroll center center;
+}
index 3c4fd61aa576886b1d45a2925feb2db3f7a46cc1..60a97bafeadc45421e91baf6b138906cbb2824ba 100644 (file)
@@ -1,62 +1,93 @@
-/* Right Now */
-#rightnow {
-       margin-right:0;
-       margin-left: 7px;
+#dashboard-widgets-wrap .has-sidebar {
+       margin-right: 0;
+       margin-left: -51%;
 }
 }
-#rightnow .reallynow span {
-       text-align: right;
-       float: right;
+#dashboard-widgets-wrap .has-sidebar .has-sidebar-content {
+       margin-right: 0;
+       margin-left: 51%;
+}
+.view-all {
+       right: auto;
+       left: 0;
 }
 }
-#rightnow .reallynow a {
+#dashboard_right_now p.sub, #dashboard-widgets h4, #dashboard_quick_press h4, a.rsswidget, #dashboard_plugins h4, #dashboard_plugins h5, #dashboard_recent_comments .comment-meta .approve {
+       font-family: Tahoma, Arial;
+}
+#dashboard_right_now td.b {
+       padding-right: 0;
+       padding-left: 6px;
        text-align: left;
        text-align: left;
+       font-family: Tahoma, Arial;
+}
+#dashboard_right_now .t {
+       padding-right: 0;
+       padding-left: 12px;
+}
+#dashboard_right_now .versions a {
+       font-family: Tahoma, Arial;
+}
+#dashboard_right_now a.button {
        float: left;
        float: left;
-       margin: 1px 0 0 6px;
+       clear: left;
 }
 }
-/* Widgets */
-div#dashboard-widgets-wrap {
-       margin-right:0;
-       margin-left:-13px;
+#dashboard-widgets h3 .postbox-title-action {
+       right: auto;
+       left: 30px;
 }
 }
-div.dashboard-widget-holder {
-       float:right;
+#the-comment-list .pingback {
+       padding-left: 0 !important;
+       padding-right: 9px !important;
 }
 }
-div.dashboard-widget {
-       margin-right:0;
-       margin-left: 20px;
+/* Recent Comments */
+#the-comment-list .comment-item {
+       padding: 1em 70px 1em 10px;
 }
 }
-h3.dashboard-widget-title span {
-       text-align: right;
+#the-comment-list .comment-item .avatar {
        float: right;
        float: right;
+       margin-left: 0;
+       margin-right: -60px;
 }
 }
-h3.dashboard-widget-title small {
+/* Feeds */
+.rss-widget cite {
        text-align: left;
        text-align: left;
-       float:left;
-}
-div.dashboard-widget-submit input  {
-       font-family: Tahoma;
 }
 }
-div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl {
-       padding-left:0;
-       padding-right:15px;
+.rss-widget span.rss-date {
+       font-family: Tahoma, Arial;
+       margin-left: 0;
+       margin-right: 3px;
 }
 }
-#dashboard_secondary div.dashboard-widget-content ul li {
-       float:right;
+/* QuickPress */
+#dashboard_quick_press h4 {
+       float: right;
+       text-align: left;
 }
 }
-#dashboard_secondary div.dashboard-widget-content ul li .post {
-       font-family:arial;
+#dashboard_quick_press h4 label {
+       margin-right: 0;
+       margin-left: 10px;
 }
 }
-#dashboard_secondary div.dashboard-widget-content ul li a {
-       border-right:0 none;
-       border-left: 1px solid #dadada;
-       height:110px;
+#dashboard_quick_press .input-text-wrap, #dashboard_quick_press .textarea-wrap {
+       margin: 0 5em 1em 0;
 }
 }
-#dashboard_secondary div.dashboard-widget-content ul li a cite {
-       font-family: Tahoma;
+#dashboard_quick_press #media-buttons {
+       margin: 0 5em .5em 0;
+       padding: 0 10px 0 0;
 }
 }
-#dashboard-widgets .widget_rss ul li span.rss-date {
-       float:right;
+#dashboard-widgets #dashboard_quick_press form p.submit {
+       margin-left: 0;
+       margin-right: 4.6em;
 }
 }
-#dashboard-widgets .widget_rss ul li a {
+#dashboard-widgets #dashboard_quick_press form p.submit input {
        float: right;
        float: right;
-       margin: 0 0 .2em .5em;
+}
+#dashboard-widgets #dashboard_quick_press form p.submit #save-post {
+       margin: 0 10px 0 1em;
+}
+#dashboard-widgets #dashboard_quick_press form p.submit #publish {
+       float: left;
+}
+/* Recent Drafts */
+#dashboard_recent_drafts h4 abbr {
+       font-family: Tahoma, Arial;
+       margin-left:0;
+       margin-right: 3px;
 }
 }
index eb07f86b2c8eef2cdd2e94be33d2c6856ce85bca..fcadcf994fc69d5318f9480e54a65d1f5b4ff463 100644 (file)
-/* Right Now */
+.postbox p, .postbox ul, .postbox ol, .postbox blockquote, #wp-version-message { font-size: 11px; }
+
+.edit-box {
+       display: none;
+}
+
+h3:hover .edit-box {
+       display: inline;
+}
 
 
-#rightnow {
+form .input-text-wrap {
+       border-style: solid;
        border-width: 1px;
        border-width: 1px;
+       padding: 2px 3px;
+       border-color: #ccc;
+}
+
+#dashboard-widgets form .input-text-wrap input {
+       border: 0 none;
+       outline: none;
+       margin: 0;
+       padding: 0;
+       width: 99%;
+       color: #333;
+}
+
+form .textarea-wrap {
        border-style: solid;
        border-style: solid;
+       border-width: 1px;
        padding: 2px;
        padding: 2px;
-       margin-top: 10px;
-       margin-right: 7px;
+       border-color: #ccc;
 }
 
 }
 
-#rightnow .reallynow {
-       padding: 6px;
-       font-size: 15px;
-       line-height: 2;
+#dashboard-widgets form .textarea-wrap textarea {
+       border: 0 none;
+       padding: 0;
+       outline: none;
+       width: 99%;
+       -moz-box-sizing: border-box;
+       -webkit-box-sizing: border-box;
+       box-sizing: border-box;
+}
+
+#dashboard-widgets .postbox form .submit {
+       float: none;
+       margin: .5em 0 0;
+       padding: 0;
+       border: none;
+}
+
+#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit input {
        margin: 0;
 }
 
        margin: 0;
 }
 
-#rightnow .rbutton {
-       font-weight: normal;
-       padding: 6px;
-       border-bottom: none;
-       -moz-border-radius: 2px;
-       -khtml-border-radius: 2px;
-       -webkit-border-radius: 2px;
-       border-radius: 2px;
-       text-decoration: none;
+#dashboard-widgets-wrap #dashboard-widgets .postbox form .submit #publish {
+       min-width: 0;
 }
 
 }
 
-#rightnow .reallynow span {
-       display: block;
-       text-align: left;
-       float: left;
-       padding: 0 6px;
+#dashboard-widgets-wrap .has-sidebar {
+       margin-right: -51%;
 }
 
 }
 
-#rightnow .reallynow a {
-       display: block;
-       text-align: right;
-       float: right;
-       padding: 0 6px;
-       font-size: 14px;
-       margin: 1px 6px 0 0;
+#dashboard-widgets-wrap .inner-sidebar {
+       width: 49%;
 }
 
 }
 
-#rightnow .youhave {
-       font-size:  14px;
-       padding: 10px;
+#dashboard-widgets-wrap .has-sidebar .has-sidebar-content {
+       margin-right: 51%;
 }
 
 }
 
-#rightnow h3, #rightnow p {
-       padding: 0 10px;
+div.postbox div.inside {
+       margin: 10px;
+       position: relative;
 }
 
 }
 
-#rightnow a {
-       font-weight: bold;
+#dashboard-widgets a {
+       text-decoration: none;
 }
 
 }
 
-/* Widgets */
+#dashboard-widgets h3 a {
+       text-decoration: underline;
+}
 
 
-div#dashboard-widgets-wrap {
-       margin-top: -20px;
-       margin-right: -13px; /* 20 (div.dashboard-widget margin-right) - 7 (#rightnow margin-right) */
+#dashboard-widgets h3 .postbox-title-action {
+       position: absolute;
+       right: 30px;
+       padding: 0;
 }
 
 }
 
-div#dashboard-widgets {
-       width: 100%;
+#dashboard-widgets h4 {
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       font-size: 13px;
+       margin: 0 0 .2em;
+       padding: 0;
 }
 
 }
 
-div.dashboard-widget-holder {  
-       margin-top: 20px;
-       width: 50%;
-       float: left;
+/* Right Now */
+
+#dashboard_right_now p.sub,
+#dashboard_right_now .table, #dashboard_right_now .versions {
+       margin: -12px;
+}
+
+#dashboard_right_now .inside {
+       font-size: 12px;
 }
 
 }
 
-div.dashboard-widget-holder.third {
-       width: 33.3%;
+#dashboard_right_now p.sub {
+       font-style: italic;
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       padding: 5px 10px 15px;
+       color: #777;
+       font-size: 13px;
 }
 
 }
 
-div.dashboard-widget-holder.fourth {
-       width: 25%;
+#dashboard_right_now .table {
+       background: #f9f9f9;
+       border-top: #ececec 1px solid;
+       border-bottom: #ececec 1px solid;
+       margin: 0 -9px 10px;
+       padding: 0 10px;
 }
 
 }
 
-div.dashboard-widget-holder.full {
+#dashboard_right_now table {
        width: 100%;
 }
 
        width: 100%;
 }
 
-div.dashboard-widget-holder.double div.dashboard-widget {
-       height: 54em;
-       padding-bottom: 28px /* lame */
+#dashboard_right_now table  td {
+       border-top: #ececec 1px solid;
+       padding: 3px 0;
+       white-space: nowrap;
 }
 
 }
 
-div.dashboard-widget {
-       position: relative;
-       margin-right: 20px;
-       border-width: 1px;
-       border-style: solid;
-       padding: 2px;
-       height: 27em;
-       overflow: auto;
-       font-size: 11px;
+#dashboard_right_now table tr.first td {
+       border-top: none;
 }
 
 }
 
-h3.dashboard-widget-title  {
-       margin: 0;
-       padding: 0 7px;
+#dashboard_right_now td.b {
+       padding-right: 6px;
+       text-align: right;
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
        font-size: 14px;
        font-size: 14px;
-       line-height: 2;
 }
 
 }
 
-h3.dashboard-widget-title span {
-       display: block;
-       text-align: left;
-       float: left;
+#dashboard_right_now td.b a {
+       font-size: 18px;
 }
 
 }
 
-h3.dashboard-widget-title small {
-       display: block;
-       text-align: right;
-       float: right;
-       font-size: 75%;
-       line-height: 2.67; /* math: it works, bitches */
+#dashboard_right_now td.b a:hover {
+       color: #d54e21;
 }
 
 }
 
-h3.dashboard-widget-title img.rss-icon {
-       vertical-align: middle;
-       margin: .5em 0;
+#dashboard_right_now .t {
+       font-size: 12px;
+       padding-right: 12px;
+       padding-top: 6px;
+       color: #777;
 }
 
 }
 
-div.dashboard-widget-notice {
-       padding: 0 14px;
-       font-size: 1.2em;
-       line-height: 2;
+#dashboard_right_now td.first,
+#dashboard_right_now td.last {
+       width: 1px;
 }
 
 }
 
-div.dashboard-widget-error {
-       padding: 0 20px;
-       font-size: 1.2em;
-       line-height: 2;
+#dashboard_right_now .spam {
+       color: red;
 }
 
 }
 
-div.dashboard-widget-content {
-       padding: 10px 15px;
+#dashboard_right_now .waiting {
+       color: orange;
 }
 
 }
 
-div.dashboard-widget-submit {
-       border-top: 1px solid #ccc;
-       padding: 1em 0 0 0;
-       margin: 10px 0 0 0;
+#dashboard_right_now .approved {
+       color: green;
 }
 }
-div.dashboard-widget-submit input {
-       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 4px 6px;
-       border: none;
-       font-size: 13px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       cursor: pointer;
-       text-decoration: none;  
+
+#dashboard_right_now .versions {
+       padding: 6px 10px 12px;
 }
 
 }
 
-div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl {
-       margin: 0;
-       text-indent: 0;
-       padding-left: 15px;
+#dashboard_right_now .versions .b {
+       font-weight: bold;
+}
+
+#dashboard_right_now a.button {
+       float: right;
+       clear: right;
+       position: relative;
+       top: -5px;
 }
 }
-div.dashboard-widget-content li {
-       margin: .5em 0 1em;
+
+/* Recent Comments */
+
+#dashboard_recent_comments h3 {
+       margin-bottom: 0;
 }
 
 }
 
-div.dashboard-widget-content blockquote {
-       margin: -1em 0;
+#dashboard_recent_comments .inside {
+       margin-top: 0;
 }
 
 }
 
-div#dashboard_recent_comments p {
-       font-size: 14px;
+#dashboard_recent_comments .comment-meta .approve {
+       font-style: italic;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       font-size: 10px;
 }
 
 }
 
-div.dashboard-widget-content p.comment-meta {
-       font-size: 11px !important;
+#the-comment-list {
+       position: relative;
 }
 
 }
 
-#dashboard_secondary div.dashboard-widget {
-       height: auto;
+#the-comment-list .comment-item {
+       padding: 1em 10px 1em 70px;
+       border-top: 1px solid;
 }
 
 }
 
-#dashboard_secondary div.dashboard-widget-content ul {
-       list-style: none;
-       padding: 0;
+#the-comment-list .pingback {
+       padding-left: 9px !important;
 }
 
 }
 
-#dashboard_secondary div.dashboard-widget-content ul li {
-       display: block;
-       width: 19.95%;
-       padding-bottom: 10px;
-       margin: 0;
+#the-comment-list .comment-item,
+#the-comment-list #replyrow {
+       margin: 0 -10px;
+}
+
+#the-comment-list .comment-item:first-child {
+       border-top: none;
+}
+
+#the-comment-list .comment-item .avatar {
        float: left;
        float: left;
-       font-size: 95%;
+       margin-left: -60px;
 }
 
 }
 
-#dashboard_secondary div.dashboard-widget-content {
-       margin: 10px 5px;
-       padding: 0;
+#the-comment-list .comment-item h4 {
+       line-height: 1.4;
+       margin-top: -.2em;
+       font-weight: normal;
+       color: #999;
 }
 
 }
 
-#dashboard_secondary div.dashboard-widget-content ul li .post {
-       display:block;
-       font-family:Georgia,"Times New Roman",Times,serif;
-       font-size:18px;
-       line-height: 1.2em;
-       height:90px;
-       overflow:hidden;
+#the-comment-list .comment-item h4 cite {
+       font-style: normal;
+       font-weight: normal;
 }
 
 }
 
-#dashboard_secondary div.dashboard-widget-content ul li a {
-       display: block;
-       height:100%;
-       overflow:hidden;
-       margin: 5px 10px;
-       text-decoration: none;
-       padding: .5em;
-       border-right: 1px solid #dadada;
-       border-bottom: 1px solid #dadada;
+#the-comment-list .comment-item blockquote,
+#the-comment-list .comment-item blockquote p {
+       margin: 0;
+       padding: 0;
+       display: inline;
 }
 
 }
 
-#dashboard_secondary div.dashboard-widget-content ul li a cite {
+#dashboard_recent_comments #the-comment-list .trackback blockquote,
+#dashboard_recent_comments #the-comment-list .pingback blockquote {
        display: block;
        display: block;
-       font-family: "Lucida Sans", "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
 }
 
 }
 
-#dashboard-widgets .widget_rss ul {
-       list-style: none;
+#the-comment-list .comment-item p.row-actions {
+       margin: 3px 0 0;
        padding: 0;
        padding: 0;
+       font-size: 10px;
 }
 
 }
 
-#dashboard-widgets .widget_rss ul li {
+/* QuickPress */
+
+#dashboard_quick_press h4 {
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       float: left;
+       width: 5.5em;
        clear: both;
        clear: both;
+       font-weight: normal;
+       text-align: right;
+       padding-top: 5px;
+       font-size: 12px;
+}
+
+#dashboard_quick_press h4 label {
+       margin-right: 10px;
 }
 
 }
 
-#dashboard-widgets .widget_rss ul li span.rss-date {
+#dashboard_quick_press .input-text-wrap,
+#dashboard_quick_press .textarea-wrap {
+       margin: 0 0 1em 5em;
+}
+
+#dashboard_quick_press #media-buttons {
+       margin: 0 0 .5em 5em;
+       padding: 0 0 0 10px;
+       font-size: 11px;
+}
+
+#dashboard_quick_press #media-buttons a {
+       vertical-align: bottom;
+}
+
+#dashboard-widgets #dashboard_quick_press form p.submit {
+       margin-left: 4.6em;
+}
+
+#dashboard-widgets #dashboard_quick_press form p.submit input {
        float: left;
        float: left;
+}
+
+#dashboard-widgets #dashboard_quick_press form p.submit #save-post {
+       margin: 0 1em 0 10px;
+}
+
+#dashboard-widgets #dashboard_quick_press form p.submit #publish {
+       float: right;
+}
+
+/* Recent Drafts */
+#dashboard_recent_drafts ul {
+       margin: 0;
+       padding: 0;
+       list-style: none;
+}
+
+#dashboard_recent_drafts ul li {
+       margin-bottom: 0.6em;
+}
+
+#dashboard_recent_drafts h4 {
+       font-weight: normal;
+}
+
+#dashboard_recent_drafts h4 abbr {
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       font-size: 11px;
+       color: #999;
+       margin-left: 3px;
+}
+
+#dashboard_recent_drafts p {
        margin: 0;
        margin: 0;
+       padding: 0;
 }
 
 }
 
-#dashboard-widgets .widget_rss ul li a {
-       float: left;
-       margin: 0 .5em .2em 0;
-       font-weight: bold;
+/* Feeds */
+
+.rss-widget ul {
+       margin: 0;
+       padding: 0;
+       list-style: none;
 }
 
 }
 
-#dashboard-widgets .widget_rss ul li div {
-       clear: both;
+a.rsswidget {
+       font-size: 13px;
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       line-height: 1.7em;
+}
+
+.rss-widget ul li {
        line-height: 1.5em;
        line-height: 1.5em;
+       margin-bottom: 12px;
 }
 
 }
 
-#dashboard_primary a.rsswidget, #dashboard_plugins h5 {
-       font-size: 14px;
+.rss-widget span.rss-date {
+       margin-left: 3px;
 }
 
 }
 
-#dashboard_primary span.rss-date {
-       font-size: 14px;
+.rss-widget cite {
+       display: block;
+       text-align: right;
+       margin: 0 0 1em;
+       padding: 0;
 }
 
 }
 
+.rss-widget cite:before {
+       content: '\2014';
+}
+
+/* Plugins */
+
 #dashboard_plugins h4 {
 #dashboard_plugins h4 {
-       font-size: 1em;
-       margin: 0 0 .1em;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
 
 #dashboard_plugins h5 {
 }
 
 #dashboard_plugins h5 {
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       font-size: 13px !important;
        margin: 0;
        display: inline;
        line-height: 1.4em;
 }
 
        margin: 0;
        display: inline;
        line-height: 1.4em;
 }
 
-#dashboard_plugins p {
-       margin: 0 0 1em;
-       line-height: 1.5em;
+#dashboard_plugins h5 a {
+       font-weight: normal;
+       line-height: 1.7em;
 }
 
 }
 
-.widget-loading {
+#dashboard_plugins p {
+       margin: 0 0 1.4em;
+       line-height: 1.4em;
 }
 }
diff --git a/wp-admin/css/farbtastic-rtl.css b/wp-admin/css/farbtastic-rtl.css
new file mode 100644 (file)
index 0000000..81f1c9e
--- /dev/null
@@ -0,0 +1,7 @@
+.farbtastic .color, .farbtastic .overlay {\r
+       left: 0;\r
+       right: 47px;\r
+}\r
+.farbtastic .marker {\r
+       margin: -8px -8px 0 0;\r
+}\r
diff --git a/wp-admin/css/farbtastic.css b/wp-admin/css/farbtastic.css
new file mode 100644 (file)
index 0000000..71ad3c1
--- /dev/null
@@ -0,0 +1,32 @@
+.farbtastic {
+  position: relative;
+}
+.farbtastic * {
+  position: absolute;
+  cursor: crosshair;
+}
+.farbtastic, .farbtastic .wheel {
+  width: 195px;
+  height: 195px;
+}
+.farbtastic .color, .farbtastic .overlay {
+  top: 47px;
+  left: 47px;
+  width: 101px;
+  height: 101px;
+}
+.farbtastic .wheel {
+  background: url(../images/wheel.png) no-repeat;
+  width: 195px;
+  height: 195px;
+}
+.farbtastic .overlay {
+  background: url(../images/mask.png) no-repeat;
+}
+.farbtastic .marker {
+  width: 17px;
+  height: 17px;
+  margin: -8px 0 0 -8px;
+  overflow: hidden;
+  background: url(../images/marker.png) no-repeat;
+}
\ No newline at end of file
index c1dfe5e80edc2f8afc2620b4b02b5f1006285577..0526d9d21b22417f22c2f671dca9b8d87b5338cc 100644 (file)
@@ -1,31 +1,74 @@
-body, td {
-       font-family: Tahoma;
+/* 2 column liquid layout */
+#adminmenu {
+       float: right;
+       clear: right;
+       margin-right:-160px;
+       margin-left: 5px;
 }
 }
-textarea, input, select {
-       font-family: Tahoma;
+div.folded #adminmenu {
+       margin-left: 0;
+       margin-right: -45px;
 }
 }
-h1, h2, h3 {
-       font-family:arial;
+/* inner 2 column liquid layout */
+.inner-sidebar {
+       float: left;
+       clear: left;
 }
 }
-.widefat td {
-       padding: 7px 10px 9px 15px;
+.has-sidebar {
+       float: right;
+       clear: right;
+       margin-right: 0;
+       margin-left: -340px;
+}
+.has-sidebar .has-sidebar-content {
+       margin-right: 0;
+       margin-left: 305px;
+}
+#wpbody {
+       margin-left:0;
+       margin-right: 175px;
+}
+.folded #wpbody {
+       margin-left: 0;
+       margin-right: 60px;
+}
+#wpbody-content {
+       float: right;
+}
+/* 2 columns main area */
+#col-right {
+       float: left;
+       clear: left;
+}
+.wrap {
+       margin: 0 5px 0 15px;
+}
+/* styles for use by people extending the WordPress interface */
+body, td, textarea, input, select {
+       font-family: Tahoma, arial;
+}
+.alignleft {
+       float: right;
+}
+.alignright {
+       float: left;
+}
+.subsubsub {
+       float: right;
 }
 .widefat th {
 }
 .widefat th {
-       padding: 9px 10px 6px 15px;
        text-align: right;
 }
 .widefat th input {
        margin: 0 8px 0 0;
 }
        text-align: right;
 }
 .widefat th input {
        margin: 0 8px 0 0;
 }
-.widefat .check-column {
-       text-align: left;
-}
 .wrap h2 {
 .wrap h2 {
-       font-family:arial;
-       margin: 5px -4px 0 0;
-       padding-right:0;
-       padding-left: 280px;
+       font-family: arial;
+       padding: 14px 0 3px 15px;
 }
 .wrap h2.long-header {
        padding-left: 0;
 }
 }
 .wrap h2.long-header {
        padding-left: 0;
 }
+.updated, .error {
+       clear: both;
+}
index 295adea8725e5d31295c3213b7ed6de7ecff2043..d9c91a343c97fbcf1c7dd5beae50d5a8b0e526f6 100644 (file)
-/* styles for use by people extending the WordPress interface */
+/* http://meyerweb.com/eric/tools/css/reset/ */
+/* v1.0 | 20080212 */
+
+html, body, div, span, applet, object, iframe,
+h1, h2, h3, h4, h5, h6, p, blockquote, pre,
+a, abbr, acronym, address, big, cite, code,
+del, dfn, em, font, img, ins, kbd, q, s, samp,
+small, strike, strong, sub, sup, tt, var,
+b, u, i, center,
+dl, dt, dd, ol, ul, li,
+fieldset, form, label, legend,
+table, caption, tbody, tfoot, thead, tr, th, td {
+       margin: 0;
+       padding: 0;
+       border: 0;
+       outline: 0;
+/*     font-size: 100%;
+       vertical-align: baseline; */
+       background: transparent;
+}
+body {
+       line-height: 1;
+}
+ol, ul {
+       list-style: none;
+}
+blockquote, q {
+       quotes: none;
+}
+blockquote:before, blockquote:after,
+q:before, q:after {
+       content: '';
+       content: none;
+}
 
 
+/* remember to define focus styles! */
+/*
+:focus {
+       outline: 0;
+}
+*/
+/* remember to highlight inserts somehow! */
+ins {
+       text-decoration: none;
+}
+del {
+       text-decoration: line-through;
+}
 
 
-body   {
+/* tables still need 'cellspacing="0"' in the markup */
+/*
+table {
+       border-collapse: collapse;
+       border-spacing: 0;
+}
+*/
+/* end reset css */
+
+
+/* 2 column liquid layout */
+#wpwrap {
+       height: auto;
+       min-height: 100%;
+       width: 100%;
+}
+
+#wpcontent {
+       height: 100%;
+       padding-bottom: 50px;
+}
+
+#wpbody {
+       clear: both;
+       margin-left: 175px;
+}
+
+.folded #wpbody {
+       margin-left: 60px;
+}
+
+#wpbody-content {
+       float: left;
+       width: 100%;
+}
+
+#adminmenu {
+       float: left;
+       clear: left;
+       width: 145px;
+       margin-top: 15px;
+       margin-right: 5px;
+       margin-bottom: 15px;
+       margin-left: -160px;
+       position: relative;
+       padding: 0;
+       list-style: none;
+}
+
+.folded #adminmenu {
+       margin-left: -45px;
+}
+
+.folded #adminmenu,
+.folded #adminmenu li.menu-top {
+       width: 28px;
+}
+
+#footer {
+       clear: both;
+       position: relative;
+       width: 100%;
+}
+
+/* inner 2 column liquid layout */
+
+.inner-sidebar {
+       float: right;
+       clear: right;
+       width: 280px;
+       position: relative;
+}
+
+.has-sidebar {
+       float: left;
+       clear: left;
+       width: 100%;
+       margin-right: -340px;
+}
+
+.has-sidebar .has-sidebar-content {
+       margin-right: 305px;
+}
+
+/* 2 columns main area */
+
+#col-container {
+       overflow: hidden;
+       padding: 0;
        margin: 0;
        margin: 0;
+}
+
+#col-left {
        padding: 0;
        padding: 0;
+       margin: 0;
+       overflow: hidden;
+       width: 39%;
+}
+
+#col-right {
+       float: right;
+       clear: right;
+       overflow: hidden;
+       padding: 0;
+       margin: 0;
+       width: 59%;
+}
+
+/* utility classes */
+.alignleft {
+       float: left;
+}
+
+.alignright {
+       float: right;
+}
+
+.textleft {
+       text-align: left;
 }
 
 }
 
-body, td {
-       font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+.textright {
+       text-align: right;
 }
 
 }
 
-form, label input { margin: 0; padding: 0; }
+.clear {
+       clear: both;
+}
 
 
-img { border: 0; }
+.hidden,
+.closed .inside,
+.hide-if-no-js {
+       display: none;
+}
 
 
-label { cursor: pointer; }
+/* include margin and padding in the width calculation of input and textarea */
+input[type="text"],
+textarea {
+       -moz-box-sizing: border-box;
+       -webkit-box-sizing: border-box;
+       -ms-box-sizing: border-box; /* ie8 only */
+       box-sizing: border-box;
+}
+
+input[type="checkbox"],
+input[type="radio"] {
+       vertical-align: text-top;
+}
 
 
-li, dd { margin-bottom: 6px; }
+/* styles for use by people extending the WordPress interface */
+html,
+body {
+       height: 100%;
+}
 
 
-p, li, dl, dd, dt { line-height: 140%; }
+body,
+td {
+       font: 13px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+}
 
 
-textarea, input, select {
-       font: 13px Verdana, Arial, Helvetica, sans-serif;
-       margin: 1px;
-       padding: 3px;
+p {
+       margin: 1em 0;
 }
 
 }
 
-.alignleft { float: left; }
-.alignright { float: right; }
+blockquote {
+       margin: 1em;
+}
 
 
-.textleft { text-align: left; }
-.textright { text-align: right; }
+label {
+       cursor: pointer;
+}
 
 
-.clear { clear: both; height: 2px; }
+li,
+dd {
+       margin-bottom: 6px;
+}
 
 
-.hidden { display: none; }
+p,
+li,
+dl,
+dd,
+dt {
+       line-height: 140%;
+}
+
+textarea,
+input,
+select {
+       font: 13px/19px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       margin: 1px;
+       padding: 3px;
+}
 
 h1 {
   display: block;
 
 h1 {
   display: block;
@@ -79,50 +283,105 @@ h6 {
 
 .subsubsub {
        list-style: none;
 
 .subsubsub {
        list-style: none;
-       margin: 14px 0 8px 0;
+       margin: 8px 0 5px;
        padding: 0;
        white-space: nowrap;
        padding: 0;
        white-space: nowrap;
-       font-size: 12px;
+       font-size: 11px;
+       float: left;
 }
 
 }
 
-.subsubsub a { line-height: 200%; padding: 3px; text-decoration: none; }
+.subsubsub a {
+       line-height: 2;
+       padding: .2em;
+       text-decoration: none;
+}
 
 
-.subsubsub a.current { font-weight: bold; background: none; border: none;}
+.subsubsub a .count, .subsubsub a.current .count {
+       color: #999;
+       font-weight: normal;
+}
 
 
-.subsubsub li { display: inline; margin: 0; padding: 0; }
+.subsubsub a.current {
+       font-weight: bold;
+       background: none;
+       border: none;
+}
+
+.subsubsub li {
+       display: inline;
+       margin: 0;
+       padding: 0;
+}
 
 .widefat {
        border-width: 1px;
        border-style: solid;
 
 .widefat {
        border-width: 1px;
        border-style: solid;
-       border-collapse: collapse;
+       border-collapse: separate;
+       border-spacing: 0;
        width: 100%;
        clear: both;
        margin: 0;
        width: 100%;
        clear: both;
        margin: 0;
+       -moz-border-radius: 4px;
+       -khtml-border-radius: 4px;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
 }
 
 }
 
-.widefat a {
-       text-decoration: none;
+.widefat * {
+       word-wrap: break-word;
 }
 
 }
 
-.widefat abbr {
-       white-space: nowrap;
+.widefat a {
+       text-decoration: none;
 }
 
 }
 
-.widefat td, .widefat th {
+.widefat td,
+.widefat th {
        border-bottom-width: 1px;
        border-bottom-style: solid;
        border-bottom-width: 1px;
        border-bottom-style: solid;
-       border-bottom-color: #ccc;
        font-size: 11px;
        vertical-align: text-top;
 }
 
 .widefat td {
        font-size: 11px;
        vertical-align: text-top;
 }
 
 .widefat td {
-       padding: 7px 15px 9px 10px;
+       padding: 7px 7px 5px;
        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 {
+       font-size: 11px;
+}
+
 .widefat th {
 .widefat th {
-       padding: 9px 15px 6px 10px;
+       padding: 7px 7px 8px;
        text-align: left;
        line-height: 1.3em;
 }
        text-align: left;
        line-height: 1.3em;
 }
@@ -130,69 +389,65 @@ h6 {
 .widefat th input {
        margin: 0 0 0 8px;
        padding: 0;
 .widefat th input {
        margin: 0 0 0 8px;
        padding: 0;
+       vertical-align: text-top;
 }
 
 .widefat .check-column {
 }
 
 .widefat .check-column {
-       text-align: right;
-       width: 1.5em;
+       width: 2.2em;
        padding: 0;
 
 }
 
 .widefat tbody th.check-column {
        padding: 0;
 
 }
 
 .widefat tbody th.check-column {
-       padding: 8px 0 22px;
-}
-/*
-th.check-column + th, th.check-column + td {
-       padding-left: 5px;
+       padding: 7px 0 22px;
 }
 }
-*/
-.widefat .num {
+
+.widefat .num,
+.column-comments,
+.column-links,
+.column-posts,
+.column-parent {
        text-align: center;
 }
 
        text-align: center;
 }
 
-.wrap, .updated, .error {
-       margin: 0;
-       margin-left: 15px;
-       margin-right: 15px;
-       padding: 0;
-       max-width: 980px;
+.widefat th#comments {
+       vertical-align: middle;
 }
 
 }
 
-.updated, .error {
+.wrap {
+       margin: 0 15px 0 5px;
+}
+
+.updated,
+.error {
        border-width: 1px;
        border-style: solid;
        padding: 0 0.6em;
        border-width: 1px;
        border-style: solid;
        padding: 0 0.6em;
-       max-width: 950px;
-       margin-bottom: 1em;
-}
-
-.updated p, .error p {
-       margin: 0.6em 0;
+       margin: 5px 15px 2px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
 }
 
 }
 
-.wrap .updated, .wrap .error {
-       margin: auto 0 0;
+.updated p,
+.error p {
+       margin: 0.5em 0;
+       line-height: 1;
+       padding: 2px;
 }
 
 }
 
-.updated a, .error a {
-       text-decoration: underline;
-}
-
-.updated a {
-       text-decoration: none;
-       padding-bottom: 2px;
+.wrap .updated,
+.wrap .error {
+       margin: 5px 0;
 }
 
 .wrap h2 {
 }
 
 .wrap h2 {
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
-       clear: both;
-       font: 24px Georgia, "Times New Roman", Times, serif;
-       margin: 5px 0 0 -4px;
-       padding: 0;
-       padding-bottom: 7px;
-       padding-right: 280px;
+       font: italic normal normal 24px/29px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       margin: 0;
+       padding: 14px 15px 3px 0;
+       line-height: 35px;
+       text-shadow: rgba(255,255,255,1) 0px 1px 0px;
 }
 
 .wrap h2.long-header {
 }
 
 .wrap h2.long-header {
index 1aa7cdb7db1518e7af15c535d0c44fd2d45b4b65..f66409e1d288a4d84e71ad82a2074b4ff93a99aa 100644 (file)
@@ -1,73 +1,91 @@
-#poststuff .postbox h3 {
-       padding-left:0;
-       padding-right: 23px;
+* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle {
+       background: url(../images/menu-bits-rtl.gif) no-repeat scroll right -109px;
 }
 }
-* html #poststuff .postarea, * html #poststuff #titlediv {
+
+* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle {
+       background: url(../images/menu-bits-rtl.gif) no-repeat scroll right -206px;
+}
+* html #adminmenu {
        margin-left:0;
        margin-left:0;
-       margin-right: 3%;
+       margin-right: -80px;
+}
+* html div.folded #adminmenu {
+       margin-left: 0;
+       margin-right: -22px;
+}
+#wpcontent #adminmenu .wp-submenu li.wp-submenu-head {
+       padding: 3px 10px 4px 4px;
+}
+.inline-edit-row fieldset label span.title {
+       float: right;
+}
+.inline-edit-row fieldset label span.input-text-wrap {
+       margin-right: 0;
+}
+p.search-box {
+       float: left;
 }
 * html #poststuff h2 {
        margin-right: 0;
 }
 #bh {
 }
 * html #poststuff h2 {
        margin-right: 0;
 }
 #bh {
-       padding-right:0;
-       padding-left: 15px;
+       margin: 7px 10px 0 0;
+       float: left;
+}
+#user_info + div#favorite-actions {
+       right: auto;
+       left: 15px;
+}
+#wphead-info {
+       float: left;
 }
 }
+/* without this dashboard widgets appear in one column for some screen widths */
 div#dashboard-widgets {
 div#dashboard-widgets {
-       padding-right:0;
+       padding-right: 0;
        padding-left: 1px;
 }
 #tagchecklist span a {
        margin: 4px -9px 0 0;
 }
        padding-left: 1px;
 }
 #tagchecklist span a {
        margin: 4px -9px 0 0;
 }
-#poststuff .togbox {
-       margin-left:0;
-       margin-right: -19px;
-}
 .widefat th input {
        margin: 0 5px 0 0;
 }
 /* ---------- add by navid */
 .widefat th input {
        margin: 0 5px 0 0;
 }
 /* ---------- add by navid */
-#dashmenu { /* fix top right bottom in admin */
-       direction:ltr;
-}
-#sidemenu a { /* fix left admin buttom ex. plugins, options */
-       float:left;
+#TB_window {
+       width: 670px;
+       position: absolute;
+       top: 50%;
+       left: 50%;
+       margin-right: 335px !important;
 }
 }
-.wrap h2 {
-       margin:5px 4px 0 0;
+#dashboard_plugins {
+       direction: ltr;
 }
 }
-#editor-toolbar {/* fix hover in media uploader icon */
-       direction:ltr;
+#dashboard_plugins h3.hndle {
+       direction: rtl;
 }
 }
-#TB_window { /* fix theme preview */
-       left:2%;
+#dashboard_incoming_links ul li,
+#dashboard_secondary ul li,
+#dashboard_primary ul li,
+p.row-actions {
+       width: 100%;
 }
 }
-/* fix widget page */
-form#widgets-filter {
-       position:static;
+#favorite-inside {
+       position: absolute;
+       right:0;
 }
 }
-#widget-search {
-       display:none;
+#post-status-info {
+       height: 25px;
 }
 }
-/* fix manage comment page */
-ul.view-switch li {
-       float:left;
+#screen-meta {
+       position: static;
 }
 }
-form#posts-filter {
-       position:static;
+p.submit { /* quick edit and reply in edit-comments.php */
+       height:22px;
 }
 }
-#post-search {
-       display:none;
+.inner-sidebar { /* fix edit single comment */
+       position: static;
 }
 }
-#submenu {
-       margin-right: 20px;
+form#widgets-filter { /* fix widget page */
+       position: static;
 }
 }
-/* Fixes for media-upload window */
-/* Center media-upload panel on screen */
-#TB_window { 
-       width: 670px; 
-       position: absolute; 
-       top: 50%; 
-       left: 50%; 
-       margin-right: 335px !important; }
index e4d035548b1cb9af93df5ada915b88eca50bea89..c6c03106b1c65a843e0d566efa8ad0b1933e0364 100644 (file)
@@ -1,14 +1,44 @@
 /* Fixes for IE bugs */
 
 /* Fixes for IE bugs */
 
-#poststuff .postbox h3 {
-       padding-left: 23px;
+input.button,
+input.button-secondary,
+input.button-highlighted {
+       padding: 0;
+}
+
+#minor-publishing-actions input,
+#major-publishing-actions input,
+#minor-publishing-actions .preview {
+       min-width: auto;
+       padding-left: 0;
+       padding-right: 0;
+}
+
+#wpbody-content .postbox {
+       border: 1px solid #dfdfdf;
+}
+
+#wpbody-content .postbox h3 {
+       margin-bottom: -1px;
 }
 
 }
 
-#submenu li a.current {
-       background:none;
-       border:none;
+* html #side-info-column {
+       height: auto;
 }
 
 }
 
+* html #wpbody-content #screen-options-link-wrap {
+       display: inline-block;
+       width: 150px;
+       text-align: center;
+}
+
+* html #wpbody-content #contextual-help-link-wrap {
+       display: inline-block;
+       width: 100px;
+       text-align: center;
+}
+
+/*
 * html body.minwidth {
        _width: expression(document.documentElement.clientWidth < 810 ? "808px" : "99.9%");
 }
 * html body.minwidth {
        _width: expression(document.documentElement.clientWidth < 810 ? "808px" : "99.9%");
 }
 * html #wpbody {
        _width: expression(document.documentElement.clientWidth > 982 ? "980px" : "99.9%");
 }
 * html #wpbody {
        _width: expression(document.documentElement.clientWidth > 982 ? "980px" : "99.9%");
 }
+*/
 
 
-* html #poststuff .postarea, * html #poststuff #titlediv {
-       width: 95%;
-       margin-left: 3%;
+* html #adminmenu {
+       margin-left: -80px;
+}
+
+* html div.folded #adminmenu {
+       margin-left: -22px;
+}
+
+* html #wpcontent #adminmenu li.menu-top {
+       display: inline;
+       padding: 0;
+       margin: 0;
+}
+
+#wpcontent.folded #adminmenu li.menu-top {
+       display: block;
+}
+
+ul#adminmenu {
+       z-index: 99;
+}
+
+#adminmenu li.menu-top a.menu-top {
+       min-width: auto;
+       width: auto;
+}
+
+#wpcontent #adminmenu li.wp-has-current-submenu a.wp-has-submenu {
+       font-style: normal;
+}
+
+* html #wpcontent #adminmenu .wp-menu-open .wp-menu-toggle {
+       background: none;
+}
+
+* html #wpcontent #adminmenu .wp-has-submenu .wp-menu-toggle {
+       background: url(../images/menu-bits.gif) no-repeat scroll left -109px;
+}
+
+* html #wpcontent #adminmenu li.wp-has-current-submenu .wp-menu-toggle {
+       background: url(../images/menu-bits.gif) no-repeat scroll left -206px;
+}
+
+* html #adminmenu div.wp-menu-image {
+       height: 29px;
+}
+
+#wpcontent #adminmenu .wp-submenu li {
+       padding: 0;
+}
+
+#adminmenu,
+.wp-submenu,
+.wp-submenu li,
+.wp-menu-toggle {
+       zoom: 100%;
+}
+
+#wpcontent.folded #adminmenu li.wp-menu-separator {
+       width: 28px;
+}
+
+#wpcontent #adminmenu .wp-submenu li.wp-submenu-head {
+       padding: 3px 4px 4px 10px;
+       zoom: 100%;
+}
+
+#wpcontent.folded #adminmenu .menu-top {
+       height: 30px;
+}
+
+.folded #adminmenu .wp-submenu {
+       margin: -1px 0 0 0;
+}
+
+#template,
+#template div,
+#editcat,
+#addcat {
+       zoom: 100%;
 }
 
 .submitbox {
        margin-top: 10px;
 }
 
 }
 
 .submitbox {
        margin-top: 10px;
 }
 
-* html div.widget-liquid-left-holder, * html div.widget-liquid-right {
+/* Inline Editor */
+#wpbody-content .quick-edit-row-post .inline-edit-col-left {
+       width: 39%;
+}
+
+#wpbody-content .inline-edit-row-post .inline-edit-col-center {
+       width: 19%;
+}
+
+#wpbody-content .quick-edit-row-page .inline-edit-col-left {
+       width: 49%;
+}
+
+#wpbody-content .bulk-edit-row .inline-edit-col-left {
+       width: 29%;
+}
+
+.inline-edit-row p.submit {
+       zoom: 100%;
+}
+
+.inline-edit-row fieldset label span.title {
+       display: block;
+       float: left;
+       width: 5em;
+}
+
+.inline-edit-row fieldset label span.input-text-wrap {
+       margin-left: 0;
+       zoom: 100%;
+}
+
+#wpbody-content .inline-edit-row fieldset label span.input-text-wrap input {
+       line-height: 130%;
+}
+
+#wpbody-content .inline-edit-row .input-text-wrap input {
+       width: 95%;
+}
+
+#wpbody-content .inline-edit-row .input-text-wrap input.inline-edit-password-input {
+       width: 8em;
+}
+/* end Inline Editor */
+
+input {
+       line-height: 1;
+}
+
+* html .row-actions {
+       visibility: visible;
+}
+
+#dashboard-widgets h3 a {
+       height: 20px;
+       line-height: 20px;
+}
+
+#the-comment-list .comment-item,
+ul#widget-list li.widget-list-item {
+       zoom: 100%;
+}
+
+#wphead-info {
+       float: right;
+}
+
+#titlediv #title {
+       width: 98%;
+}
+
+a.button {
+       line-height: 1.4em;
+       margin: 1px;
+}
+
+* html div.widget-liquid-left-holder,
+* html div.widget-liquid-right {
        display: block;
        position: relative;
 }
 
        display: block;
        position: relative;
 }
 
-#wpwrap, #wpcontent, #post, #wrap, #postdivrich, #postdiv, #poststuff, #titlediv, #post-body, #editorcontainer, .tablenav, .widget-control-list, li.widget-list-control-item, #dragHelper, li.widget-list-control-item h4, .widget-sortable, .widget-control-actions {
+#screen-options-wrap {
+       overflow: hidden;
+}
+
+#favorite-actions {
+       z-index: 12;
+}
+
+#favorite-inside,
+#favorite-inside a,
+.favorite-action {
+       zoom: 100%;
+}
+
+#post-status-info,
+#wpwrap,
+#wpcontent,
+#post,
+#wrap,
+#postdivrich,
+#postdiv,
+#poststuff,
+.metabox-holder,
+#titlediv,
+#post-body,
+#editorcontainer,
+.tablenav,
+.widget-control-list,
+li.widget-list-control-item,
+#dragHelper,
+li.widget-list-control-item h4,
+.widget-sortable,
+.widget-control-actions,
+#tagchecklist,
+#col-container,
+#col-left,
+#col-right {
        display: block;
        zoom: 100%;
 }
 
        display: block;
        zoom: 100%;
 }
 
+p.search-box {
+       position: static;
+       float: right;
+       margin: -3px 0 4px;
+}
+
 * html #editorcontainer {
        padding: 0;
 }
 
 * html #editorcontainer {
        padding: 0;
 }
 
-* html #editorcontainer #content {
-       position: relative;
+#editorcontainer #content {
        overflow: auto;
        overflow: auto;
-       padding: 6px;
        margin: auto;
        width: 98%;
 }
        margin: auto;
        width: 98%;
 }
@@ -52,7 +277,8 @@ form#template div {
        width: 100%;
 }
 
        width: 100%;
 }
 
-#ed_toolbar input {
+#ed_toolbar input,
+#ed_reply_toolbar input {
        overflow: visible;
        padding: 0 4px;
 }
        overflow: visible;
        padding: 0 4px;
 }
@@ -66,7 +292,8 @@ form#template div {
 }
 
 #bh {
 }
 
 #bh {
-       padding-right: 15px;
+       margin: 7px 10px 0 0;
+       float: right;
 }
 
 /* without this dashboard widgets appear in one column for some screen widths */
 }
 
 /* without this dashboard widgets appear in one column for some screen widths */
@@ -74,11 +301,6 @@ div#dashboard-widgets {
        padding-right: 1px;
 }
 
        padding-right: 1px;
 }
 
-#tagchecklist {
-       display: block;
-       zoom: 100%;
-}
-
 #tagchecklist span, #tagchecklist span a {
        display: inline-block;
        display: block;
 #tagchecklist span, #tagchecklist span a {
        display: inline-block;
        display: block;
@@ -88,10 +310,6 @@ div#dashboard-widgets {
        margin: 4px 0 0 -9px;
 }
 
        margin: 4px 0 0 -9px;
 }
 
-#poststuff .togbox {
-       margin-left: -19px;
-}
-
 .tablenav .button-secondary, .nav .button-secondary {
        padding: 0 1px;
        vertical-align: middle;
 .tablenav .button-secondary, .nav .button-secondary {
        padding: 0 1px;
        vertical-align: middle;
@@ -104,23 +322,10 @@ div#dashboard-widgets {
        margin-top: 2px;
 }
 
        margin-top: 2px;
 }
 
-.tablenav-pages .page-numbers {
-       display: inline-block;
-}
-
-.tablenav-pages {
-       display: block;
-       margin-top: -3px;
-}
-
 table.ie-fixed {
        table-layout: fixed;
 }
 
 table.ie-fixed {
        table-layout: fixed;
 }
 
-#post-search .button, #widget-search .button {
-       padding: 1px;
-}
-
 .widefat tr, .widefat th {
        margin-bottom: 0;
        border-spacing: 0;
 .widefat tr, .widefat th {
        margin-bottom: 0;
        border-spacing: 0;
index efef9612102bfd287808cc635da8c30fc36dab10..f44484f7e3344d99a3f56b9e38bfcb79ce3fedc4 100644 (file)
@@ -1,27 +1,16 @@
 body {
 body {
-       font-family: Tahoma;
+       font-family: Tahoma, arial;
 }
 }
-/* Half the page disapears on IE6 */
-* html body {
-       width: 700px; 
-       position: absolute; 
-       left: 50%; 
-       margin-right: 350px;
-}
-ul, ol {
-       padding: 5px 22px 5px 5px;
-}
-.step, th {
-       text-align:right;
+h1 {
+       font-family: arial;
+       margin: 5px -4px 0 0;
 }
 }
-.submit input, .button, .button-secondary  {
-       font-family: Tahoma;
+ul, ol { padding: 5px 22px 5px 5px; }
+.step, th { text-align: right; }
+.submit input, .button, .button-secondary {
+       font-family: Tahoma, arial;
        margin-right:0;
 }
 .form-table th {
        margin-right:0;
 }
 .form-table th {
-       text-align:right;
-}
-h1 {
-       font-family:arial;
-       margin: 5px -4px 0 0;
+       text-align: right;
 }
 }
index cfa03253b575f0d38bf5d3c9677722435061ad91..6be5ba7554597d9637a7721721526189bb303bf0 100644 (file)
@@ -1,78 +1,83 @@
-html { background: #f1f1f1; }
+html { background: #f7f7f7; }
 
 body {
        background: #fff;
        color: #333;
 
 body {
        background: #fff;
        color: #333;
-       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
        margin: 2em auto 0 auto;
        width: 700px;
        padding: 1em 2em;
        margin: 2em auto 0 auto;
        width: 700px;
        padding: 1em 2em;
-       -moz-border-radius: 12px;
-       -khtml-border-radius: 12px;
-       -webkit-border-radius: 12px;
-       border-radius: 12px;
+       -moz-border-radius: 11px;
+       -khtml-border-radius: 11px;
+       -webkit-border-radius: 11px;
+       border-radius: 11px;
+       border: 1px solid #dfdfdf;
 }
 
 a { color: #2583ad; text-decoration: none; }
 
 a:hover { color: #d54e21; }
 
 }
 
 a { color: #2583ad; text-decoration: none; }
 
 a:hover { color: #d54e21; }
 
-
 h1 {
 h1 {
-       font-size: 18px;
-       margin-bottom: 0;
+       border-bottom: 1px solid #dadada;
+       clear: both;
+       color: #666;
+       font: 24px Georgia, "Times New Roman", Times, serif;
+       margin: 5px 0 0 -4px;
+       padding: 0;
+       padding-bottom: 7px;
 }
 
 h2 { font-size: 16px; }
 
 p, li {
        padding-bottom: 2px;
 }
 
 h2 { font-size: 16px; }
 
 p, li {
        padding-bottom: 2px;
-       font-size: 13px;
+       font-size: 12px;
        line-height: 18px;
 }
 
        line-height: 18px;
 }
 
-code {
-       font-size: 13px;
-}
+code { font-size: 13px; }
 
 ul, ol { padding: 5px 5px 5px 22px; }
 
 
 ul, ol { padding: 5px 5px 5px 22px; }
 
-#logo { margin: 6px 0 14px 0px; border-bottom: none;}
+#logo { margin: 6px 0 14px 0; border-bottom: none;}
 
 .step {
        margin: 20px 0 15px;
 }
 
 
 .step {
        margin: 20px 0 15px;
 }
 
-.step input {
-       font-size: 18px;
-}
-
-a.button {
-       font-size: 18px;
-}
-
 .step, th { text-align: left; padding: 0; }
 
 .submit input, .button, .button-secondary {
 .step, th { text-align: left; padding: 0; }
 
 .submit input, .button, .button-secondary {
-       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 5px 7px 7px;
-       border: 1px solid #a3a3a3;
-       margin-left: 0;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       color: #246;
-       background: #e5e5e5;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       text-decoration: none;
+       font-size: 14px !important;
+       line-height: 16px;
+       padding: 6px 12px;
+       cursor: pointer;
+       border: 1px solid #bbb;
+       color: #464646;
+       -moz-border-radius: 15px;
+       -khtml-border-radius: 15px;
+       -webkit-border-radius: 15px;
+       border-radius: 15px;
+       -moz-box-sizing: content-box;
+       -webkit-box-sizing: content-box;
+       -khtml-box-sizing: content-box;
+       box-sizing: content-box;
+}
+
+.button:hover, .button-secondary:hover, .submit input:hover {
+       color: #000;
+       border-color: #666;
 }
 
 }
 
-.button-secondary {
-       background: #cee1ef;
+.button, .submit input, .button-secondary {
+       background: #f2f2f2 url(../images/white-grad.png) repeat-x scroll left top;
 }
 
 }
 
-.submit input:hover, .button:hover, .button-secondary:hover {
-       color: #d54e21;
-       border-color: #535353;
+.button:active, .submit input:active, .button-secondary:active {
+       background: #eee url(../images/white-grad-active.png) repeat-x scroll left top;
 }
 
 .form-table {
 }
 
 .form-table {
@@ -98,7 +103,7 @@ a.button {
 }
 
 .form-table tr {
 }
 
 .form-table tr {
-       background: #eaf3fa;
+       background: #f3f3f3;
 }
 
 .form-table code {
 }
 
 .form-table code {
@@ -117,26 +122,12 @@ a.button {
        padding: 2px;
 }
 
        padding: 2px;
 }
 
-h1 {
-       border-bottom: 1px solid #dadada;
-       clear: both;
-       color: #666666;
-       font: 24px Georgia, "Times New Roman", Times, serif;
-       margin: 5px 0 0 -4px;
-       padding: 0;
-       padding-bottom: 7px;
-}
-
-#error-page {
-       margin-top: 50px;
-}
+#error-page { margin-top: 50px; }
 
 #error-page p {
 
 #error-page p {
-       font-size: 14px;
-       line-height: 16px;
+       font-size: 12px;
+       line-height: 18px;
        margin: 25px 0 20px;
 }
 
        margin: 25px 0 20px;
 }
 
-#error-page code {
-       font-size: 15px;
-}
\ No newline at end of file
+#error-page code { font-family: Consolas, Monaco, Courier, monospace; }
index daefbacb6af8c31fd41012fa961615e4756784b9..4a5c5f0a8112a25c0b61192e0dc370281cd1b065 100644 (file)
@@ -1,37 +1,30 @@
 body {
 body {
-       font-family: Tahoma;
+       font-family: Tahoma, arial;
 }
 form {
 }
 form {
-       margin-left:0;
        margin-right: 8px;
        margin-right: 8px;
+       margin-left: 0;
 }
 form .forgetmenot {
 }
 form .forgetmenot {
-       float:right;
+       float: right;
 }
 }
-#login form .submit input  {
-       font-family: Tahoma;
-}
-form .submit {
-       float:left;
+#login form .submit input {
+       font-family: Tahoma, arial;
 }
 }
+form .submit { float: left; }
 #backtoblog a {
 #backtoblog a {
-       left:auto;
-       right:15px;
+       left: auto;
+       right: 15px;
 }
 #login_error, .message {
        margin: 0 8px 16px 0;
 }
 }
 #login_error, .message {
        margin: 0 8px 16px 0;
 }
-#nav {
-       margin:0 8px 0 0;
-}
+#nav { margin: 0 8px 0 0; }
 #user_pass, #user_login, #user_email {
 #user_pass, #user_login, #user_email {
-       margin-right:0;
        margin-left: 6px;
        margin-left: 6px;
+       margin-right: 0;
+       direction:ltr;
 }
 h1 a {
 }
 h1 a {
-       text-decoration:none;
-}
-/* ltr input */
-#user_login, #user_pass {
-       direction:ltr;
+       text-decoration: none;
 }
 }
index 92f10bca05cda7e436032dd4c43088df49c62477..9f806e79ea69c6cade4cad8bb2a906c69a6d4c17 100644 (file)
@@ -3,35 +3,56 @@
 body {
        border-top-width: 30px;
        border-top-style: solid;
 body {
        border-top-width: 30px;
        border-top-style: solid;
-       font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       font: 11px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
 
 form {
        margin-left: 8px;
        padding: 16px 16px 40px 16px;
 }
 
 form {
        margin-left: 8px;
        padding: 16px 16px 40px 16px;
-       font-weight: bold;
-       -moz-border-radius: 5px;
-       -khtml-border-radius: 5px;
-       -webkit-border-radius: 5px;
+       font-weight: normal;
+       -moz-border-radius: 11px;
+       -khtml-border-radius: 11px;
+       -webkit-border-radius: 11px;
        border-radius: 5px;
        border-radius: 5px;
+       background: #fff;
+       border: 1px solid #e5e5e5;
+       -moz-box-shadow: rgba(200,200,200,1) 0 4px 18px;
+       -webkit-box-shadow: rgba(200,200,200,1) 0 4px 18px;
+       -khtml-box-shadow: rgba(200,200,200,1) 0 4px 18px;
+       box-shadow: rgba(200,200,200,1) 0 4px 18px;
 }
 
 }
 
-form .forgetmenot { font-weight: normal; float: left; margin-bottom: 0;}
+form .forgetmenot { font-weight: normal; float: left; margin-bottom: 0; }
 
 #login form .submit input {
 
 #login form .submit input {
-       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 3px 5px;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       padding: 3px 10px;
        border: none;
        border: none;
-       font-size: 13px;
+       font-size: 12px;
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       cursor: default;
-       text-decoration: none;  
-       margin-top: -6px;
+       -moz-border-radius: 11px;
+       -khtml-border-radius: 11px;
+       -webkit-border-radius: 11px;
+       border-radius: 11px;
+       cursor: pointer;
+       text-decoration: none;
+       margin-top: -3px;
+       text-shadow: rgba(0,0,0,0.3) 0 -1px 0;
+}
+
+#login form p {
+       margin-bottom: 0;
+}
+
+label {
+       color: #777;
+       font-size: 13px;
+}
+
+form .forgetmenot label {
+       font-size: 11px;
+       line-height: 19px;
 }
 
 form .submit { float: right; }
 }
 
 form .submit { float: right; }
@@ -39,15 +60,19 @@ form .submit { float: right; }
 form p { margin-bottom: 24px; }
 
 h1 a {
 form p { margin-bottom: 24px; }
 
 h1 a {
-       background: url(../images/logo-login.gif) no-repeat;
-       width: 292px;
-       height: 66px;
+       background: url(../images/logo-login.gif) no-repeat top center;
+       width: 326px;
+       height: 67px;
        text-indent: -9999px;
        overflow: hidden;
        padding-bottom: 15px;
        display: block;
 }
 
        text-indent: -9999px;
        overflow: hidden;
        padding-bottom: 15px;
        display: block;
 }
 
+#nav {
+       text-shadow: rgba(255,255,255,1) 0 1px 0;
+}
+
 #backtoblog a {
        position: absolute;
        top: 7px;
 #backtoblog a {
        position: absolute;
        top: 7px;
@@ -55,20 +80,28 @@ h1 a {
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
-#login { width: 292px; margin: 7em auto; }
+#login { width: 320px; margin: 7em auto; }
 
 #login_error, .message {
        margin: 0 0 16px 8px;
        border-width: 1px;
        border-style: solid;
        padding: 12px;
 
 #login_error, .message {
        margin: 0 0 16px 8px;
        border-width: 1px;
        border-style: solid;
        padding: 12px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
 }
 
 #nav { margin: 0 0 0 8px; padding: 16px; }
 
 #user_pass, #user_login, #user_email {
 }
 
 #nav { margin: 0 0 0 8px; padding: 16px; }
 
 #user_pass, #user_login, #user_email {
-       font-size: 20px;
+       font-size: 24px;
        width: 97%;
        padding: 3px;
        width: 97%;
        padding: 3px;
+       margin-top: 2px;
        margin-right: 6px;
        margin-right: 6px;
-}
\ No newline at end of file
+       margin-bottom: 16px;
+       border: 1px solid #e5e5e5;
+       background: #fbfbfb;
+}
index b23ad0e88c8d789eb3d1b41231f955cd76007a41..5aeab26fa5f9386aeb27bcf602856b9c7eb0ebd8 100644 (file)
@@ -1,66 +1,93 @@
 body#media-upload ul#sidemenu {
 body#media-upload ul#sidemenu {
-       left:auto;
-       right:0;
-       width: 620px;
+       left: auto;
+       right: 0;
 }
 #search-filter {
 }
 #search-filter {
-       text-align:left;
+       text-align: left;
 }
 }
+/* specific to the image upload form */
 .align .field label {
        padding: 0 28px 0 0;
        margin: 0 0 0 1em;
 }
 .image-align-none-label, .image-align-left-label, .image-align-center-label, .image-align-right-label {
 .align .field label {
        padding: 0 28px 0 0;
        margin: 0 0 0 1em;
 }
 .image-align-none-label, .image-align-left-label, .image-align-center-label, .image-align-right-label {
-       background-position:center right;
+       background-position: center right;
+}
+tr.image-size div.image-size-item {
+       float: right;
 }
 tr.image-size label {
 }
 tr.image-size label {
-       margin: 0 0 0 1em;
+       margin: 0 1em 0 0;
 }
 .filename.original {
        float: right;
 }
 .crunching {
        text-align: left;
 }
 .filename.original {
        float: right;
 }
 .crunching {
        text-align: left;
-       margin-right:0;
+       margin-right: 0;
        margin-left: 5px;
 }
 button.dismiss {
        margin-left: 5px;
 }
 button.dismiss {
-       right:auto;
-       left:5px;
+       right: auto;
+       left: 5px;
 }
 .file-error {
        margin: 0 50px 5px 0;
 }
 .progress {
 }
 .file-error {
        margin: 0 50px 5px 0;
 }
 .progress {
-       left:auto;
-       right:0;
+       left: auto;
+       right: 0;
+}
+.describe td {
+       padding: 0 0 0 5px;
 }
 .bar {
 }
 .bar {
-       border-right-width:0;
+       border-right-width: 0;
        border-left-width: 3px;
        border-left-width: 3px;
+       border-right-style: none;
        border-left-style: solid;
 }
 .media-item .pinkynail {
        border-left-style: solid;
 }
 .media-item .pinkynail {
-       float:right;
+       float: right;
 }
 }
-.describe-toggle-on, .describe-toggle-off {
+.describe-toggle-on,
+.describe-toggle-off {
        float: left;
        float: left;
-       margin-right:0;
+       margin-right: 0;
        margin-left: 20px;
 }
 /* Specific to Uploader */
        margin-left: 20px;
 }
 /* Specific to Uploader */
-
 #media-upload .media-upload-form p {
        margin: 0 0 1em 1em;
 }
 .filename {
        float: right;
 #media-upload .media-upload-form p {
        margin: 0 0 1em 1em;
 }
 .filename {
        float: right;
-       margin-left:0;
+       margin-left: 0;
        margin-right: 10px;
 }
 #media-upload .describe th.label {
        margin-right: 10px;
 }
 #media-upload .describe th.label {
-       text-align:right;
+       text-align: right;
 }
 .menu_order {
 }
 .menu_order {
-       float:left;
+       float: left;
+}
+.media-upload-form label.form-help, td.help, #media-upload p.help, #media-upload label.help {
+       font-family: Tahoma, Arial;
+}
+#gallery-settings #basic th.label {
+       padding: 5px 0 5px 5px;
+}
+#gallery-settings .title, h3.media-title {
+       font-family: Tahoma, Arial;
+}
+#gallery-settings .describe th.label {
+       text-align: right;
+}
+#gallery-settings label,
+#gallery-settings legend {
+       margin-right: 0;
+       margin-left: 15px;
+}
+#gallery-settings .align .field label {
+       margin: 0 0 0 1.5em;
 }
 }
index d04866afe0da6e0d16c804062ab12e844af24725..7c082700b07da2f6cd6ea34c32b01c3147cf0ff7 100644 (file)
@@ -29,17 +29,21 @@ form {
        text-align: right;
 }
 
        text-align: right;
 }
 
-.media-upload-form label, .media-upload-form legend {
-       display:block;
+.media-upload-form label,
+.media-upload-form legend {
+       display: block;
        font-weight: bold;
        font-size: 13px;
        margin-bottom: 0.5em;
        margin: 0 0 0.5em 0;
 }
 
        font-weight: bold;
        font-size: 13px;
        margin-bottom: 0.5em;
        margin: 0 0 0.5em 0;
 }
 
-th { position: relative; }
+th {
+       position: relative;
+}
 
 .media-upload-form label.form-help, td.help {
 
 .media-upload-form label.form-help, td.help {
+       font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
        font-style: italic;
        font-weight: normal;
 }
        font-style: italic;
        font-weight: normal;
 }
@@ -63,6 +67,7 @@ th { position: relative; }
        padding: 0 0 0 28px;
        margin: 0 1em 0 0;
 }
        padding: 0 0 0 28px;
        margin: 0 1em 0 0;
 }
+
 .image-align-none-label {
        background: url(../images/align-none.png) no-repeat center left;
 }
 .image-align-none-label {
        background: url(../images/align-none.png) no-repeat center left;
 }
@@ -79,14 +84,21 @@ th { position: relative; }
        background: url(../images/align-right.png) no-repeat center left;
 }
 
        background: url(../images/align-right.png) no-repeat center left;
 }
 
-#flash-upload-ui, .insert-gallery {
-       display: none;
+tr.image-size td {
+       width: 460px;
+}
+
+tr.image-size div.image-size-item {
+       float: left;
+       width: 25%;
+       margin: 0;
 }
 
 tr.image-size label {
        display: inline;
 }
 
 tr.image-size label {
        display: inline;
-       margin: 0 1em 0 0;
+       margin: 0 0 0 1em;
 }
 }
+
 .pinkynail {
        max-width: 40px;
        max-height: 40px;
 .pinkynail {
        max-width: 40px;
        max-height: 40px;
@@ -95,38 +107,49 @@ tr.image-size label {
 .filename.original {
        float: left;
 }
 .filename.original {
        float: left;
 }
+
 .crunching {
        display: block;
        line-height: 32px;
        text-align: right;
        margin-right: 5px;
 }
 .crunching {
        display: block;
        line-height: 32px;
        text-align: right;
        margin-right: 5px;
 }
+
 button.dismiss {
        position: absolute;
 button.dismiss {
        position: absolute;
-       top: 5px;
+       top: 7px;
        right: 5px;
        z-index: 4;
        right: 5px;
        z-index: 4;
+       width: 8em;
 }
 }
+
 .file-error {
 .file-error {
-       margin: 0 0 5px 50px;
+       float: left;
        font-weight: bold;
        font-weight: bold;
+       padding: 10px;
 }
 
 .progress {
        position: absolute;
 }
 
 .progress {
        position: absolute;
-       top: 0px;
-       left: 0px;
+       top: 0;
+       left: 0;
        width: 623px;
        height: 36px;
 }
        width: 623px;
        height: 36px;
 }
+
 .bar {
 .bar {
-       width: 0px;
+       width: 0;
        height: 100%;
        border-right-width: 3px;
        border-right-style: solid;
 }
 
        height: 100%;
        border-right-width: 3px;
        border-right-style: solid;
 }
 
-#library-form .progress, #gallery-form .progress {
+#library-form .progress,
+#gallery-form .progress,
+#flash-upload-ui,
+.insert-gallery,
+.describe.startopen,
+.describe.startclosed {
        display: none;
 }
 
        display: none;
 }
 
@@ -134,6 +157,7 @@ button.dismiss {
        max-width: 128px;
        max-height: 128px;
 }
        max-width: 128px;
        max-height: 128px;
 }
+
 .media-item .pinkynail {
        float: left;
        margin: 2px;
 .media-item .pinkynail {
        float: left;
        margin: 2px;
@@ -144,7 +168,9 @@ button.dismiss {
 thead.media-item-info tr {
        background-color: transparent;
 }
 thead.media-item-info tr {
        background-color: transparent;
 }
-thead.media-item-info th, thead.media-item-info td {
+
+thead.media-item-info th,
+thead.media-item-info td {
        border: none;
        margin: 0;
 }
        border: none;
        margin: 0;
 }
@@ -153,41 +179,46 @@ thead.media-item-info th, thead.media-item-info td {
        border: 8px solid #fff;
 }
 
        border: 8px solid #fff;
 }
 
-.describe.startopen, .describe.startclosed {
-       display: none;
-}
 abbr.required {
        text-decoration: none;
        border: none;
 }
 abbr.required {
        text-decoration: none;
        border: none;
 }
+
 .describe label {
        display: inline;
 }
 .describe label {
        display: inline;
 }
+
 .describe td {
        vertical-align: middle;
 .describe td {
        vertical-align: middle;
+       padding: 0 5px 0 0;
 }
 }
+
 .describe td.A1 {
        width: 132px;
 }
 .describe td.A1 {
        width: 132px;
 }
-.describe input[type="text"], .describe textarea {
+
+.describe input[type="text"],
+.describe textarea {
        width: 460px;
        width: 460px;
+       border-width: 1px;
+       border-style: solid;
 }
 }
-.describe-toggle-on, .describe-toggle-off {
+
+.describe-toggle-on,
+.describe-toggle-off {
        display: block;
        line-height: 36px;
        float: right;
        margin-right: 20px;
 }
        display: block;
        line-height: 36px;
        float: right;
        margin-right: 20px;
 }
+
 .describe-toggle-off {
        display: none;
 }
 
 .describe-toggle-off {
        display: none;
 }
 
-.clickmask {
-}
-
 .hidden {
 .hidden {
-       height: 0px;
-       width: 0px;
+       height: 0;
+       width: 0;
        overflow: hidden;
        border: none;
 }
        overflow: hidden;
        border: none;
 }
@@ -202,13 +233,17 @@ abbr.required {
        padding: 1em 0;
 }
 
        padding: 1em 0;
 }
 
-#media-upload p.help {
+#media-upload p.help,
+#media-upload label.help {
+       font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
        font-style: italic;
        font-weight: normal;
 }
        font-style: italic;
        font-weight: normal;
 }
+
 #media-upload tr.image-size td.field {
        text-align: center;
 }
 #media-upload tr.image-size td.field {
        text-align: center;
 }
+
 #media-upload #media-items {
        border-width: 1px;
        border-style: solid;
 #media-upload #media-items {
        border-width: 1px;
        border-style: solid;
@@ -235,21 +270,29 @@ abbr.required {
        overflow: hidden;
        max-width: 430px;
 }
        overflow: hidden;
        max-width: 430px;
 }
+
 #media-upload .describe {
 #media-upload .describe {
-       border-top-width: 1px;
-       border-top-style: solid;
        padding: 5px;
        width: 100%;
        clear: both;
        cursor: default;
 }
        padding: 5px;
        width: 100%;
        clear: both;
        cursor: default;
 }
+
+#media-upload .slidetoggle {
+       border-top-width: 1px;
+       border-top-style: solid;
+}
+
 #media-upload .describe th.label {
        padding-top: .5em;
        text-align: left;
 #media-upload .describe th.label {
        padding-top: .5em;
        text-align: left;
+       min-width: 120px;
 }
 }
+
 #media-upload tr.align td.field {
        text-align: center;
 }
 #media-upload tr.align td.field {
        text-align: center;
 }
+
 #media-upload tr.image-size {
        margin-bottom: 1em;
        height: 3em;
 #media-upload tr.image-size {
        margin-bottom: 1em;
        height: 3em;
@@ -264,10 +307,11 @@ abbr.required {
 }
 
 #filter .tablenav select {
 }
 
 #filter .tablenav select {
-       border-style:solid;
-       border-width:1px;
-       padding:2px;
-       vertical-align:top;
+       border-style: solid;
+       border-width: 1px;
+       padding: 2px;
+       vertical-align: top;
+       width: auto;
 }
 
 #media-upload a.delete,
 }
 
 #media-upload a.delete,
@@ -287,7 +331,7 @@ abbr.required {
 }
 
 .menu_order_input {
 }
 
 .menu_order_input {
-       border: 1px solid #DDDDDD;
+       border: 1px solid #ddd;
        font-size: 10px;
        padding: 1px;
        width: 23px;
        font-size: 10px;
        padding: 1px;
        width: 23px;
@@ -301,8 +345,8 @@ abbr.required {
 }
 
 #media-upload th.order-head {
 }
 
 #media-upload th.order-head {
-        width: 25%;
-        text-align: center;
+       width: 25%;
+       text-align: center;
 }
 
 #media-upload .widefat {
 }
 
 #media-upload .widefat {
@@ -313,3 +357,70 @@ abbr.required {
 .sorthelper {
        z-index: -1;
 }
 .sorthelper {
        z-index: -1;
 }
+
+#gallery-settings th.label {
+       width: 160px;
+}
+
+#gallery-settings #basic th.label {
+       padding: 5px 5px 5px 0;
+}
+
+#gallery-settings .title {
+       clear: both;
+       padding: 0 0 3px;
+       border-bottom-style: solid;
+       border-bottom-width: 1px;
+       font-family: Georgia,"Times New Roman",Times,serif;
+       font-size: 1.6em;
+       border-bottom-color: #DADADA;
+       color: #5A5A5A;
+}
+
+h3.media-title  {
+       color: #5A5A5A;
+       font-family: Georgia,"Times New Roman",Times,serif;
+       font-size: 1.6em;
+       font-weight: normal;
+}
+
+#gallery-settings .describe td {
+       vertical-align: middle;
+       height: 3.5em;
+}
+
+#gallery-settings .describe th.label {
+       padding-top: .5em;
+       text-align: left;
+}
+
+#gallery-settings .describe {
+       padding: 5px;
+       width: 615px;
+       clear: both;
+       cursor: default;
+}
+
+#gallery-settings .describe select {
+       width: 15em;
+       border: 1px solid #dfdfdf;
+}
+
+#gallery-settings label,
+#gallery-settings legend {
+       font-size: 13px;
+       color: #464646;
+       margin-right: 15px;
+}
+
+#gallery-settings .align .field label {
+       margin: 0 1.5em 0 0;
+}
+
+#gallery-settings p.ml-submit {
+       border-top: 1px solid #dfdfdf;
+}
+
+#gallery-settings select#columns {
+       width: 6em;
+}
diff --git a/wp-admin/css/plugin-install-rtl.css b/wp-admin/css/plugin-install-rtl.css
new file mode 100644 (file)
index 0000000..9a6dd11
--- /dev/null
@@ -0,0 +1,43 @@
+div.star {
+       left: auto;
+       right: 0;
+       letter-spacing: 0;
+}
+.star img, div.star a, div.star a:hover, div.star a:visited {
+       right: auto;
+       left: 0;
+}
+#plugin-information ul#sidemenu {
+       left: auto;
+       right: 0;
+}
+#plugin-information h2 {
+       margin-right: 0;
+       margin-left: 200px;
+}
+#plugin-information .fyi {
+       margin-left: 5px;
+       margin-right: 20px;
+}
+#plugin-information .fyi h2 {
+       margin-left: 0;
+}
+#plugin-information .fyi ul {
+       padding: 10px 7px 10px 5px;
+}
+#plugin-information #section-screenshots li p {
+       padding-left: 0;
+       padding-right: 20px;
+}
+#plugin-information .updated,
+#plugin-information pre {
+       margin-right: 0;
+       margin-left: 215px;
+}
+#plugin-information .updated, #plugin-information .error {
+       clear: none;
+       direction: rtl;
+}
+#section-description {
+       direction: ltr;
+}
diff --git a/wp-admin/css/plugin-install.css b/wp-admin/css/plugin-install.css
new file mode 100644 (file)
index 0000000..2441840
--- /dev/null
@@ -0,0 +1,149 @@
+/* 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;
+}
+
+/* Start custom CSS */
+/* Header on thickbox */
+#plugin-information-header {
+       margin: 0;
+       padding: 0 5px;
+       font-weight: bold;
+       position: relative;
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+       height: 2.5em;
+}
+#plugin-information ul#sidemenu {
+       font-weight: normal;
+       margin: 0 5px;
+       position: absolute;
+       left: 0;
+       bottom: -1px;
+}
+
+/* Install sidemenu */
+#plugin-information p.action-button {
+       width: 100%;
+       padding-bottom: 0;
+       margin-bottom: 0;
+       margin-top: 10px;
+       -moz-border-radius: 3px 0 0 3px;
+       -webkit-border-top-left-radius: 3px;
+       -khtml-border-top-left-radius: 3px;
+       border-top-left-radius: 3px;
+       -webkit-border-bottom-left-radius: 3px;
+       -khtml-border-bottom-left-radius: 3px;
+       border-top-bottom-radius: 3px;
+}
+
+#plugin-information .action-button a {
+       text-align: center;
+       font-weight: bold;
+       text-decoration: none;
+       display: block;
+       line-height: 2em;
+}
+
+#plugin-information h2 {
+       clear: none !important;
+       margin-right: 200px;
+}
+
+#plugin-information .fyi {
+       margin-left: 10px;
+       margin-bottom: 50px;
+       width: 210px;
+}
+
+#plugin-information .fyi h2 {
+       font-size: 0.9em;
+       margin-bottom: 0;
+       margin-right: 0;
+}
+
+#plugin-information .fyi h2.mainheader {
+       padding: 5px;
+       -moz-border-radius-topleft: 3px;
+       -webkit-border-top-left-radius: 3px;
+       -khtml-border-top-left-radius: 3px;
+       border-top-left-radius: 3px;
+}
+
+#plugin-information .fyi ul {
+       padding: 10px 5px 10px 7px;
+       margin: 0;
+       list-style: none;
+       -moz-border-radius-bottomleft: 3px;
+       -webkit-border-bottom-left-radius: 3px;
+       -khtml-border-bottom-left-radius: 3px;
+       border-top-bottom-radius: 3px;
+}
+
+#plugin-information .fyi li {
+       margin-right: 0;
+}
+
+#plugin-information #section-holder {
+       padding: 10px;
+}
+
+#plugin-information .section ul,
+#plugin-information .section ol {
+       margin-left: 16px;
+       list-style-type: square;
+       list-style-image: none;
+}
+
+#plugin-information #section-screenshots li img {
+       vertical-align: text-top;
+}
+
+#plugin-information #section-screenshots li p {
+       font-style: italic;
+       padding-left: 20px;
+       padding-bottom: 2em;
+}
+
+#plugin-information .updated,
+#plugin-information pre {
+       margin-right: 215px;
+}
+
+#plugin-information pre {
+       padding: 7px;
+}
\ No newline at end of file
diff --git a/wp-admin/css/press-this-ie-rtl.css b/wp-admin/css/press-this-ie-rtl.css
deleted file mode 100644 (file)
index 912e0e2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-.ui-tabs-nav {
-       margin-right: 0;
-}
diff --git a/wp-admin/css/press-this-ie.css b/wp-admin/css/press-this-ie.css
deleted file mode 100644 (file)
index e9667c1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#posting {
-       position: static !important;
-}
- .ui-tabs-nav {
-       margin-left: 0;
-       border: 0 !important;
-}
index f75d7ec4a4bedf2dcf46e01bffdc0ba731af1d00..b15e8455521fbabf01a4bf7039693c584a9e6eaa 100644 (file)
 body {
 body {
-       font-family: Tahoma;
+       font-family: Tahoma, Arial;
 }
 }
-.ui-tabs-nav {
-       padding-left:0;
-       padding-right:8px;
-}
-.ui-tabs-nav li {
+#poststuff #edButtonPreview,
+#poststuff #edButtonHTML {
+       margin: 0px 0 0 5px;
        float: right;
 }
        float: right;
 }
-.button {
-       font-family: Tahoma;
-       margin-left:0;
-       margin-right: 5px;
+/* Editor/Main Column */
+div#poststuff {
+       padding-left: 0;
+       padding-right: 10px;
 }
 }
-#wphead #viewsite {
-       margin-left:0;
-       margin-right: 10px;
+.posting {
+       margin-right: 0;
+       margin-left: 228px;
+       left:auto;
+       right: 0;
 }
 }
-#viewsite {
-       right:auto;
-       left: 8px;
+#side-info-column {
+       float: left;
+       right: auto;
+       left: 0;
+       margin-right: 0;
+       margin-left: 10px;
 }
 }
-#wphead #viewsite a {
-       font-family: Tahoma;
+#side-info-column .sleeve {
+       padding-left: 0;
+       padding-right: 10px;
 }
 }
-h1 {
-       right:auto;
-       left:0;
+h3.tb {
+       margin-left: 0;
+       margin-right: 5px;
 }
 }
-div#posting {
-       padding-left:0;
-       padding-right: 16px;
+#actions {
+       float: left;
 }
 }
-#photo_directions span {
-       right:auto;
-       left:3px;
+#extra_fields #actions {
+       right: auto;
+       left: 4px;
 }
 }
-#img_container a {
-       float:right;
+#actions li {
+       float: right;
+       margin-right: 0;
+       margin-left: 10px;
+}
+#extra_fields .button {
+       margin-right: 0;
+       margin-left: 5px;
 }
 }
-#img_container a, #img_container a:link, #img_container a:visited {
-       margin:0 0 4px 4px;
+/* Photo Styles */
+#img_container a {
+       float: right;
 }
 }
-div#categories {
-       right:auto;
-       left:16px;
+#category-add input, #category-add select {
+       font-family: Tahoma, Arial;
 }
 }
-div#categories h2 {
-       margin: .5em 1em .5em 0;
+#categorydiv ul.categorychecklist ul {
+       margin-left: 0;
+       margin-right: 18px;
 }
 }
+/* Tags */
 #tagsdiv #newtag {
 #tagsdiv #newtag {
-       margin-right:0; 
-       margin-left: 5px;       
-}
-#jaxtag {
-       padding-left:0;
-       padding-right: 1em;
+       margin-right: 0;
+       margin-left: 5px;
 }
 }
-#tagchecklist {
-       padding-left:0;
-       padding-right: 1em;
+#tagadd {
+       margin-left: 0;
+       margin-right: 3px;
 }
 #tagchecklist span {
 }
 #tagchecklist span {
-       margin-right: 10px;
        margin-left: .5em;
        margin-left: .5em;
+       margin-right: 10px;
        float: right;
 }
 #tagchecklist span a {
        float: right;
 }
 #tagchecklist span a {
-       margin: 6px -9px 0pt 0;
+       margin: 6px -9px 0 0;
        float: right;
 }
        float: right;
 }
-.submitbox {
-       float: left;
-}
-.submitbox .submit input {
-       text-align:right;
+#content {
+       margin-left: 0;
+       margin-right: 1%;
 }
 }
-.video_split #extra_fields {
-       float:right;
-}
-.video_split .editor_area {
-       float: left;
+.submit input,
+.button,
+.button-primary,
+.button-secondary,
+.button-highlighted,
+#postcustomstuff .submit input {
+       font-family: tahoma;
 }
 .ac_results li {
 }
 .ac_results li {
-       text-align:right;
+       text-align: right;
 }
 #TB_ajaxContent #options {
 }
 #TB_ajaxContent #options {
-       right:auto;
-       left:25px;
+       right: auto;
+       left: 25px;
 }
 #post_status {
 }
 #post_status {
-       margin-left:0;
+       margin-left: 0;
        margin-right: 10px;
 }
        margin-right: 10px;
 }
+/* Footer */
 #footer {
        padding: 10px 60px 0 0;
 }
 #footer {
        padding: 10px 60px 0 0;
 }
index daf60bafe6cd66b4a7dfbb666ff9b9d59633617e..6a4fbc1cb01dbd8cffd10553dcd136a1cc68b741 100644 (file)
 body {
 body {
-       font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       font: 13px "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
        color: #333;
        color: #333;
-       margin: 0px;
-       padding: 0px;
+       margin: 0;
+       padding: 0;
 }
 
 }
 
-img { border: 0; }
-/* Tabs */
-@media projection , screen {
-       .ui-tabs-hide {
-               display: none;
-       }
+img {
+       border: none;
 }
 
 }
 
-@media print {
-       .ui-tabs-nav {
-               display: none;
-       }
+/* Header */
+#wphead {
+       border-top: none;
+       padding-top: 4px;
+       background: #444 !important;
 }
 
 }
 
-.ui-tabs-nav {
-       list-style: none;
-       border-bottom: 1px solid #C6D9E9;
-       padding-left: 8px;
-       margin-bottom: .5em;
-       margin-top: -2em;
+#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;
+       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;
+       font-size: 10px;
+       line-height: 18px;
+       float: left;
 }
 
 }
 
-/* Additional IE specific bug fixes... */
-* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
-       display: inline-block;
+.howto {
+       margin-top: 2px;
+       margin-bottom: 3px;
+       font-size: 11px;
+       font-style: italic;
+       display: block;
 }
 
 }
 
-* :first-child+html .ui-tabs-nav {
-       /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
-       display: inline-block;
+input.text {
+       outline-color: -moz-use-text-color;
+       outline-style: none;
+       outline-width: medium;
+       width: 100%;
 }
 
 }
 
-.ui-tabs-nav:after {
-       /* clearing without presentational markup, IE gets extra treatment */
-       display: block;
-       clear: both;
-       content: " ";
+#message {
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
 }
 
 }
 
-.ui-tabs-nav li {
-       float: left;
-       margin: 0;
-       height: 2em;
-       line-height: 2em;
+/* Editor/Main Column */
+div#poststuff {
+       padding-left: 10px;
+       margin-top: 10px;
 }
 
 }
 
-.ui-tabs-nav a,.ui-tabs-nav a span {
-       display: block;
+div.zerosize {
+       border: 0 none;
+       height: 0;
+       margin: 0;
+       overflow: hidden;
+       padding: 0;
+       position: absolute;
+       width: 0;
 }
 
 }
 
-.ui-tabs-nav a {
-       margin: 1px 0 0;
-       /* position: relative makes opacity fail for disabled tab in IE */
-       padding-left: 0;
-       color: #27537a;
-       font-weight: bold;
-       line-height: 2em;
-       text-align: center;
-       text-decoration: none;
-       white-space: nowrap; /* required in IE 6 */
-       outline: 0; /* prevent dotted border in Firefox */
-       padding: 0 1em;
+#poststuff #edButtonPreview.active,
+#poststuff #edButtonHTML.active {
+       display: none;
 }
 
 }
 
-.ui-tabs-nav .ui-tabs-selected a {
+.posting {
+       margin-right: 228px;
        position: relative;
        position: relative;
-       top: 1px;
-       z-index: 2;
-       margin-top: 0;
-       -moz-border-radius-topleft: 4px;
-       -moz-border-radius-topright: 4px;
-       -webkit-border-top-left-radius: 4px;
-       -webkit-border-top-right-radius: 4px;
-       border-style: solid;
-       border-width: 1px;
-       background: white;
-       border-bottom-width: 2px;
-       margin-top: -2px;
+       left: 0;
 }
 
 }
 
-.ui-tabs-nav a:hover,.ui-tabs-nav a:focus,.ui-tabs-nav a:active,
-.ui-tabs-nav .ui-tabs-selected a:link,.ui-tabs-nav .ui-tabs-selected a:visited { 
-       cursor: pointer;
+#side-info-column {
+       float: right;
+       width: 218px;
+       position: absolute;
+       right: 0;
+       margin-right: 10px;
 }
 
 }
 
-/* Header */
-#wphead {
-       border-top: none;
-       height: 2em;
-       padding-top: 8px;
+#side-info-column .sleeve {
+       padding-left: 10px;
 }
 
 }
 
-.button {
-       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 3px 5px;
-       font-size: 12px;
-       line-height: 1.5em;
-       border-width: 1px;
-       border-style: solid;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       cursor: pointer;
-       margin-left: 5px;
-       text-decoration: none;
+#poststuff .inside {
+       font-size: 11px;
+       margin: 0 12px 12px;
 }
 
 }
 
-.howto {
-       font-size: 11px;
-       font-style: italic;
-       display: block;
+#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;
+       text-shadow: 0 1px 0 #FFFFFF;
 }
 
 }
 
-#wphead #viewsite {
-       position: absolute;
-       margin-top: 12px;
-       margin-left: 10px;
+h3.tb {
+       text-shadow: 0 1px 0 #FFFFFF;
+       font-weight: bold;
+       font-size: 12px;
+       margin-left: 5px;
 }
 
 }
 
-#viewsite {
-       position: relative;
-       right: 8px;
-       top: 6px;
-       margin: 0 !important;
+#TB_window {
+       border: 1px solid #333;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
 }
 
 }
 
-#wphead #viewsite a {
-       font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 3px 4px;
-       display: block;
-       letter-spacing: normal;
+.metabox-holder .postbox,
+.postbox,
+.stuffbox {
+       margin-bottom: 10px;
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       text-decoration: none;
+       line-height: 1;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
+       border-color: #DFDFDF;
 }
 
 }
 
-#previewview {
-       padding-top: 8px !important;
-       padding-bottom: 8px !important;
-}
-
-h1 {
-       font-size: .75em;
-       line-height: 2.666em;
-       top: .5em;
-       right: 0;
-       margin: 0 !important;
-       padding: 0 !important;
-       width: 236px;
-       background: none;
+.titlediv {
+       border-color: #DFDFDF;
 }
 
 }
 
-input.text {
-       border: 0pt none;
-       outline-color: -moz-use-text-color;
-       outline-style: none;
-       outline-width: medium;
-       padding: 0pt;
-       width: 100%;
+#title, .tbtitle {
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
        border-style: solid;
        border-style: solid;
-       color: #333333;
-}
-
-/* Editor/Main Column */
-
-div#container {
-       margin: 0;
-       min-width: 500px;
+       border-width: 1px;
+       font-size: 1.7em;
+       outline: none;
+       padding: 3px 4px;
+       border-color: #DFDFDF;
 }
 
 }
 
-div#container form {
-       margin: 0px;
-       padding: 0px;
+.tbtitle {
+       font-size: 12px;
+       padding: 3px;
 }
 
 }
 
-div#posting {
-       padding-left: 16px;
-       position: absolute;
-       z-index: 1;
-       width: 66%;
+#title {
+       width: 98%;
 }
 
 }
 
-#post_title {
-       width: 99%;
+.postbox h2 {
+       background-image: url(../images/postbox-bg.gif);
+       background-position: left top;
+       background-repeat: repeat-x;
+       background-color: #DFDFDF;
 }
 
 }
 
-.titlewrap {
+.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-style: solid;
        border-width: 1px;
-       padding: 2px 3px;
-       border-color: #CCCCCC;
+       border-color: #DFDFDF;
 }
 
 }
 
-div#posting h2 {
-       margin: .5em 0 .25em 0;
-       font-size: 12px;
-       padding: 3px;
-       background: ;
+.postdivrich {
+       position: relative;
+       padding-top: 25px;
 }
 
 }
 
-.editor-container {
-       border-width: 1px;
-       border-color: #ccc;
-       border-style: solid;
-       margin-bottom: 1em;
+#actions {
+       clear: both;
+       float: right;
+       margin-top: -19px;
+       position: relative;
+}
+#extra_fields #actions {
+       clear: both;
+       position: absolute;
+       right: 4px;
+       top: 6px;
+       margin: 0;
 }
 
 }
 
-/* Photo Styles */
-
-#photo_directions {
-       margin-top: .25em;
-       display: block;
-       position: relative;
+#actions li {
+       float: left;
+       list-style: none;
+       margin-right: 10px;
+}
+#extra_fields .button {
+       margin-right: 5px;
 }
 
 }
 
-#photo_directions span {
-       display: block;
-       position: absolute;
-       top: 0;
-       right: 3px;
+/* Photo Styles */
+.photolist {
+       margin-top: -10px;
 }
 
 #photo_saving {
 }
 
 #photo_saving {
@@ -239,77 +242,162 @@ div#posting h2 {
 
 #img_container {
        background-color: #fff;
 
 #img_container {
        background-color: #fff;
+       height: 101px;
+       width: 100%;
+}
+
+#extra_fields {
+       margin-top: 10px;
+       position: relative;
+}
+
+#extra_fields .postbox {
+       margin-bottom: 5px;
+}
+
+#extra_fields .titlewrap {
+       padding: 0;
        overflow: auto;
        height: 100px;
 }
 
        overflow: auto;
        height: 100px;
 }
 
+#img_container {
+       position: relative;
+}
+
 #img_container a {
        display: block;
 #img_container a {
        display: block;
-       width: 79px;
-       height: 79px;
        float: left;
        float: left;
+       overflow: hidden;
+       vertical-align: center;
+}
+
+#img_container img, #img_container a {
+       width: 68px;
+       height: 68px;
 }
 
 #img_container img {
 }
 
 #img_container img {
-       width: 75px;
-       height: 75px;
-       border: 0px;
-       padding: 2px;
+       width: 68px;
+       height: 68px;
+       border: none;
        background-color: #f4f4f4;
        cursor: pointer;
 }
        background-color: #f4f4f4;
        cursor: pointer;
 }
-#img_container a, #img_container a:link, #img_container a:visited {
-       border: 2px solid #ccc;
-       margin: 0 4px 4px 0;
-} 
-#img_container a:hover, #img_container a:active {
-       border: 2px solid #000;
+
+#img_container a,
+#img_container a:link,
+#img_container a:visited {
+       border: 1px solid #ccc;
+       display: block;
+       position: relative;
+}
+
+#img_container a:hover,
+#img_container a:active {
+       border-color: #000;
+       z-index: 1000;
+       border-width: 2px;
+       margin: -1px;
+}
+
+/* Video */
+#embed-code {
+       width: 100%;
+       height: 98px;
 }
 
 /* Submit Column */
 }
 
 /* Submit Column */
+#viewsite {
+       padding: 0;
+       margin: 0 0 20px 0;
+       font-size: 10px;
+       clear: both;
+}
 
 
-div#categories {
-       font-size: 85%;
-       position: absolute;
-       top: 50px;
-       right: 16px;
-       width: 27%;
-       z-index: 2;
+#viewsite .button {
+       margin: 0 0 0px 0;
+       display: block;
 }
 
 }
 
-div#categories h2 {
-       color: #333;
+.wp-hidden-children .wp-hidden-child {
+       display: none;
+}
+
+#category-adder {
+       padding: 4px 0;
+}
+
+#category-adder h4 {
+       margin: 0 0 8px;
+}
+
+#category-add input {
+       width: 94%;
+       font-family: Verdana, Arial, Helvetica, sans-serif;
+       font-size: 13px;
+       margin: 1px;
+       padding: 3px;
+}
+
+#category-add select {
+       width: 70%;
+       -x-system-font: none;
+       border-style: solid;
+       border-width: 1px;
+       font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
        font-size: 12px;
        font-size: 12px;
-       margin: .5em 0 .5em 1em;
-       padding: 0;
+       height: 2em;
+       line-height: 20px;
+       padding: 2px;
+       margin: 1px;
+       vertical-align: top;
 }
 
 }
 
-#categories-all {
-       overflow: auto;
-       padding: 0 1em 1em 1em;
-       height: 15em;
+#category-add input#category-add-sumbit {
+       width: auto;
 }
 
 }
 
-#categories ul {
+/* Categories */
+#categorydiv ul, #linkcategorydiv ul {
        list-style: none;
        padding: 0;
        margin: 0;
 }
 
        list-style: none;
        padding: 0;
        margin: 0;
 }
 
+#categorydiv ul.categorychecklist ul {
+       margin-left: 18px;
+}
+
+#categorydiv div.ui-tabs-panel {
+       height: 150px;
+       overflow: auto;
+}
+
+ul.categorychecklist li {
+       margin: 0;
+       padding: 0;
+       line-height: 19px;
+}
+
+/* Tags */
 #tagsdiv #newtag {
        padding: 3px;
        margin-right: 5px;
 #tagsdiv #newtag {
        padding: 3px;
        margin-right: 5px;
-       width: 16em;    
+       width: 16em;
 }
 
 #jaxtag {
        clear: both;
 }
 
 #jaxtag {
        clear: both;
-       padding-left: 1em;
        margin: 0;
 }
 
        margin: 0;
 }
 
+#tagadd {
+       margin-left: 3px;
+}
+
 #tagchecklist {
 #tagchecklist {
-       padding-left: 1em;
+       margin-top: 3px;
        margin-bottom: 1em;
        font-size: 12px;
        overflow: auto;
        margin-bottom: 1em;
        font-size: 12px;
        overflow: auto;
@@ -332,7 +420,7 @@ div#categories h2 {
 }
 
 #tagchecklist span a {
 }
 
 #tagchecklist span a {
-       margin: 6px 0pt 0pt -9px;
+       margin: 6px 0 0 -9px;
        cursor: pointer;
        width: 10px;
        height: 10px;
        cursor: pointer;
        width: 10px;
        height: 10px;
@@ -342,68 +430,44 @@ div#categories h2 {
        overflow: hidden;
        position: absolute;
 }
        overflow: hidden;
        position: absolute;
 }
-.submit {
-       -moz-border-radius-bottomleft: 3px;
-       -khtml-border-bottom-left-radius: 3px;
-       -webkit-border-bottom-left-radius: 3px;
-       border-bottom-left-radius: 3px;
-       -moz-border-radius-bottomright: 3px;
-       -khtml-border-bottom-right-radius: 3px;
-       -webkit-border-bottom-right-radius: 3px;
-       border-bottom-right-radius: 3px;
-       margin: 0;
-       padding: 10px;
-}
-.submitbox {
-       width: 100%;
-       float: right;
-}
 
 
-.submitbox .submit a:hover {
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+#content {
+       width: 96% !important;
+       margin-left: 1%;
+       margin-bottom: 10px;
+       border: 1px solid #f1f1f1;
 }
 
 }
 
-.submitbox .submit input {
-       border: none;
-       text-align: left;
-       padding: 6px 4px;
-       font-size: 12px;
-       margin: 2px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       cursor: pointer;
-}
+/* Submit */
 
 
-.submitbox #previewview {
-       padding: 15px 10px;
-       -moz-border-radius-topleft: 3px;
-       -khtml-border-top-left-radius: 3px;
-       -webkit-border-top-left-radius: 3px;
-       border-top-left-radius: 3px;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-top-right-radius: 3px;
-       -webkit-border-top-right-radius: 3px;
-       border-top-right-radius: 3px;
+#saving {
+       display: inline;
 }
 
 }
 
-/* Video Styles */
-.video_split #extra_fields {
-       width: 27%;
-       height: 300px;
-       float: left;
+.submit input,
+.button,
+.button-primary,
+.button-secondary,
+.button-highlighted,
+#postcustomstuff .submit input {
+       font-family: "Lucida Grande", "Bitstream Vera Sans", Verdana, Arial, sans-serif;
+       text-decoration: none;
+       font-size: 11px !important;
+       line-height: 16px;
+       padding: 2px 8px;
+       cursor: pointer;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 11px;
+       -khtml-border-radius: 11px;
+       -webkit-border-radius: 11px;
+       border-radius: 11px;
 }
 
 }
 
-#embed_code {
-       border: 0;
-       width: 99%;
-       height: 200px;
-}
-.video_split .editor_area {
-       width: 70%;
-       float: right;
+.button-primary {
+       background: #21759B url(../images/button-grad.png) repeat-x scroll left top;
+       border-color: #21759B;
+       color: #FFFFFF;
 }
 
 .ac_results {
 }
 
 .ac_results {
@@ -431,45 +495,32 @@ div#categories h2 {
        text-decoration: underline;
 }
 
        text-decoration: underline;
 }
 
-.photolist {
-       display: none;
-}
-
-#extra_fields small {
-       display: block;
-       margin-top: .5em;
-       padding-bottom: .25em;
-}
-
 #TB_ajaxContent #options {
        position: absolute;
        top: 20px;
        right: 25px;
        padding: 5px;
 }
 #TB_ajaxContent #options {
        position: absolute;
        top: 20px;
        right: 25px;
        padding: 5px;
 }
+
 #TB_ajaxContent h3 {
        margin-bottom: .25em;
 }
 
 .updated {
 #TB_ajaxContent h3 {
        margin-bottom: .25em;
 }
 
 .updated {
-       margin: 0;
-       margin-left: 15px;
-       margin-right: 15px;
+       margin: 10px 0;
        padding: 0;
        padding: 0;
-       max-width: 980px;
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
-       padding: 0 0.6em;
-       max-width: 950px;
-       margin-top: 1em;
-       margin-bottom: 1em;
+       width: 99%;
 }
 
 }
 
-.updated p, .error p {
+.updated p,
+.error p {
        margin: 0.6em 0;
        margin: 0.6em 0;
+       padding: 0 0.6em;
 }
 
 }
 
-.updated a, .error a {
+.error a {
        text-decoration: underline;
 }
 
        text-decoration: underline;
 }
 
@@ -485,7 +536,6 @@ div#categories h2 {
 }
 
 /* Footer */
 }
 
 /* Footer */
-
 #footer {
        height: 65px;
        display: block;
 #footer {
        height: 65px;
        display: block;
@@ -505,12 +555,10 @@ div#categories h2 {
 #footer p a {
        text-decoration: none;
 }
 #footer p a {
        text-decoration: none;
 }
-
 #footer p a:hover {
        text-decoration: underline;
 }
 
 #footer p a:hover {
        text-decoration: underline;
 }
 
-
 /* Utility Classes */
 .centered {
        text-align: center;
 /* Utility Classes */
 .centered {
        text-align: center;
@@ -518,4 +566,4 @@ div#categories h2 {
 
 .hidden {
        display: none;
 
 .hidden {
        display: none;
-}
\ No newline at end of file
+}
index 7b9f31bb2b20a1fb823abe42862a9eecb8ebe331..d06a26c0003ce7d456a8e463df0d6aed93bdd615 100644 (file)
@@ -1,15 +1,12 @@
-#template textarea {
-       font-family:monospace;
-}
 #templateside {
 #templateside {
-       float:left;
+       float: left;
 }
 #themeselector {
 }
 #themeselector {
-       padding-right:0;
+       padding-right: 0;
        padding-left: 5px;
        float: left;
 }
 div.tablenav {
        padding-left: 5px;
        float: left;
 }
 div.tablenav {
-       margin-right:0;
+       margin-right: 0;
        margin-left: 210px;
 }
        margin-left: 210px;
 }
index 2c59e97b8b472331229aa99329b0f3d749839424..486f5c1925e1d70328eada934118748bb9cdcdd1 100644 (file)
@@ -1,5 +1,5 @@
 #template textarea {
 #template textarea {
-       font-family: 'Courier New', Courier, monospace;
+       font-family: Consolas, Monaco, Courier, monospace;
        font-size: 12px;
        width: 97%;
 }
        font-size: 12px;
        width: 97%;
 }
@@ -11,7 +11,6 @@
 #templateside {
        float: right;
        width: 190px;
 #templateside {
        float: right;
        width: 190px;
-       margin-top:-3.4em;
 }
 
 #templateside h3, #postcustomstuff p.submit {
 }
 
 #templateside h3, #postcustomstuff p.submit {
@@ -23,7 +22,7 @@ h3#bordertitle {
 }
 
 #templateside h4 {
 }
 
 #templateside h4 {
-       margin-bottom: 0px;
+       margin-bottom: 0;
 }
 
 #templateside ol, #templateside ul {
 }
 
 #templateside ol, #templateside ul {
@@ -33,7 +32,7 @@ h3#bordertitle {
 }
 
 #templateside ol li, #templateside ul li {
 }
 
 #templateside ol li, #templateside ul li {
-       margin: 1px 0px;
+       margin: 1px 0;
 }
 
 #themeselector {
 }
 
 #themeselector {
@@ -41,6 +40,7 @@ h3#bordertitle {
        float: right;
        position: relative;
        bottom: 25px;
        float: right;
        position: relative;
        bottom: 25px;
+       top:20px;
 }
 
 #themeselector select {
 }
 
 #themeselector select {
@@ -58,7 +58,7 @@ h3#bordertitle {
 
 div.bordertitle h2 {
        border: none;
 
 div.bordertitle h2 {
        border: none;
-       padding-bottom: 0px;
+       padding-bottom: 0;
 }
 
 div.tablenav {
 }
 
 div.tablenav {
diff --git a/wp-admin/css/upload-rtl.css b/wp-admin/css/upload-rtl.css
deleted file mode 100644 (file)
index dc13a4b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-html {
-       direction: ltr;
-       }
-#uploadoptions, table {
-       direction: rtl;
-       }
-td {
-       padding: 1px 6px 0;
-       }
-.submit {
-       text-align: left;
-       }
\ No newline at end of file
index 70838cd41aeba9fbadff68fe7afd50ef7942de24..8d0fc3aae2eaff40dd1265c8217b394f40f5c2ea 100644 (file)
@@ -1,45 +1,27 @@
-/* 2 column liquid layout */
-div.widget-liquid-left-holder {
-       float: right;
-       clear: right;
-       margin-right:0;
-       margin-left: -310px;
-}
-div.widget-liquid-left {
-       margin-right:0;
-       margin-left: 320px;
-}
-div.widget-liquid-right {
-       float: left;
-       clear: left;
-}
-p#widget-search {
-       right:auto;
-       left:0;
-}
 h4.widget-title span {
        float: right;
 }
 h4.widget-title a {
        float: left;
 h4.widget-title span {
        float: right;
 }
 h4.widget-title a {
        float: left;
-       margin-left:0;
+       margin-left: 0;
        margin-right: 1em;
 }
 ul#widget-list li.widget-list-item h4.widget-title {
        margin-right: 1em;
 }
 ul#widget-list li.widget-list-item h4.widget-title {
-       float:right;
+       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;
 }
-.widget-control-save, .widget-control-remove {
-       margin-right:0;
+.widget-control-save,
+.widget-control-remove {
+       margin-right: 0;
        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 {
        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;
+       right: auto;
        left: 1em;
 }
        left: 1em;
 }
index f21f22a1cc178c68d7efedc5ace9e5643f10d84a..41db0b33deaa197b24488bf880197171e7c173c5 100644 (file)
@@ -27,13 +27,6 @@ div#available-widgets-filter {
        border-bottom-style: solid;
 }
 
        border-bottom-style: solid;
 }
 
-p#widget-search {
-       position: absolute;
-       right: 0;
-       top: 0;
-       margin: 0;
-}
-
 ul#widget-list {
        list-style: none;
        margin: 0;
 ul#widget-list {
        list-style: none;
        margin: 0;
@@ -112,8 +105,8 @@ li.widget-list-control-item {
        border-radius: 3px;
 }
 
        border-radius: 3px;
 }
 
-li.widget-list-control-item h4, 
-#dragHelper li.widget-list-control-item h4, 
+li.widget-list-control-item h4,
+#dragHelper li.widget-list-control-item h4,
 li.widget-sortable h4 {
        margin: 0;
        cursor: move;
 li.widget-sortable h4 {
        margin: 0;
        cursor: move;
@@ -126,12 +119,8 @@ li.widget-sortable h4 {
        border-radius: 3px;
 }
 
        border-radius: 3px;
 }
 
-.widget-control-save, .widget-control-remove {
-       padding: 3px 5px;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
+.widget-control-save,
+.widget-control-remove {
        margin-right: 8px;
        float: left;
        text-decoration: none;
        margin-right: 8px;
        float: left;
        text-decoration: none;
@@ -149,6 +138,8 @@ li.widget-list-control-item h4.widget-title a:hover {
 }
 
 li.widget-list-control-item div.widget-control {
 }
 
 li.widget-list-control-item div.widget-control {
+       border-width: 0 1px 1px;
+       border-style: none solid solid;
        display: none;
        padding: 15px;
        font-size: 11px;
        display: none;
        padding: 15px;
        font-size: 11px;
@@ -161,8 +152,6 @@ li.widget-list-control-item div.widget-control p {
 }
 
 ul.widget-control-list div.widget-control-actions {
 }
 
 ul.widget-control-list div.widget-control-actions {
-       border-top-width: 1px;
-       border-top-style: solid;
        padding: 0.5em 0 0;
 }
 
        padding: 0.5em 0 0;
 }
 
@@ -173,7 +162,7 @@ ul.widget-control-list div.widget-control-actions {
 
 div#current-widgets {
        padding-top: 1em;
 
 div#current-widgets {
        padding-top: 1em;
-       border-width: 1px;
+       border-width: 1px 0 0;
        border-style: solid none none;
 }
 
        border-style: solid none none;
 }
 
index b1f583d144071bfad226299221ea01b41e45f602..bd78e8a961eb9d87be61bc10f3eb43b69f49a42e 100644 (file)
 <?php
 <?php
-
+/**
+ * The custom header image script.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The custom header image class.
+ *
+ * @since unknown
+ * @package WordPress
+ * @subpackage Administration
+ */
 class Custom_Image_Header {
 class Custom_Image_Header {
+
+       /**
+        * Callback for administration header.
+        *
+        * @var callback
+        * @since unknown
+        * @access private
+        */
        var $admin_header_callback;
 
        var $admin_header_callback;
 
+       /**
+        * PHP4 Constructor - Register administration header callback.
+        *
+        * @since unknown
+        * @param callback $admin_header_callback
+        * @return Custom_Image_Header
+        */
        function Custom_Image_Header($admin_header_callback) {
                $this->admin_header_callback = $admin_header_callback;
        }
 
        function Custom_Image_Header($admin_header_callback) {
                $this->admin_header_callback = $admin_header_callback;
        }
 
+       /**
+        * Setup the hooks for the Custom Header admin page.
+        *
+        * @since unknown
+        */
        function init() {
                $page = add_theme_page(__('Custom Image Header'), __('Custom Image Header'), 'edit_themes', 'custom-header', array(&$this, 'admin_page'));
 
                add_action("admin_print_scripts-$page", array(&$this, 'js_includes'));
        function init() {
                $page = add_theme_page(__('Custom Image Header'), __('Custom Image 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_head-$page", array(&$this, 'take_action'), 50);
                add_action("admin_head-$page", array(&$this, 'js'), 50);
                add_action("admin_head-$page", $this->admin_header_callback, 51);
        }
 
                add_action("admin_head-$page", array(&$this, 'take_action'), 50);
                add_action("admin_head-$page", array(&$this, 'js'), 50);
                add_action("admin_head-$page", $this->admin_header_callback, 51);
        }
 
+       /**
+        * Get the current step.
+        *
+        * @since unknown
+        *
+        * @return int Current step
+        */
        function step() {
        function step() {
-               $step = (int) @$_GET['step'];
+               if ( ! isset( $_GET['step'] ) )
+                       return 1;
+
+               $step = (int) $_GET['step'];
                if ( $step < 1 || 3 < $step )
                        $step = 1;
                if ( $step < 1 || 3 < $step )
                        $step = 1;
+
                return $step;
        }
 
                return $step;
        }
 
+       /**
+        * Setup the enqueue for the JavaScript files.
+        *
+        * @since unknown
+        */
        function js_includes() {
                $step = $this->step();
        function js_includes() {
                $step = $this->step();
+
                if ( 1 == $step )
                if ( 1 == $step )
-                       wp_enqueue_script('colorpicker');
-               elseif ( 2 == $step )   
+                       wp_enqueue_script('farbtastic');
+               elseif ( 2 == $step )
                        wp_enqueue_script('cropper');
        }
 
                        wp_enqueue_script('cropper');
        }
 
+       /**
+        * Setup the enqueue for the CSS files
+        *
+        * @since 2.7
+        */
+       function css_includes() {
+               $step = $this->step();
+
+               if ( 1 == $step ) {
+                       wp_enqueue_style('farbtastic');
+               }
+       }
+
+       /**
+        * Execute custom header modification.
+        *
+        * @since unknown
+        */
        function take_action() {
                if ( isset( $_POST['textcolor'] ) ) {
                        check_admin_referer('custom-header');
        function take_action() {
                if ( isset( $_POST['textcolor'] ) ) {
                        check_admin_referer('custom-header');
@@ -48,6 +117,11 @@ class Custom_Image_Header {
                }
        }
 
                }
        }
 
+       /**
+        * Execute Javascript depending on step.
+        *
+        * @since unknown
+        */
        function js() {
                $step = $this->step();
                if ( 1 == $step )
        function js() {
                $step = $this->step();
                if ( 1 == $step )
@@ -56,123 +130,134 @@ class Custom_Image_Header {
                        $this->js_2();
        }
 
                        $this->js_2();
        }
 
+       /**
+        * Display Javascript based on Step 1.
+        *
+        * @since unknown
+        */
        function js_1() { ?>
 <script type="text/javascript">
        function js_1() { ?>
 <script type="text/javascript">
-       var cp = new ColorPicker();
+       var buttons = ['#name', '#desc', '#pickcolor', '#defaultcolor'];
+       var farbtastic;
 
        function pickColor(color) {
 
        function pickColor(color) {
-               $('name').style.color = color;
-               $('desc').style.color = color;
-               $('textcolor').value = color;
-       }
-       function PopupWindow_hidePopup(magicword) {
-               if ( magicword != 'prettyplease' )
-                       return false;
-               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;
-                       }
-               }
-               return false;
-       }
-       function colorSelect(t,p) {
-               if ( cp.p == p && document.getElementById(cp.divName).style.visibility != "hidden" ) {
-                       cp.hidePopup('prettyplease');
-               } else {
-                       cp.p = p;
-                       cp.select(t,p);
-               }
+               jQuery('#name').css('color', color);
+               jQuery('#desc').css('color', color);
+               jQuery('#textcolor').val(color);
+               farbtastic.setColor(color);
        }
        }
+
+       jQuery(document).ready(function() {
+               jQuery('#pickcolor').click(function() {
+                       jQuery('#colorPickerDiv').show();
+               });
+
+               jQuery('#hidetext').click(function() {
+                       toggle_text();
+               });
+
+               farbtastic = jQuery.farbtastic('#colorPickerDiv', function(color) { pickColor(color); });
+               pickColor('#<?php echo get_theme_mod('header_textcolor', HEADER_TEXTCOLOR); ?>');
+
+               <?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
+               toggle_text();
+               <?php } ?>
+       });
+
+       jQuery(document).mousedown(function(){
+               // Make the picker disappear, since we're using it in an independant div
+               hide_picker();
+       });
+
        function colorDefault() {
                pickColor('#<?php echo HEADER_TEXTCOLOR; ?>');
        }
 
        function colorDefault() {
                pickColor('#<?php echo HEADER_TEXTCOLOR; ?>');
        }
 
-       function hide_text() {
-               $('name').style.display = 'none';
-               $('desc').style.display = 'none';
-               $('pickcolor').style.display = 'none';
-               $('defaultcolor').style.display = 'none';
-               $('textcolor').value = 'blank';
-               $('hidetext').value = '<?php _e('Show Text'); ?>';
-//             $('hidetext').onclick = 'show_text()';
-               Event.observe( $('hidetext'), 'click', show_text );
+       function hide_picker(what) {
+               var update = false;
+               jQuery('#colorPickerDiv').each(function(){
+                       var id = jQuery(this).attr('id');
+                       if (id == what) {
+                               return;
+                       }
+                       var display = jQuery(this).css('display');
+                       if (display == 'block') {
+                               jQuery(this).fadeOut(2);
+                       }
+               });
        }
 
        }
 
-       function show_text() {
-               $('name').style.display = 'block';
-               $('desc').style.display = 'block';
-               $('pickcolor').style.display = 'inline';
-               $('defaultcolor').style.display = 'inline';
-               $('textcolor').value = '<?php echo HEADER_TEXTCOLOR; ?>';
-               $('hidetext').value = '<?php _e('Hide Text'); ?>';
-               Event.stopObserving( $('hidetext'), 'click', show_text );
-               Event.observe( $('hidetext'), 'click', hide_text );
+       function toggle_text(force) {
+               if(jQuery('#textcolor').val() == 'blank') {
+                       //Show text
+                       jQuery( buttons.toString() ).show();
+                       jQuery('#textcolor').val('<?php echo HEADER_TEXTCOLOR; ?>');
+                       jQuery('#hidetext').val('<?php _e('Hide Text'); ?>');
+               }
+               else {
+                       //Hide text
+                       jQuery( buttons.toString() ).hide();
+                       jQuery('#textcolor').val('blank');
+                       jQuery('#hidetext').val('<?php _e('Show Text'); ?>');
+               }
        }
 
        }
 
-       <?php if ( 'blank' == get_theme_mod('header_textcolor', HEADER_TEXTCOLOR) ) { ?>
-Event.observe( window, 'load', hide_text );
-       <?php } ?>
+
 
 </script>
 <?php
        }
 
 
 </script>
 <?php
        }
 
+       /**
+        * Display Javascript based on Step 2.
+        *
+        * @since unknown
+        */
        function js_2() { ?>
 <script type="text/javascript">
        function onEndCrop( coords, dimensions ) {
        function js_2() { ?>
 <script type="text/javascript">
        function onEndCrop( coords, dimensions ) {
-               $( 'x1' ).value = coords.x1;
-               $( 'y1' ).value = coords.y1;
-               $( 'x2' ).value = coords.x2;
-               $( 'y2' ).value = coords.y2;
-               $( 'width' ).value = dimensions.width;
-               $( 'height' ).value = dimensions.height;
+               jQuery( '#x1' ).val(coords.x1);
+               jQuery( '#y1' ).val(coords.y1);
+               jQuery( '#x2' ).val(coords.x2);
+               jQuery( '#y2' ).val(coords.y2);
+               jQuery( '#width' ).val(dimensions.width);
+               jQuery( '#height' ).val(dimensions.height);
        }
 
        // with a supplied ratio
        }
 
        // with a supplied ratio
-       Event.observe(
-               window,
-               'load',
-               function() {
-                       var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>;
-                       var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>;
-                       var ratio = xinit / yinit;
-                       var ximg = $('upload').width;
-                       var yimg = $('upload').height;
-                       if ( yimg < yinit || ximg < xinit ) {
-                               if ( ximg / yimg > ratio ) {
-                                       yinit = yimg;
-                                       xinit = yinit * ratio;
-                               } else {
-                                       xinit = ximg;
-                                       yinit = xinit / ratio;
-                               }
+       jQuery(document).ready(function() {
+               var xinit = <?php echo HEADER_IMAGE_WIDTH; ?>;
+               var yinit = <?php echo HEADER_IMAGE_HEIGHT; ?>;
+               var ratio = xinit / yinit;
+               var ximg = jQuery('#upload').width();
+               var yimg = jQuery('#upload').height();
+               if ( yimg < yinit || ximg < xinit ) {
+                       if ( ximg / yimg > ratio ) {
+                               yinit = yimg;
+                               xinit = yinit * ratio;
+                       } else {
+                               xinit = ximg;
+                               yinit = xinit / ratio;
                        }
                        }
-                       new Cropper.Img(
-                               'upload',
-                               {
-                                       ratioDim: { x: xinit, y: yinit },
-                                       displayOnInit: true,
-                                       onEndCrop: onEndCrop
-                               }
-                       )
                }
                }
-       );
+               new Cropper.Img(
+                       'upload',
+                       {
+                               ratioDim: { x: xinit, y: yinit },
+                               displayOnInit: true,
+                               onEndCrop: onEndCrop
+                       }
+               )
+       });
 </script>
 <?php
        }
 
 </script>
 <?php
        }
 
+       /**
+        * Display first step of custom header image page.
+        *
+        * @since unknown
+        */
        function step_1() {
                if ( $_GET['updated'] ) { ?>
 <div id="message" class="updated fade">
        function step_1() {
                if ( $_GET['updated'] ) { ?>
 <div id="message" class="updated fade">
@@ -181,6 +266,7 @@ Event.observe( window, 'load', hide_text );
                <?php } ?>
 
 <div class="wrap">
                <?php } ?>
 
 <div class="wrap">
+<?php screen_icon(); ?>
 <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>
 
@@ -191,12 +277,12 @@ Event.observe( window, 'load', hide_text );
 <?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" />
 <?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'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
+<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" />
 <?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>
 <?php } ?>
 
 <?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>
 <?php } ?>
 
-<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
+<div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;display:none;"> </div>
 </div>
 <div class="wrap">
 <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>
 </div>
 <div class="wrap">
 <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>
@@ -226,6 +312,11 @@ Event.observe( window, 'load', hide_text );
 
        }
 
 
        }
 
+       /**
+        * Display second step of custom header image page.
+        *
+        * @since unknown
+        */
        function step_2() {
                check_admin_referer('custom-header');
                $overrides = array('test_form' => false);
        function step_2() {
                check_admin_referer('custom-header');
                $overrides = array('test_form' => false);
@@ -298,6 +389,11 @@ Event.observe( window, 'load', hide_text );
                <?php
        }
 
                <?php
        }
 
+       /**
+        * Display third step of custom header image page.
+        *
+        * @since unknown
+        */
        function step_3() {
                check_admin_referer('custom-header');
                if ( $_POST['oitar'] > 1 ) {
        function step_3() {
                check_admin_referer('custom-header');
                if ( $_POST['oitar'] > 1 ) {
@@ -339,6 +435,11 @@ Event.observe( window, 'load', hide_text );
                return $this->finished();
        }
 
                return $this->finished();
        }
 
+       /**
+        * Display last step of custom header image page.
+        *
+        * @since unknown
+        */
        function finished() {
                ?>
 <div class="wrap">
        function finished() {
                ?>
 <div class="wrap">
@@ -350,6 +451,11 @@ Event.observe( window, 'load', hide_text );
                <?php
        }
 
                <?php
        }
 
+       /**
+        * Display the page based on the current step.
+        *
+        * @since unknown
+        */
        function admin_page() {
                $step = $this->step();
                if ( 1 == $step )
        function admin_page() {
                $step = $this->step();
                if ( 1 == $step )
index 78361e30fe8614d0c82534b5f98ca2ac3c2d9a0e..42cd3df0246ecf3e38e80bc60e0f01eeedbb16e7 100644 (file)
-<?php if ( ! defined('ABSPATH') ) die(); ?>
-<table class="widefat">
-       <thead>
-       <tr>
+<?php
+/**
+ * Edit attachments table for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
-<?php $posts_columns = wp_manage_media_columns(); ?>
-<?php foreach($posts_columns as $post_column_key => $column_display_name) {
-       if ( 'cb' === $post_column_key )
-               $class = ' class="check-column"';
-       elseif ( 'comments' === $post_column_key )
-               $class = ' class="num"';
-       else
-               $class = '';
-?>
-       <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
-<?php } ?>
+if ( ! defined('ABSPATH') ) die();
 
 
+if ( have_posts() ) { ?>
+<table class="widefat fixed" cellspacing="0">
+       <thead>
+       <tr>
+<?php print_column_headers('upload'); ?>
        </tr>
        </thead>
        </tr>
        </thead>
+
+       <tfoot>
+       <tr>
+<?php print_column_headers('upload', false); ?>
+       </tr>
+       </tfoot>
+
        <tbody id="the-list" class="list:post">
 <?php
        <tbody id="the-list" class="list:post">
 <?php
-if ( have_posts() ) {
-$bgcolor = '';
 add_filter('the_title','wp_specialchars');
 add_filter('the_title','wp_specialchars');
+$alt = '';
+$posts_columns = get_column_headers('upload');
+$hidden = get_hidden_columns('upload');
 while (have_posts()) : the_post();
 while (have_posts()) : the_post();
-$class = 'alternate' == $class ? '' : 'alternate';
+$alt = ( 'alternate' == $alt ) ? '' : 'alternate';
 global $current_user;
 $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
 global $current_user;
 $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
-$att_title = get_the_title();
-if ( empty($att_title) )
-       $att_title = __('(no title)');
+$att_title = _draft_or_post_title();
 
 ?>
 
 ?>
-       <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
+       <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
 
 <?php
 
 <?php
+foreach ($posts_columns as $column_name => $column_display_name ) {
+       $class = "class=\"$column_name column-$column_name\"";
 
 
-foreach($posts_columns as $column_name=>$column_display_name) {
+       $style = '';
+       if ( in_array($column_name, $hidden) )
+               $style = ' style="display:none;"';
+
+       $attributes = "$class$style";
 
        switch($column_name) {
 
        case 'cb':
                ?>
 
        switch($column_name) {
 
        case 'cb':
                ?>
-               <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th>
+               <th scope="row" class="check-column"><input type="checkbox" name="media[]" value="<?php the_ID(); ?>" /></th>
                <?php
                break;
 
        case 'icon':
                <?php
                break;
 
        case 'icon':
+               $attributes = 'class="column-icon media-icon"' . $style;
                ?>
                ?>
-               <td class="media-icon"><?php echo wp_get_attachment_link($post->ID, array(80, 60), false, true); ?></td>
+               <td <?php echo $attributes ?>><?php
+                       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)); ?>">
+                                       <?php echo $thumb; ?>
+                               </a>
+
+<?php                  }
+               ?></td>
                <?php
                // TODO
                break;
 
        case 'media':
                ?>
                <?php
                // TODO
                break;
 
        case 'media':
                ?>
-               <td><strong><a href="media.php?action=edit&amp;attachment_id=<?php the_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 attribute_escape(sprintf(__('Edit "%s"'), $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))); ?>
-               <?php do_action('manage_media_media_column', $post->ID); ?>
-               </td>
+               <p>
+               <?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>';
+               $action_count = count($actions);
+               $i = 0;
+               echo '<div class="row-actions">';
+               foreach ( $actions as $action => $link ) {
+                       ++$i;
+                       ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                       echo "<span class='$action'>$link$sep</span>";
+               }
+               echo '</div>';
+               ?></p></td>
+               <?php
+               break;
+
+       case 'author':
+               ?>
+               <td <?php echo $attributes ?>><?php the_author() ?></td>
+               <?php
+               break;
+
+       case 'tags':
+               ?>
+               <td <?php echo $attributes ?>><?php
+               $tags = get_the_tags();
+               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>";
+                       echo join( ', ', $out );
+               } else {
+                       _e('No Tags');
+               }
+               ?></td>
                <?php
                break;
 
        case 'desc':
                ?>
                <?php
                break;
 
        case 'desc':
                ?>
-               <td><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
+               <td <?php echo $attributes ?>><?php echo has_excerpt() ? $post->post_excerpt : ''; ?></td>
                <?php
                break;
 
                <?php
                break;
 
@@ -73,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 );
+                       $time = get_post_time( 'G', true, $post );
                        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 ) );
@@ -84,38 +142,36 @@ foreach($posts_columns as $column_name=>$column_display_name) {
                        }
                }
                ?>
                        }
                }
                ?>
-               <td><?php echo $h_time ?></td>
+               <td <?php echo $attributes ?>><?php echo $h_time ?></td>
                <?php
                break;
 
        case 'parent':
                <?php
                break;
 
        case 'parent':
-               $title = __('(no title)'); // override below
                if ( $post->post_parent > 0 ) {
                        if ( get_post($post->post_parent) ) {
                if ( $post->post_parent > 0 ) {
                        if ( get_post($post->post_parent) ) {
-                               $parent_title = get_the_title($post->post_parent);
-                               if ( !empty($parent_title) )
-                                       $title = $parent_title;
+                               $title =_draft_or_post_title($post->post_parent);
                        }
                        ?>
                        }
                        ?>
-                       <td><strong><a href="post.php?action=edit&amp;post=<?php echo $post->post_parent; ?>"><?php echo $title ?></a></strong></td>
+                       <td <?php echo $attributes ?>><strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title ?></a></strong>, <?php echo get_the_time(__('Y/m/d')); ?></td>
                        <?php
                } else {
                        ?>
                        <?php
                } else {
                        ?>
-                       <td>&nbsp;</td>
+                       <td <?php echo $attributes ?>>&nbsp;</td>
                        <?php
                }
 
                break;
 
        case 'comments':
                        <?php
                }
 
                break;
 
        case 'comments':
+               $attributes = 'class="comments column-comments num"' . $style;
                ?>
                ?>
-               <td class="num"><div class="post-com-count-wrapper">
+               <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
                <?php
                $left = get_pending_comments_num( $post->ID );
                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
                if ( $left )
                        echo '<strong>';
                <?php
                $left = get_pending_comments_num( $post->ID );
                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
                if ( $left )
                        echo '<strong>';
-               comments_number("<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='upload.php?attachment_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='upload.php?attachment_id=$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'>" . __('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>');
                if ( $left )
                        echo '</strong>';
                ?>
                if ( $left )
                        echo '</strong>';
                ?>
@@ -123,30 +179,32 @@ foreach($posts_columns as $column_name=>$column_display_name) {
                <?php
                break;
 
                <?php
                break;
 
-       case 'location':
+       case 'actions':
                ?>
                ?>
-               <td><a href="<?php the_permalink(); ?>"><?php _e('Permalink'); ?></a></td>
+               <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="<?php the_permalink(); ?>"><?php _e('Get permalink'); ?></a>
+               </td>
                <?php
                break;
 
        default:
                ?>
                <?php
                break;
 
        default:
                ?>
-               <td><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
+               <td <?php echo $attributes ?>><?php do_action('manage_media_custom_column', $column_name, $id); ?></td>
                <?php
                break;
        }
 }
 ?>
        </tr>
                <?php
                break;
        }
 }
 ?>
        </tr>
-<?php
-endwhile;
-} else {
-?>
-  <tr style='background-color: <?php echo $bgcolor; ?>'>
-    <td colspan="8"><?php _e('No posts found.') ?></td>
-  </tr>
+<?php endwhile; ?>
+       </tbody>
+</table>
+<?php } else { ?>
+
+<p><?php _e('No posts found.') ?></p>
+
 <?php
 } // end if ( have_posts() )
 ?>
 <?php
 } // end if ( have_posts() )
 ?>
-       </tbody>
-</table>
+
index f32cfd4fdaa848b0a1259b6da2dfd30ecc089f6e..d84f30f981effd61b1494f24b193c459b394fa7a 100644 (file)
@@ -1,28 +1,51 @@
 <?php
 <?php
-if ( ! empty($cat_ID) ) {
-       $heading = __('Edit Category');
-       $submit_text = __('Edit Category');
-       $form = '<form name="editcat" id="editcat" method="post" action="categories.php" class="validate">';
-       $action = 'editedcat';
-       $nonce_action = 'update-category_' . $cat_ID;
-       do_action('edit_category_form_pre', $category);
-} else {
-       $heading = __('Add Category');
-       $submit_text = __('Add Category');
-       $form = '<form name="addcat" id="addcat" method="post" action="categories.php" class="add:the-list: validate">';
-       $action = 'addcat';
-       $nonce_action = 'add-category';
-       do_action('add_category_form_pre', $category);
+/**
+ * Edit category form for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * @var object
+ */
+if ( ! isset( $category ) )
+       $category = (object) array();
+
+/**
+ * @ignore
+ * @since 2.7
+ * @internal Used to prevent errors in page when no category is being edited.
+ *
+ * @param object $category
+ */
+function _fill_empty_category(&$category) {
+       if ( ! isset( $category->name ) )
+               $category->name = '';
+
+       if ( ! isset( $category->slug ) )
+               $category->slug = '';
+
+       if ( ! isset( $category->parent ) )
+               $category->parent = '';
+
+       if ( ! isset( $category->description ) )
+               $category->description = '';
 }
 }
+
+do_action('edit_category_form_pre', $category);
+
+_fill_empty_category($category);
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php echo $heading ?></h2>
+<?php screen_icon(); ?>
+<h2><?php _e('Edit Category'); ?></h2>
 <div id="ajax-response"></div>
 <div id="ajax-response"></div>
-<?php echo $form ?>
-<input type="hidden" name="action" value="<?php echo $action ?>" />
+<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 $category->term_id ?>" />
-<?php wp_nonce_field($nonce_action); ?>
+<?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>
        <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>
@@ -47,7 +70,7 @@ if ( ! empty($cat_ID) ) {
             <?php _e('The description is not prominent by default, however some themes may show it.'); ?></td>
                </tr>
        </table>
             <?php _e('The description is not prominent by default, however some themes may show it.'); ?></td>
                </tr>
        </table>
-<p class="submit"><input type="submit" class="button" name="submit" value="<?php echo $submit_text ?>" /></p>
+<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Category'); ?>" /></p>
 <?php do_action('edit_category_form', $category); ?>
 </form>
 </div>
 <?php do_action('edit_category_form', $category); ?>
 </form>
 </div>
index 62fb2df69d1ab1e23e7d3a09dc75a4e4d7dbd194..43eecffc87dd9f54097ce1f18f6a7c99f0f428db 100644 (file)
@@ -1,35 +1,67 @@
 <?php
 <?php
+/**
+ * Edit Comments Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-$title = __('Edit Comments');
-$parent_file = 'edit-comments.php';
-wp_enqueue_script( 'admin-comments' );
-wp_enqueue_script('admin-forms');
+wp_enqueue_script('admin-comments');
+enqueue_comment_hotkeys_js();
 
 
-if ( !empty( $_REQUEST['delete_comments'] ) ) {
+$post_id = isset($_REQUEST['p']) ? (int) $_REQUEST['p'] : 0;
+
+if ( ( isset( $_REQUEST['delete_all_spam'] ) || isset( $_REQUEST['delete_all_spam2'] ) ) && !empty( $_REQUEST['pagegen_timestamp'] ) ) {
+       check_admin_referer('bulk-spam-delete', '_spam_nonce');
+
+       $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] );
+       if ( current_user_can('moderate_comments')) {
+               $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
+       } else {
+               $deleted_spam = 0;
+       }
+       $redirect_to = 'edit-comments.php?comment_status=spam&deleted=' . (int) $deleted_spam;
+       if ( $post_id )
+               $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
+       wp_redirect( $redirect_to );
+} elseif ( isset($_REQUEST['delete_comments']) && isset($_REQUEST['action']) && ( -1 != $_REQUEST['action'] || -1 != $_REQUEST['action2'] ) ) {
        check_admin_referer('bulk-comments');
        check_admin_referer('bulk-comments');
+       $doaction = ( -1 != $_REQUEST['action'] ) ? $_REQUEST['action'] : $_REQUEST['action2'];
+
+       $deleted = $approved = $unapproved = $spammed = 0;
+       foreach ( (array) $_REQUEST['delete_comments'] as $comment_id) : // Check the permissions on each
+               $comment_id = (int) $comment_id;
+               $_post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment_id) );
 
 
-       $comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
-       foreach ($_REQUEST['delete_comments'] as $comment) : // Check the permissions on each
-               $comment = (int) $comment;
-               $post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
-               if ( !current_user_can('edit_post', $post_id) )
+               if ( !current_user_can('edit_post', $_post_id) )
                        continue;
                        continue;
-               if ( !empty( $_REQUEST['spamit'] ) ) {
-                       wp_set_comment_status($comment, 'spam');
-                       $comments_spammed++;
-               } elseif ( !empty( $_REQUEST['deleteit'] ) ) {
-                       wp_set_comment_status($comment, 'delete');
-                       $comments_deleted++;
-               } elseif ( !empty( $_REQUEST['approveit'] ) ) {
-                       wp_set_comment_status($comment, 'approve');
-                       $comments_approved++;
-               } elseif ( !empty( $_REQUEST['unapproveit'] ) ) {
-                       wp_set_comment_status($comment, 'hold');
-                       $comments_unapproved++;
+
+               switch( $doaction ) {
+                       case 'markspam' :
+                               wp_set_comment_status($comment_id, 'spam');
+                               $spammed++;
+                               break;
+                       case 'delete' :
+                               wp_set_comment_status($comment_id, 'delete');
+                               $deleted++;
+                               break;
+                       case 'approve' :
+                               wp_set_comment_status($comment_id, 'approve');
+                               $approved++;
+                               break;
+                       case 'unapprove' :
+                               wp_set_comment_status($comment_id, 'hold');
+                               $unapproved++;
+                               break;
                }
        endforeach;
                }
        endforeach;
-       $redirect_to = basename( __FILE__ ) . '?deleted=' . $comments_deleted . '&approved=' . $comments_approved . '&spam=' . $comments_spammed . '&unapproved=' . $comments_unapproved;
+
+       $redirect_to = 'edit-comments.php?deleted=' . $deleted . '&approved=' . $approved . '&spam=' . $spammed . '&unapproved=' . $unapproved;
+       if ( $post_id )
+               $redirect_to = add_query_arg( 'p', absint( $post_id ), $redirect_to );
        if ( isset($_REQUEST['apage']) )
                $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
        if ( !empty($_REQUEST['mode']) )
        if ( isset($_REQUEST['apage']) )
                $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
        if ( !empty($_REQUEST['mode']) )
@@ -39,29 +71,34 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
        if ( !empty($_REQUEST['s']) )
                $redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to);
        wp_redirect( $redirect_to );
        if ( !empty($_REQUEST['s']) )
                $redirect_to = add_query_arg('s', $_REQUEST['s'], $redirect_to);
        wp_redirect( $redirect_to );
-} elseif ( !empty($_GET['_wp_http_referer']) ) {
-        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
         exit;
 }
 
+if ( $post_id )
+       $title = sprintf(__('Edit Comments on &#8220;%s&#8221;'), wp_html_excerpt(_draft_or_post_title($post_id), 50));
+else
+       $title = __('Edit Comments');
+
 require_once('admin-header.php');
 
 require_once('admin-header.php');
 
-if ( empty($_GET['mode']) )
-       $mode = 'detail';
-else
-       $mode = attribute_escape($_GET['mode']);
+$mode = ( ! isset($_GET['mode']) || empty($_GET['mode']) ) ? 'detail' : attribute_escape($_GET['mode']);
 
 
-if ( isset($_GET['comment_status']) )
-       $comment_status = attribute_escape($_GET['comment_status']);
-else
-       $comment_status = '';
+$comment_status = !empty($_GET['comment_status']) ? attribute_escape($_GET['comment_status']) : '';
+
+$comment_type = !empty($_GET['comment_type']) ? attribute_escape($_GET['comment_type']) : '';
+
+$search_dirty = ( isset($_GET['s']) ) ? $_GET['s'] : '';
+$search = attribute_escape( $search_dirty ); ?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title );
+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>' ); ?>
+</h2>
 
 
-if ( isset($_GET['s']) )
-       $search_dirty = $_GET['s'];
-else
-       $search_dirty = '';
-$search = attribute_escape( $search_dirty );
-?>
 <?php
 if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
        $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
 <?php
 if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['spam'] ) ) {
        $approved = isset( $_GET['approved'] ) ? (int) $_GET['approved'] : 0;
@@ -90,50 +127,61 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
        }
 }
 ?>
        }
 }
 ?>
-<div class="wrap">
-<form id="posts-filter" action="" method="get">
-<h2><?php _e('Manage Comments'); ?></h2>
 
 
+<form id="comments-form" action="" method="get">
 <ul class="subsubsub">
 <?php
 $status_links = array();
 <ul class="subsubsub">
 <?php
 $status_links = array();
-$num_comments = wp_count_comments();
-$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 'approved' => _c('Approved|plural'));
+$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(
+               '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>)')
+       );
 $class = ( '' === $comment_status ) ? ' class="current"' : '';
 $class = ( '' === $comment_status ) ? ' class="current"' : '';
-$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
+// $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 = '';
 
 foreach ( $stati as $status => $label ) {
        $class = '';
 
-       if ( $status == $comment_status )
+       if ( str_replace( 'all', '', $status ) == $comment_status )
                $class = ' class="current"';
                $class = ' class="current"';
-
-       $status_links[] = "<li><a href=\"edit-comments.php?comment_status=$status\"$class>" . $label . '</a>';
+       if ( !isset( $num_comments->$status ) )
+               $num_comments->$status = 10;
+       if ( 'all' != $status )
+               $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'] ) )
+               $link = add_query_arg( 's', attribute_escape( stripslashes( $_GET['s'] ) ), $link );
+       */
+       $status_links[] = "<li class='$status'><a href='$link'$class>" . sprintf(
+               __ngettext( $label[0], $label[1], $num_comments->$status ),
+               number_format_i18n( $num_comments->$status )
+       ) . '</a>';
 }
 
 $status_links = apply_filters( 'comment_status_links', $status_links );
 
 }
 
 $status_links = apply_filters( 'comment_status_links', $status_links );
 
-echo implode(' | </li>', $status_links) . '</li>';
+echo implode( " |</li>\n", $status_links) . '</li>';
 unset($status_links);
 ?>
 </ul>
 
 unset($status_links);
 ?>
 </ul>
 
-<p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Comments' ); ?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php echo $search; ?>" />
+<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" />
 </p>
 
        <input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
 </p>
 
-<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
-<input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
-</form>
-
-<ul class="view-switch">
-       <li <?php if ( 'detail' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'detail', $_SERVER['REQUEST_URI'])) ?>"><?php _e('Detail View') ?></a></li>
-       <li <?php if ( 'list' == $mode ) echo "class='current'" ?>><a href="<?php echo clean_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>"><?php _e('List View') ?></a></li>
-</ul>
-
 <?php
 <?php
-
 $comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
 
 if ( isset( $_GET['apage'] ) )
 $comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
 
 if ( isset( $_GET['apage'] ) )
@@ -143,7 +191,17 @@ else
 
 $start = $offset = ( $page - 1 ) * $comments_per_page;
 
 
 $start = $offset = ( $page - 1 ) * $comments_per_page;
 
-list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
+list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5, $post_id, $comment_type ); // Grab a few extra
+
+$_comment_post_ids = array();
+foreach ( $_comments as $_c ) {
+       $_comment_post_ids[] = $_c->comment_post_ID;
+}
+$_comment_pending_count_temp = (array) get_pending_comments_num($_comment_post_ids);
+foreach ( (array) $_comment_post_ids as $_cpid )
+       $_comment_pending_count[$_cpid] = isset( $_comment_pending_count_temp[$_cpid] ) ? $_comment_pending_count_temp[$_cpid] : 0;
+if ( empty($_comment_pending_count) )
+       $_comment_pending_count = array();
 
 $comments = array_slice($_comments, 0, $comments_per_page);
 $extra_comments = array_slice($_comments, $comments_per_page);
 
 $comments = array_slice($_comments, 0, $comments_per_page);
 $extra_comments = array_slice($_comments, $comments_per_page);
@@ -151,54 +209,100 @@ $extra_comments = array_slice($_comments, $comments_per_page);
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'apage', '%#%' ),
        'format' => '',
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'apage', '%#%' ),
        'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
        'total' => ceil($total / $comments_per_page),
        'current' => $page
 ));
 
 ?>
 
        'total' => ceil($total / $comments_per_page),
        'current' => $page
 ));
 
 ?>
 
-<form id="comments-form" action="" method="post">
+<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
+<?php if ( $post_id ) : ?>
+<input type="hidden" name="p" value="<?php echo intval( $post_id ); ?>" />
+<?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); ?>" />
 
 <div class="tablenav">
 
 
 <div class="tablenav">
 
-<?php
-if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
-?>
+<?php if ( $page_links ) : ?>
+<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 ),
+       $page_links
+); echo $page_links_text; ?></div>
+<?php endif; ?>
 
 
-<div class="alignleft">
-<?php if ( 'approved' != $comment_status ): ?>
-<input type="submit" value="<?php _e('Approve'); ?>" name="approveit" class="button-secondary" />
+<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 ): ?>
+<option value="unapprove"><?php _e('Unapprove'); ?></option>
 <?php endif; ?>
 <?php endif; ?>
-<input type="submit" value="<?php _e('Mark as Spam'); ?>" name="spamit" class="button-secondary" />
-<?php if ( 'moderated' != $comment_status ): ?>
-<input type="submit" value="<?php _e('Unapprove'); ?>" name="unapproveit" class="button-secondary" />
+<?php if ( empty($comment_status) || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
+<option value="approve"><?php _e('Approve'); ?></option>
 <?php endif; ?>
 <?php endif; ?>
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
-<?php do_action('manage_comments_nav', $comment_status); ?>
+<?php if ( 'spam' != $comment_status ): ?>
+<option value="markspam"><?php _e('Mark as Spam'); ?></option>
+<?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" />
 <?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
+       $comment_types = apply_filters( 'admin_comment_types_dropdown', array(
+               'comment' => __('Comments'),
+               'pings' => __('Pings'),
+       ) );
+
+       foreach ( $comment_types as $type => $label ) {
+               echo "  <option value='$type'";
+               selected( $comment_type, $type );
+               echo ">$label</option>\n";
+       }
+?>
+</select>
+<input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
+
 <?php if ( isset($_GET['apage']) ) { ?>
        <input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
 <?php if ( isset($_GET['apage']) ) { ?>
        <input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
-<?php } ?>
+<?php }
+
+if ( 'spam' == $comment_status ) {
+       wp_nonce_field('bulk-spam-delete', '_spam_nonce'); 
+        if ( current_user_can ('moderate_comments')) { ?>
+               <input type="submit" name="delete_all_spam" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
+<?php  }
+} ?>
+<?php do_action('manage_comments_nav', $comment_status); ?>
 </div>
 
 <br class="clear" />
 
 </div>
 
 </div>
 
 <br class="clear" />
 
 </div>
 
-<br class="clear" />
-<?php
-if ($comments) {
-?>
-<table class="widefat">
+<div class="clear"></div>
+
+<?php if ( $comments ) { ?>
+<table class="widefat comments fixed" cellspacing="0">
 <thead>
 <thead>
-  <tr>
-    <th scope="col" class="check-column"><input type="checkbox" /></th>
-    <th scope="col"><?php _e('Comment') ?></th>
-    <th scope="col"><?php _e('Date') ?></th>
-    <th scope="col" class="action-links"><?php _e('Actions') ?></th>
-  </tr>
+       <tr>
+<?php print_column_headers('edit-comments'); ?>
+       </tr>
 </thead>
 </thead>
+
+<tfoot>
+       <tr>
+<?php print_column_headers('edit-comments', false); ?>
+       </tr>
+</tfoot>
+
 <tbody id="the-comment-list" class="list:comment">
 <?php
        foreach ($comments as $comment)
 <tbody id="the-comment-list" class="list:comment">
 <?php
        foreach ($comments as $comment)
@@ -213,6 +317,37 @@ if ($comments) {
 </tbody>
 </table>
 
 </tbody>
 </table>
 
+<div class="tablenav">
+<?php
+if ( $page_links )
+       echo "<div class='tablenav-pages'>$page_links_text</div>";
+?>
+
+<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 ): ?>
+<option value="unapprove"><?php _e('Unapprove'); ?></option>
+<?php endif; ?>
+<?php if ( empty($comment_status) || 'moderated' == $comment_status || 'spam' == $comment_status ): ?>
+<option value="approve"><?php _e('Approve'); ?></option>
+<?php endif; ?>
+<?php if ( 'spam' != $comment_status ): ?>
+<option value="markspam"><?php _e('Mark as Spam'); ?></option>
+<?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" />
+
+<?php if ( 'spam' == $comment_status ) { ?>
+<input type="submit" name="delete_all_spam2" value="<?php _e('Delete All Spam'); ?>" class="button-secondary apply" />
+<?php } ?>
+<?php do_action('manage_comments_nav', $comment_status); ?>
+</div>
+
+<br class="clear" />
+</div>
+
 </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;">
@@ -220,33 +355,39 @@ if ($comments) {
        <input type="hidden" name="mode" value="<?php echo $mode; ?>" />
        <input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
        <input type="hidden" name="page" value="<?php echo isset($_REQUEST['page']) ? absint( $_REQUEST['page'] ) : 1; ?>" />
        <input type="hidden" name="mode" value="<?php echo $mode; ?>" />
        <input type="hidden" name="comment_status" value="<?php echo $comment_status; ?>" />
        <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 ); ?>" />
        <?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'] ) {
-?>
-<p>
-<?php _e('No comments awaiting moderation&hellip; yet.') ?>
-</p>
-<?php
-} else  {
-?>
-<p>
-<?php _e('No results found.') ?>
-</p>
-<?php
-}
-?>
-<div class="tablenav">
-<?php
-if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
-?>
-<br class="clear" />
-</div>
 
 
+<?php } elseif ( 'moderated' == $_GET['comment_status'] ) { ?>
+<p><?php _e('No comments awaiting moderation&hellip; yet.') ?></p>
+</form>
+
+<?php } else { ?>
+<p><?php _e('No results found.') ?></p>
+</form>
+
+<?php } ?>
 </div>
 
 </div>
 
-<?php include('admin-footer.php'); ?>
+<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'); ?>
index 983bc27d8d06abe238cf5fede35ff20ff856a229..904b9831c557531db21582dbb7597e7b04dfd082 100644 (file)
@@ -1,12 +1,31 @@
 <?php
 <?php
+/**
+ * Post advanced form for inclusion in the administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Post ID global
+ * @name $post_ID
+ * @var int
+ */
+if ( ! isset( $post_ID ) )
+       $post_ID = 0;
+else
+       $post_ID = (int) $post_ID;
 
 $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( $_GET['_wp_original_http_referer'] ) ) );
+$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[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.');
+$messages[6] = sprintf(__('Post published. <a href="%s">View post</a>'), get_permalink($post_ID));
+$messages[7] = __('Post saved.');
+$messages[8] = sprintf(__('Post submitted. <a href="%s">Preview post</a>'), add_query_arg( 'preview', 'true', get_permalink($post_ID) ) );
 
 if ( isset($_GET['revision']) )
        $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
 
 if ( isset($_GET['revision']) )
        $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
@@ -14,21 +33,20 @@ if ( isset($_GET['revision']) )
 $notice = false;
 $notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
 
 $notice = false;
 $notices[1] = __( 'There is an autosave of this post that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
 
-if ( !isset($post_ID) || 0 == $post_ID ) {
+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' />";
        $autosave = false;
 } else {
        $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' />";
        $autosave = false;
 } else {
-       $post_ID = (int) $post_ID;
        $form_action = 'editpost';
        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
        $form_action = 'editpost';
        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
-       $autosave = wp_get_post_autosave( $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
        if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
                foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
 
        // 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 ) ) {
                foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
-                       if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) {
+                       if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
                                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
                                break;
                        }
                                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
                                break;
                        }
@@ -37,215 +55,235 @@ if ( !isset($post_ID) || 0 == $post_ID ) {
        }
 }
 
        }
 }
 
+// All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
+
+/**
+ * Display post submit form fields.
+ *
+ * @since 2.7.0
+ *
+ * @param object $post
+ */
+function post_submit_meta_box($post) {
+       global $action;
+
+       $can_publish = current_user_can('publish_posts');
 ?>
 ?>
-<?php if ( $notice ) : ?>
-<div id="notice" class="error"><p><?php echo $notice ?></p></div>
-<?php endif; ?>
-<?php if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-<?php endif; ?>
+<div class="submitbox" id="submitpost">
 
 
-<form name="post" action="post.php" method="post" id="post">
-<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
-<input type="hidden" name="mode" value="bookmarklet" />
-<?php endif; ?>
+<div id="minor-publishing">
 
 
-<div class="wrap">
-<h2><?php _e('Write Post') ?></h2>
-<?php
+<?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') ); ?>" />
+</div>
 
 
-if ( !isset($post_ID) || 0 == $post_ID)
-       wp_nonce_field('add-post');
-else
-       wp_nonce_field('update-post_' .  $post_ID);
+<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" />
+<?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" />
+<?php } ?>
+</div>
 
 
-$form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
+<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)))); ?>
 
 
-$form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
+<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
+<input type="hidden" name="wp-preview" id="wp-preview" value="" />
+</div>
+
+<div class="clear"></div>
+</div><?php // /minor-publishing-actions ?>
 
 
-$saveasdraft = '<input name="save" type="submit" id="save" class="button" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
+<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">
+<?php
+switch ( $post->post_status ) {
+       case 'private':
+               _e('Privately Published');
+               break;
+       case 'publish':
+               _e('Published');
+               break;
+       case 'future':
+               _e('Scheduled');
+               break;
+       case 'pending':
+               _e('Pending Review');
+               break;
+       case 'draft':
+               _e('Draft');
+               break;
+}
 ?>
 ?>
+</span></b>
+<?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>
 
 
-<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'); ?>
+<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; ?>" />
+<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>
+<?php elseif ( 'private' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
+<?php elseif ( 'future' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
+<?php endif; ?>
+<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
+<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
+</select>
+ <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
+ <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
+</div>
 
 
-<?php echo $form_extra ?>
+<?php } ?>
+</div><?php // /misc-pub-section ?>
+
+<div class="misc-pub-section " id="visibility">
+<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php
+
+if ( 'private' == $post->post_status ) {
+       $post->post_password = '';
+       $visibility = 'private';
+       $visibility_trans = __('Private');
+} elseif ( !empty( $post->post_password ) ) {
+       $visibility = 'password';
+       $visibility_trans = __('Password protected');
+} elseif ( is_sticky( $post->ID ) ) {
+       $visibility = 'public';
+       $visibility_trans = __('Public, Sticky');
+} else {
+       $visibility = 'public';
+       $visibility_trans = __('Public');
+}
 
 
-<div id="poststuff">
+?><?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>
 
 
-<div class="submitbox" id="submitpost">
+<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 ); ?>" />
 
 
-<div id="previewview">
-<?php if ( 'publish' == $post->post_status ) { ?>
-<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank" tabindex="4"><?php _e('View this Post'); ?></a>
-<?php } elseif ( 'edit' == $action ) { ?>
-<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank"  tabindex="4"><?php _e('Preview this Post'); ?></a>
-<?php } ?>
-</div>
 
 
-<div class="inside">
+<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>
+<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>
+<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><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
 <p>
 <p>
-<select name='post_status' id='post_status' tabindex='4'>
-<?php 
-// only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability) 
-if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) :
-?>
-<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
-<?php if ( 'future' == $post->post_status ) : ?>
-<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
-<?php endif; ?>
-<?php endif; ?>
-<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
-<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
-</select>
+ <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>
+</div>
+<?php } ?>
+
+</div><?php // /misc-pub-section ?>
+
 
 
-<?php if ( current_user_can( 'publish_posts' ) ) : ?>
-<p id="private-checkbox"><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>
-<?php endif; ?>
 <?php
 <?php
-if ($post_ID) {
+$datef = _c( 'M j, Y @ G:i|Publish box date format');
+if ( 0 != $post->ID ) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
-               $stamp = __('Scheduled for:<br />%1$s at %2$s');
-       } else if ( 'publish' == $post->post_status ) { // already published
-               $stamp = __('Published on:<br />%1$s at %2$s');
-       } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
-               $stamp = __('Publish immediately');
+               $stamp = __('Scheduled for: <b>%1$s</b>');
+       } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
+               $stamp = __('Published on: <b>%1$s</b>');
+       } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
+               $stamp = __('Publish <b>immediately</b>');
+       } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
+               $stamp = __('Schedule for: <b>%1$s</b>');
        } else { // draft, 1 or more saves, date specified
        } else { // draft, 1 or more saves, date specified
-               $stamp = __('Publish on:<br />%1$s at %2$s');
+               $stamp = __('Publish on: <b>%1$s</b>');
        }
        }
-       $date = mysql2date(get_option('date_format'), $post->post_date);
-       $time = mysql2date(get_option('time_format'), $post->post_date);
+       $date = date_i18n( $datef, strtotime( $post->post_date ) );
 } else { // draft (no saves, and thus no date specified)
 } else { // draft (no saves, and thus no date specified)
-       $stamp = __('Publish immediately');
-       $date = mysql2date(get_option('date_format'), current_time('mysql'));
-       $time = mysql2date(get_option('time_format'), current_time('mysql'));
+       $stamp = __('Publish <b>immediately</b>');
+       $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
 }
 ?>
 }
 ?>
-<?php if ( current_user_can( 'publish_posts' ) ) : // Contributors don't get to choose the date of publish ?>
-<p class="curtime"><?php printf($stamp, $date, $time); ?>
-&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
-
-<div id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
+<?php 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>
+       <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; ?>
 
 <?php endif; ?>
 
+</div>
+<div class="clear"></div>
 </div>
 
 </div>
 
-<p class="submit">
-<input type="submit" name="save" id="save-post" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" />
+<div id="major-publishing-actions">
+<?php do_action('post_submitbox_start'); ?>
+<div id="delete-action">
 <?php
 <?php
-if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
-?>
+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>
+<?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 ( current_user_can('publish_posts') ) : ?>
-       <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('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 : ?>
 <?php else : ?>
-       <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
+       <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 endif; ?>
-<?php
-}
-
-if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
-       echo "<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 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&nbsp;post') . "</a>";
-?>
-<br class="clear" />
-<?php if ($post_ID): ?>
-<?php 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));
-} 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));
-}
-?>
-<br class="clear" />
-<?php endif; ?>
-<span id="autosave"></span>
-<span id="wp-word-count"></span>
-</p>
-
-<div class="side-info">
-<h5><?php _e('Related') ?></h5>
-
-<ul>
-<?php if ($post_ID): ?>
-<li><a href="edit.php?p=<?php echo $post_ID ?>"><?php _e('See Comments on this Post') ?></a></li>
-<?php endif; ?>
-<li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li>
-<li><a href="edit.php"><?php _e('Manage All Posts') ?></a></li>
-<li><a href="categories.php"><?php _e('Manage All Categories') ?></a></li>
-<li><a href="edit-tags.php"><?php _e('Manage All Tags') ?></a></li>
-<li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li>
-<?php do_action('post_relatedlinks_list'); ?>
-</ul>
-
-<h5><?php _e('Shortcuts') ?></h5>
-<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.') ?>  <a href="<?php echo get_shortcut_link(); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
-</div>
-
-<?php do_action('submitpost_box'); ?>
-</div>
-
-<div id="post-body">
-<div id="titlediv">
-<h3><label for="title"><?php _e('Title') ?></label></h3>
-<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" />
-</div>
-<div class="inside">
-<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
-       <div id="edit-slug-box">
-<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
-       echo $sample_permalink_html;
-endif; ?>
-       </div>
+<?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 } ?>
 </div>
 </div>
+<div class="clear"></div>
 </div>
 </div>
-
-<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><label for="content"><?php _e('Post') ?></label></h3>
-<?php the_editor($post->post_content); ?>
-<?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 ); ?>
 </div>
 
 </div>
 
-<?php echo $form_pingback ?>
-<?php echo $form_prevstatus ?>
-
 <?php
 <?php
+}
+add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', 'post', 'side', 'core');
+
+/**
+ * Display post tags form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function post_tags_meta_box($post) {
 ?>
 <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>
 function post_tags_meta_box($post) {
 ?>
 <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>
 <?php
 }
 <?php
 }
-add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'normal', 'core');
-
+add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'side', 'core');
+
+/**
+ * Display post categories form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function post_categories_meta_box($post) {
 ?>
 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">
-               <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>
-</div>
-
 <ul id="category-tabs">
        <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
 <ul id="category-tabs">
        <li class="ui-tabs-selected"><a href="#categories-all" tabindex="3"><?php _e( 'All Categories' ); ?></a></li>
-       <li class="wp-no-js-hidden"><a href="#categories-pop" tabindex="3"><?php _e( 'Most Used' ); ?></a></li>
+       <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;">
 </ul>
 
 <div id="categories-pop" class="ui-tabs-panel" style="display: none;">
@@ -259,28 +297,67 @@ function post_categories_meta_box($post) {
                <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
        </ul>
 </div>
                <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
        </ul>
 </div>
+
+<?php if ( current_user_can('manage_categories') ) : ?>
+<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>
+</div>
 <?php
 <?php
+endif;
+
 }
 }
-add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'normal', 'core');
+add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'side', 'core');
+
+/**
+ * Display post password form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function post_password_meta_box($post) {
 ?>
 ?>
-
-<?php do_meta_boxes('post', 'normal', $post); ?>
-
-<?php do_action('edit_form_advanced'); ?>
-
-<h2><?php _e('Advanced Options'); ?></h2>
-
+<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>
+<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><?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
 <?php
+}
+// add_meta_box('passworddiv', __('Privacy Options'), 'post_password_meta_box', 'post', 'side', 'core');
+
+/**
+ * Display post excerpt form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $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>
 <?php
 }
 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>
 <?php
 }
-add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'advanced', 'core');
-
+add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'normal', 'core');
+
+/**
+ * Display trackback links form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function post_trackback_meta_box($post) {
 function post_trackback_meta_box($post) {
-       $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
+       $form_trackback = '<input type="text" name="trackback_url" id="trackback_url" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
        if ('' != $post->pinged) {
                $pings = '<p>'. __('Already pinged:') . '</p><ul>';
                $already_pinged = explode("\n", trim($post->pinged));
        if ('' != $post->pinged) {
                $pings = '<p>'. __('Already pinged:') . '</p><ul>';
                $already_pinged = explode("\n", trim($post->pinged));
@@ -291,67 +368,108 @@ function post_trackback_meta_box($post) {
        }
 
 ?>
        }
 
 ?>
-<p><label for="trackback"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
+<p><label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
 <p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress blogs they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
 <?php
 if ( ! empty($pings) )
        echo $pings;
 }
 <p><?php _e('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress blogs they&#8217;ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
 <?php
 if ( ! empty($pings) )
        echo $pings;
 }
-add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core');
-
+add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', 'post', 'normal', 'core');
+
+/**
+ * Display custom fields for the post form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function post_custom_meta_box($post) {
 ?>
 <div id="postcustomstuff">
 function post_custom_meta_box($post) {
 ?>
 <div id="postcustomstuff">
-<table cellpadding="3">
+<div id="ajax-response"></div>
 <?php
 $metadata = has_meta($post->ID);
 list_meta($metadata);
 <?php
 $metadata = has_meta($post->ID);
 list_meta($metadata);
+meta_form();
 ?>
 ?>
-
-</table>
-<?php
-       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
 }
-add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'advanced', 'core');
+add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'normal', 'core');
 
 do_action('dbx_post_advanced');
 
 
 do_action('dbx_post_advanced');
 
+/**
+ * Display comment status for post form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function post_comment_status_meta_box($post) {
 function post_comment_status_meta_box($post) {
+       global $wpdb, $post_ID;
 ?>
 <input name="advanced_view" type="hidden" value="1" />
 ?>
 <input name="advanced_view" type="hidden" value="1" />
-<p><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') ?></label></p>
-<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 Pings') ?></label></p>
-<p><?php _e('These settings apply to this post only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
+<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>
 <?php
 <?php
-}
-add_meta_box('commentstatusdiv', __('Comments &amp; Pings'), 'post_comment_status_meta_box', 'post', 'advanced', 'core');
+       $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));
 
 
-function post_password_meta_box($post) {
+       if ( !$post_ID || $post_ID < 0 || 1 > $total )
+               return;
+
+wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
 ?>
 ?>
-<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 echo attribute_escape( $post->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>
+
+<table class="widefat comments-box fixed" cellspacing="0" style="display:none;">
+<thead>
+       <tr>
+    <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>
+</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>
 <?php
 <?php
+       $hidden = get_hidden_meta_boxes('post');
+       if ( ! in_array('commentstatusdiv', $hidden) ) { ?>
+               <script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script>
+<?php
+       }
 }
 }
-add_meta_box('passworddiv', __('Password Protect This Post'), 'post_password_meta_box', 'post', 'advanced', 'core');
-
+add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
+
+/**
+ * Display post slug form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $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 ); ?>" />
 <?php
 }
 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 ); ?>" />
 <?php
 }
-add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'advanced', 'core');
+if ( !( 'pending' == $post->post_status && !current_user_can( 'publish_posts' ) ) )
+       add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'normal', 'core');
 
 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
 if ( $post->post_author && !in_array($post->post_author, $authors) )
        $authors[] = $post->post_author;
 if ( $authors && count( $authors ) > 1 ) :
 
 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
 if ( $post->post_author && !in_array($post->post_author, $authors) )
        $authors[] = $post->post_author;
 if ( $authors && count( $authors ) > 1 ) :
+/**
+ * Display form field with list of authors.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function post_author_meta_box($post) {
        global $current_user, $user_ID;
        $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
 function post_author_meta_box($post) {
        global $current_user, $user_ID;
        $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
@@ -361,26 +479,144 @@ function post_author_meta_box($post) {
 <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) ); ?>
 <?php
 }
 <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) ); ?>
 <?php
 }
-add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'advanced', 'core');
+add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'normal', 'core');
 endif;
 
 endif;
 
-if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+/**
+ * Display list of post revisions.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function post_revisions_meta_box($post) {
        wp_list_post_revisions();
 }
 function post_revisions_meta_box($post) {
        wp_list_post_revisions();
 }
-add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'advanced', 'core');
+add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'normal', 'core');
 endif;
 
 endif;
 
-do_meta_boxes('post', 'advanced', $post);
+do_action('do_meta_boxes', 'post', 'normal', $post);
+do_action('do_meta_boxes', 'post', 'advanced', $post);
+do_action('do_meta_boxes', 'post', 'side', $post);
+
+require_once('admin-header.php');
 
 
-do_action('dbx_post_sidebar');
 ?>
 ?>
+
+<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
+<input type="hidden" name="mode" value="bookmarklet" />
+<?php endif; ?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
+<?php if (isset($_GET['message'])) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+<form name="post" action="post.php" method="post" id="post">
+<?php
+
+if ( 0 == $post_ID)
+       wp_nonce_field('add-post');
+else
+       wp_nonce_field('update-post_' .  $post_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 ?>
+
+<div id="poststuff" class="metabox-holder">
+
+<div id="side-info-column" class="inner-sidebar">
+
+<?php do_action('submitpost_box'); ?>
+
+<?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="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" />
+</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' ) ) ) { ?>
+       <div id="edit-slug-box">
+<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
+       echo $sample_permalink_html;
+endif; ?>
+       </div>
+<?php } ?>
 </div>
 </div>
 
 </div>
 </div>
 
+<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">
+       <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));
+               } 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>
+
+
+<?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 ); ?>
 </div>
 
 </div>
 
+<?php
+
+do_meta_boxes('post', 'normal', $post);
+
+do_action('edit_form_advanced');
+
+do_meta_boxes('post', 'advanced', $post);
+
+do_action('dbx_post_sidebar');
+
+?>
+
+</div>
+</div>
+<br class="clear" />
+</div><!-- /poststuff -->
 </form>
 </form>
+</div>
+
+<?php wp_comment_reply(); ?>
 
 <?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
 <script type="text/javascript">
 
 <?php if ((isset($post->post_title) && '' == $post->post_title) || (isset($_GET['message']) && 2 > $_GET['message'])) : ?>
 <script type="text/javascript">
index 601f4cbb4ee17cb719e99de99ed8dbcf587cb3f5..531db65b08a6afd5d22251a4b16411b0bb857fe8 100644 (file)
@@ -1,4 +1,14 @@
 <?php
 <?php
+/**
+ * Edit comment form for inclusion in another file.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * @var string
+ */
 $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';
@@ -8,84 +18,110 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment-
 <form name="post" action="comment.php" method="post" id="post">
 <?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
 <div class="wrap">
 <form name="post" action="comment.php" method="post" id="post">
 <?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?>
 <div class="wrap">
-<h2><?php echo $toprow_title; ?></h2>
+<?php screen_icon(); ?>
+<h2><?php _e('Edit Comment'); ?></h2>
+
+<div id="poststuff" class="metabox-holder">
 <input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" />
 <input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' />
 <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
 
 
-<div id="poststuff">
+$email = attribute_escape( $comment->comment_author_email );
+$url = attribute_escape( $comment->comment_author_url );
+// add_meta_box('submitdiv', __('Save'), 'comment_submit_meta_box', 'comment', 'side', 'core');
+?>
 
 
+<div id="side-info-column" class="inner-sidebar">
+<div id="submitdiv" class="stuffbox" >
+<h3><span class='hndle'><?php _e('Status') ?></span></h3>
+<div class="inside">
 <div class="submitbox" id="submitcomment">
 <div class="submitbox" id="submitcomment">
+<div id="minor-publishing">
 
 
-<div id="previewview">
-<a href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View this Comment'); ?></a>
+<div id="minor-publishing-actions">
+<div id="preview-action">
+<a class="preview button" href="<?php echo get_comment_link(); ?>" target="_blank"><?php _e('View Comment'); ?></a>
+</div>
+<div class="clear"></div>
 </div>
 
 </div>
 
-<div class="inside">
+<div id="misc-publishing-actions">
 
 
-<p><strong><label for='comment_status'><?php _e('Approval Status') ?></label></strong></p>
-<p>
-<select name='comment_status' id='comment_status'>
-<option<?php selected( $comment->comment_approved, '1' ); ?> value='1'><?php _e('Approved') ?></option>
-<option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Moderated') ?></option>
-<option<?php selected( $comment->comment_approved, 'spam' ); ?> value='spam'><?php _e('Spam') ?></option>
-</select>
-</p>
+<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>
+</div>
 
 
+<div class="misc-pub-section curtime misc-pub-section-last">
 <?php
 <?php
-$stamp = __('%1$s at %2$s');
-$date = mysql2date(get_option('date_format'), $comment->comment_date);
-$time = mysql2date(get_option('time_format'), $comment->comment_date);
+$datef = _c( 'M j, Y @ G:i|Publish box date format');
+$stamp = __('Submitted on: <b>%1$s</b>');
+$date = date_i18n( $datef, strtotime( $comment->comment_date ) );
 ?>
 ?>
-<p class="curtime"><?php printf($stamp, $date, $time); ?>
-&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Edit') ?></a></p>
-
+<span id="timestamp"><?php printf($stamp, $date); ?></span>&nbsp;<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(('editcomment' == $action), 0, 5); ?></div>
 <div id='timestampdiv' class='hide-if-js'><?php touch_time(('editcomment' == $action), 0, 5); ?></div>
-
+</div>
+</div> <!-- misc actions -->
+<div class="clear"></div>
 </div>
 
 </div>
 
-<p class="submit">
-<input type="submit" name="save" value="<?php _e('Save'); ?>" tabindex="4" class="button button-highlighted" />
-<?php
-echo "<a class='submitdelete' href='" . 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 comment') . "</a>";
-?>
-</p>
-
-<div class="side-info">
-<h5><?php _e('Related') ?></h5>
-
-<ul>
-<li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li>
-<li><a href="edit-comments.php?comment_status=moderated"><?php _e('Moderate Comments') ?></a></li>
-<?php do_action('comment_relatedlinks_list'); ?>
-</ul>
+<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>
 </div>
 </div>
-<?php do_action('submitcomment_box'); ?>
+<div id="publishing-action">
+<input type="submit" name="save" value="<?php _e('Update Comment'); ?>" tabindex="4" class="button-primary" />
 </div>
 </div>
-
-<div id="post-body">
-<div id="namediv" class="stuffbox">
-<h3><label for="name"><?php _e('Name') ?></label></h3>
-<div class="inside">
-<input type="text" name="newcomment_author" size="30" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" />
+<div class="clear"></div>
 </div>
 </div>
 </div>
 </div>
-
-<div id="emaildiv" class="stuffbox">
-<h3><label for="email"><?php _e('E-mail') ?></label></h3>
-<div class="inside">
-<input type="text" name="newcomment_author_email" size="30" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" />
 </div>
 </div>
 </div>
 </div>
+</div>
+
+<div id="post-body" class="has-sidebar">
+<div id="post-body-content" class="has-sidebar-content">
 
 
-<div id="uridiv" class="stuffbox">
-<h3><label for="newcomment_author_url"><?php _e('URL') ?></label></h3>
+<div id="namediv" class="stuffbox">
+<h3><label for="name"><?php _e( 'Author' ) ?></label></h3>
 <div class="inside">
 <div class="inside">
-<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="3" />
+<table class="form-table">
+<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>
+</tr>
+<tr valign="top">
+       <td class="first">
+       <?php
+               if ( $email ) {
+                       printf( __( 'E-mail (%s):' ), get_comment_author_email_link( __( 'send e-mail' ), '', '' ) );
+               } else {
+                       _e( 'E-mail:' );
+               }
+?></td>
+       <td><input type="text" name="newcomment_author_email" size="30" value="<?php echo $email; ?>" tabindex="2" id="email" /></td>
+</tr>
+<tr valign="top">
+       <td class="first">
+       <?php
+               $url = get_comment_author_url();
+               if ( ! empty( $url ) && 'http://' != $url ) {
+                       $link = "<a href='$url' rel='external nofollow' target='_blank'>" . __('visit site') . "</a>";
+                       printf( __( 'URL (%s):' ), apply_filters('get_comment_author_link', $link ) );
+               } 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>
+</tr>
+</tbody>
+</table>
+<br />
 </div>
 </div>
 
 <div id="postdiv" class="postarea">
 </div>
 </div>
 
 <div id="postdiv" class="postarea">
-<h3><label for="content"><?php _e('Comment') ?></label></h3>
 <?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4); ?>
 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
 </div>
 <?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4); ?>
 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
 </div>
@@ -94,13 +130,14 @@ echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletec
 
 <input type="hidden" name="c" value="<?php echo $comment->comment_ID ?>" />
 <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 $comment->comment_post_ID ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php echo wp_get_referer(); ?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_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" />
+
+</div>
 </div>
 </div>
 </div>
 </div>
 </div>
 </div>
-
 </form>
 
 <script type="text/javascript">
 </form>
 
 <script type="text/javascript">
diff --git a/wp-admin/edit-form.php b/wp-admin/edit-form.php
deleted file mode 100644 (file)
index 18997e4..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-
-<div class="wrap">
-<h2><?php _e('Write Post'); ?></h2>
-<form name="post" action="post.php" method="post" id="simple">
-
-<?php if (isset($mode) && 'bookmarklet' == $mode) : ?>
-<input type="hidden" name="mode" value="bookmarklet" />
-<?php endif; ?>
-<input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
-<input type="hidden" name="action" value='post' />
-
-<div id="poststuff">
-    <fieldset id="titlediv">
-      <legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>
-         <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div>
-    </fieldset>
-
-    <fieldset id="categorydiv">
-      <legend><a href="http://wordpress.org/docs/reference/post/#category" title="<?php _e('Help on categories') ?>"><?php _e('Categories') ?></a></legend>
-         <div><?php dropdown_categories($post->post_category); ?></div>
-    </fieldset>
-
-<br />
-<fieldset id="postdiv">
-    <legend><a href="http://wordpress.org/docs/reference/post/#post" title="<?php _e('Help with post field') ?>"><?php _e('Post') ?></a></legend>
-<?php
- $rows = get_option('default_post_edit_rows');
- if (($rows < 3) || ($rows > 100)) {
-     $rows = 10;
- }
-?>
-<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="4" id="content"><?php echo $post->post_content ?></textarea></div>
-<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
-</fieldset>
-
-
-<script type="text/javascript">
-<!--
-edCanvas = document.getElementById('content');
-//-->
-</script>
-
-<input type="hidden" name="post_pingback" value="<?php echo (int) get_option('default_pingback_flag') ?>" id="post_pingback" />
-
-<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)'), 'http://wordpress.org/docs/reference/post/#trackback'); echo '<br />'; ?>
-       <input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
-
-<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
-       <input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
-
-        <?php if ( current_user_can('edit_posts') ) : ?>
-       <input name="publish" type="submit" id="publish" tabindex="6" value="<?php _e('Publish') ?>" class="button button-highlighted" />
-<?php endif; ?>
-
-<?php if ('bookmarklet' != $mode) {
-               echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' .  __('Advanced Editing') . '" />';
-       } ?>
-       <input name="referredby" type="hidden" id="referredby" value="<?php if ( $refby = wp_get_referer() ) echo urlencode($refby); ?>" />
-</p>
-
-<?php do_action('simple_edit_form', ''); ?>
-
-</div>
-</form>
-
-<script type="text/javascript">
-try{document.getElementById('title').focus();}catch(e){}
-</script>
-</div>
index c7a5e9d99efbf6cc40e2df2001250ed97e3f723d..3636635cac0ecb8260ba9b69c5be6d271f91c16a 100644 (file)
@@ -1,43 +1,54 @@
 <?php
 <?php
+/**
+ * Edit Link Categories Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-// Handle bulk deletes
-if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
+// Handle bulk actions
+if ( isset($_GET['action']) && isset($_GET['delete']) ) {
        check_admin_referer('bulk-link-categories');
        check_admin_referer('bulk-link-categories');
+       $doaction = $_GET['action'] ? $_GET['action'] : $_GET['action2'];
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
 
        if ( !current_user_can('manage_categories') )
                wp_die(__('Cheatin&#8217; uh?'));
 
-       foreach( (array) $_GET['delete'] as $cat_ID ) {
-               $cat_name = get_term_field('name', $cat_ID, 'link_category');
-               $default_cat_id = get_option('default_link_category');
-               
-               // Don't delete the default cats.
-               if ( $cat_ID == $default_cat_id )
-                       wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
+       if ( 'delete' == $doaction ) {
+               foreach( (array) $_GET['delete'] as $cat_ID ) {
+                       $cat_name = get_term_field('name', $cat_ID, 'link_category');
+                       $default_cat_id = get_option('default_link_category');
 
 
-               wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
-       }
+                       // Don't delete the default cats.
+                       if ( $cat_ID == $default_cat_id )
+                               wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
 
-       $location = 'edit-link-categories.php';
-       if ( $referer = wp_get_referer() ) {
-               if ( false !== strpos($referer, 'edit-link-categories.php') )
-                       $location = $referer;
-       }
+                       wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
+               }
+
+               $location = 'edit-link-categories.php';
+               if ( $referer = wp_get_referer() ) {
+                       if ( false !== strpos($referer, 'edit-link-categories.php') )
+                               $location = $referer;
+               }
 
 
-       $location = add_query_arg('message', 6, $location);
-       wp_redirect($location);
-       exit();
-} elseif ( !empty($_GET['_wp_http_referer']) ) {
-        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+               $location = add_query_arg('message', 6, $location);
+               wp_redirect($location);
+               exit();
+       }
+} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
 $title = __('Link Categories');
         exit;
 }
 
 $title = __('Link Categories');
-$parent_file = 'edit.php';
 
 
-wp_enqueue_script( 'admin-categories' );
-wp_enqueue_script('admin-forms');
+wp_enqueue_script('admin-categories');
+if ( current_user_can('manage_categories') )
+       wp_enqueue_script('inline-edit-tax');
 
 require_once ('admin-header.php');
 
 
 require_once ('admin-header.php');
 
@@ -46,42 +57,48 @@ $messages[2] = __('Category deleted.');
 $messages[3] = __('Category updated.');
 $messages[4] = __('Category not added.');
 $messages[5] = __('Category not updated.');
 $messages[3] = __('Category updated.');
 $messages[4] = __('Category not added.');
 $messages[5] = __('Category not updated.');
-$messages[6] = __('Categories deleted.');
+$messages[6] = __('Categories deleted.'); ?>
+
+<div class="wrap nosubsub">
+<?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( stripslashes($_GET['s']) ) ); ?>
+</h2>
 
 
-if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 
-<div class="wrap">
-
-<form id="posts-filter" action="" method="get">
-<?php if ( current_user_can('manage_categories') ) : ?>
-       <h2><?php printf(__('Manage Link Categories (<a href="%s">add new</a>)'), '#addcat') ?> </h2>
-<?php else : ?>
-       <h2><?php _e('Manage Link Categories') ?> </h2>
-<?php endif; ?>
-
-<p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Categories' ); ?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
+<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" />
 </p>
        <input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
 </p>
-
+</form>
 <br class="clear" />
 
 <br class="clear" />
 
+<div id="col-container">
+
+<div id="col-right">
+<div class="col-wrap">
+<form id="posts-filter" action="" method="get">
 <div class="tablenav">
 
 <?php
 <div class="tablenav">
 
 <?php
-$pagenum = absint( $_GET['pagenum'] );
+$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 if ( empty($pagenum) )
        $pagenum = 1;
-if( !$catsperpage || $catsperpage < 0 )
+if( ! isset( $catsperpage ) || $catsperpage < 0 )
        $catsperpage = 20;
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
        $catsperpage = 20;
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
        'total' => ceil(wp_count_terms('link_category') / $catsperpage),
        'current' => $pagenum
 ));
        'total' => ceil(wp_count_terms('link_category') / $catsperpage),
        'current' => $pagenum
 ));
@@ -90,25 +107,33 @@ if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+<div class="alignleft actions">
+<select name="action">
+<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" />
 <?php wp_nonce_field('bulk-link-categories'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
 <?php wp_nonce_field('bulk-link-categories'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
-<br class="clear" />
+<div class="clear"></div>
 
 
-<table class="widefat">
+<table class="widefat fixed" cellspacing="0">
        <thead>
        <tr>
        <thead>
        <tr>
-        <th scope="col" class="check-column"><input type="checkbox" /></th>
-        <th scope="col"><?php _e('Name') ?></th>
-        <th scope="col"><?php _e('Description') ?></th>
-        <th scope="col" class="num" style="width: 90px;"><?php _e('Links') ?></th>
+<?php print_column_headers('edit-link-categories'); ?>
        </tr>
        </thead>
        </tr>
        </thead>
+
+       <tfoot>
+       <tr>
+<?php print_column_headers('edit-link-categories', false); ?>
+       </tr>
+       </tfoot>
+
        <tbody id="the-list" class="list:link-cat">
 <?php
 $start = ($pagenum - 1) * $catsperpage;
        <tbody id="the-list" class="list:link-cat">
 <?php
 $start = ($pagenum - 1) * $catsperpage;
@@ -120,10 +145,8 @@ $categories = get_terms( 'link_category', $args );
 if ( $categories ) {
        $output = '';
        foreach ( $categories as $category ) {
 if ( $categories ) {
        $output = '';
        foreach ( $categories as $category ) {
-               $category = sanitize_term($category, 'link_category', 'display');
                $output .= link_cat_row($category);
        }
                $output .= link_cat_row($category);
        }
-       $output = apply_filters('cat_rows', $output);
        echo $output;
        unset($category);
 }
        echo $output;
        unset($category);
 }
@@ -131,27 +154,90 @@ if ( $categories ) {
 ?>
        </tbody>
 </table>
 ?>
        </tbody>
 </table>
-</form>
 
 <div class="tablenav">
 
 <div class="tablenav">
-
 <?php
 if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 <?php
 if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
+
+<div class="alignleft actions">
+<select name="action2">
+<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" />
+</div>
+
 <br class="clear" />
 </div>
 <br class="clear" />
 <br class="clear" />
 </div>
 <br class="clear" />
+</form>
 
 
+<div class="form-wrap">
+<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the links in that category. Instead, links that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), get_term_field('name', get_option('default_link_category'), 'link_category')) ?></p>
 </div>
 
 </div>
 
-<?php if ( current_user_can('manage_categories') ) : ?>
-<div class="wrap">
-<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the links in that category. Instead, links that were only assigned to the deleted category are set to the category <strong>%s</strong>.'), get_term_field('name', get_option('default_link_category'), 'link_category')) ?></p>
+
+</div>
+</div><!-- /col-right -->
+
+<div id="col-left">
+<div class="col-wrap">
+
+<?php if ( current_user_can('manage_categories') ) {
+       $category = (object) array(); $category->parent = 0; do_action('add_link_category_form_pre', $category); ?>
+
+<div class="form-wrap">
+<h3><?php _e('Add 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">
+       <label for="name"><?php _e('Category name') ?></label>
+       <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
 </div>
 
 </div>
 
-<?php include('edit-link-category-form.php'); ?>
+<div class="form-field">
+       <label for="slug"><?php _e('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>
 
 
-<?php endif; ?>
+<div class="form-field">
+       <label for="description"><?php _e('Description (optional)') ?></label>
+       <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>
+<?php do_action('edit_link_category_form', $category); ?>
+</form>
+</div>
+
+<?php } ?>
+
+</div>
+</div><!-- /col-left -->
+
+</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 include('admin-footer.php'); ?>
index 81a686be4bfe3111639b60517d1aba13c47dd691..3a420c3c72f3066f3113485e13abcd3c31abf5e1 100644 (file)
@@ -1,23 +1,60 @@
 <?php
 <?php
+/**
+ * Edit link category form for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * @var object
+ */
+if ( ! isset( $category ) )
+       $category = (object) array();
+
 if ( ! empty($cat_ID) ) {
 if ( ! empty($cat_ID) ) {
-       $heading = __('Edit Category');
-       $submit_text = __('Edit Category');
+       /**
+        * @var string
+        */
+       $heading = '<h2>' . __('Edit Link Category') . '</h2>';
+       $submit_text = __('Update Category');
        $form = '<form name="editcat" id="editcat" method="post" action="link-category.php" class="validate">';
        $action = 'editedcat';
        $nonce_action = 'update-link-category_' . $cat_ID;
        do_action('edit_link_category_form_pre', $category);
 } else {
        $form = '<form name="editcat" id="editcat" method="post" action="link-category.php" class="validate">';
        $action = 'editedcat';
        $nonce_action = 'update-link-category_' . $cat_ID;
        do_action('edit_link_category_form_pre', $category);
 } else {
-       $heading = __('Add Category');
+       $heading = '<h2>' . __('Add Link Category') . '</h2>';
        $submit_text = __('Add Category');
        $form = '<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">';
        $action = 'addcat';
        $nonce_action = 'add-link-category';
        do_action('add_link_category_form_pre', $category);
 }
        $submit_text = __('Add Category');
        $form = '<form name="addcat" id="addcat" class="add:the-list: validate" method="post" action="link-category.php">';
        $action = 'addcat';
        $nonce_action = 'add-link-category';
        do_action('add_link_category_form_pre', $category);
 }
+
+/**
+ * @ignore
+ * @since 2.7
+ * @internal Used to prevent errors in page when no category is being edited.
+ *
+ * @param object $category
+ */
+function _fill_empty_link_category(&$category) {
+       if ( ! isset( $category->name ) )
+               $category->name = '';
+
+       if ( ! isset( $category->slug ) )
+               $category->slug = '';
+
+       if ( ! isset( $category->description ) )
+               $category->description = '';
+}
+
+_fill_empty_link_category($category);
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php echo $heading ?></h2>
+<?php screen_icon(); ?>
+<?php echo $heading ?>
 <div id="ajax-response"></div>
 <?php echo $form ?>
 <input type="hidden" name="action" value="<?php echo $action ?>" />
 <div id="ajax-response"></div>
 <?php echo $form ?>
 <input type="hidden" name="action" value="<?php echo $action ?>" />
@@ -30,7 +67,7 @@ if ( ! empty($cat_ID) ) {
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th>
                </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" />
+                       <td><input name="slug" id="slug" 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>
                </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">
@@ -38,7 +75,7 @@ if ( ! empty($cat_ID) ) {
                        <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" name="submit" value="<?php echo $submit_text ?>" /></p>
+<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php echo $submit_text ?>" /></p>
 <?php do_action('edit_link_category_form', $category); ?>
 </form>
 </div>
 <?php do_action('edit_link_category_form', $category); ?>
 </form>
 </div>
index 48b95ccf7def693d9ec1c0c34af3347a307f5aff..189a8b7e436366ce584a328e48213cd59597b263 100644 (file)
@@ -1,20 +1,36 @@
 <?php
 <?php
+/**
+ * Edit links form for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
 if ( ! empty($link_id) ) {
 if ( ! empty($link_id) ) {
-       $heading = __('Edit Link');
-       $submit_text = __('Save Changes');
+       $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
+       $submit_text = __('Update Link');
        $form = '<form name="editlink" id="editlink" method="post" action="link.php">';
        $nonce_action = 'update-bookmark_' . $link_id;
 } else {
        $form = '<form name="editlink" id="editlink" method="post" action="link.php">';
        $nonce_action = 'update-bookmark_' . $link_id;
 } else {
-       $heading = __('Add Link');
+       $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
        $submit_text = __('Add Link');
        $form = '<form name="addlink" id="addlink" method="post" action="link.php">';
        $nonce_action = 'add-bookmark';
 }
 
        $submit_text = __('Add Link');
        $form = '<form name="addlink" id="addlink" method="post" action="link.php">';
        $nonce_action = 'add-bookmark';
 }
 
+/**
+ * Display checked checkboxes attribute for xfn microformat options.
+ *
+ * @since 1.0.1
+ *
+ * @param string $class
+ * @param string $value
+ * @param mixed $deprecated Not used.
+ */
 function xfn_check($class, $value = '', $deprecated = '') {
        global $link;
 
 function xfn_check($class, $value = '', $deprecated = '') {
        global $link;
 
-       $link_rel = $link->link_rel;
+       $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
        $rels = preg_split('/\s+/', $link_rel);
 
        if ('' != $value && in_array($value, $rels) ) {
        $rels = preg_split('/\s+/', $link_rel);
 
        if ('' != $value && in_array($value, $rels) ) {
@@ -28,82 +44,81 @@ function xfn_check($class, $value = '', $deprecated = '') {
                if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
        }
 }
                if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
        }
 }
-?>
-
-<?php echo $form ?>
-<?php wp_nonce_field($nonce_action); ?>
-<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
-
-<div class="wrap">
-<h2><?php echo $heading; ?></h2>
-
-<div id="poststuff">
 
 
+/**
+ * Display link create form fields.
+ *
+ * @since 2.7.0
+ *
+ * @param object $link
+ */
+function link_submit_meta_box($link) {
+?>
 <div class="submitbox" id="submitlink">
 
 <div class="submitbox" id="submitlink">
 
-<div id="previewview">
-<?php if ( !empty($link_id) ) { ?>
-<a href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
-<?php } ?>
-</div>
+<div id="minor-publishing">
 
 
-<div class="inside">
-<p><label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label></p>
+<?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') ); ?>" />
 </div>
 
 </div>
 
-<p class="submit">
-<input type="submit" class="button button-highlighted" name="save" value="<?php _e('Save'); ?>" tabindex="4" />
-<?php
-if ( ( 'edit' == $action) && current_user_can('manage_links') )
-       echo "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&amp;link_id=$link_id", 'delete-bookmark_' . $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&nbsp;link') . "</a>";
-?>
-</p>
-
-<div class="side-info">
-<h5><?php _e('Related') ?></h5>
-
-<ul>
-<li><a href="link-manager.php"><?php _e('Manage All Links') ?></a></li>
-<li><a href="edit-link-categories.php"><?php _e('Manage All Link Categories') ?></a></li>
-<li><a href="link-import.php"><?php _e('Import Links') ?></a></li>
-<?php do_action('link_relatedlinks_list'); ?>
-</ul>
+<div id="minor-publishing-actions">
+<div id="preview-action">
+<?php if ( !empty($link->link_id) ) { ?>
+       <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a>
+<?php } ?>
 </div>
 </div>
-<?php do_action('submitlink_box'); ?>
+<div class="clear"></div>
 </div>
 
 </div>
 
-<div id="post-body">
-<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" /><br />
-    <?php _e('Example: Nifty blogging software'); ?>
+<div id="misc-publishing-actions">
+<div class="misc-pub-section misc-pub-section-last">
+       <label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label>
 </div>
 </div>
 
 </div>
 </div>
 
-<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" /><br />
-    <?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?>
 </div>
 </div>
+
+<div id="major-publishing-actions">
+<?php do_action('post_submitbox_start'); ?>
+<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>
+<?php } ?>
 </div>
 
 </div>
 
-<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 $link->link_description; ?>" id="link_description" /><br />
-    <?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?>
+<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') ?>" />
+<?php } else { ?>
+       <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Add Link') ?>" />
+<?php } ?>
 </div>
 </div>
+<div class="clear"></div>
 </div>
 </div>
+<?php do_action('submitlink_box'); ?>
+<div class="clear"></div>
+</div>
+<?php
+}
+add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core');
 
 
-<?php function link_categories_meta_box($link) { ?>
+/**
+ * Display link categories form fields.
+ *
+ * @since 2.6.0
+ *
+ * @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" />
 <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-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
+               <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>
                <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
                <span id="category-ajax-response"></span>
        </p>
@@ -111,12 +126,17 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
 
 <ul id="category-tabs">
        <li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
 
 <ul id="category-tabs">
        <li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
-       <li class="wp-no-js-hidden"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
+       <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">
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
 </ul>
 
 <div id="categories-all" class="ui-tabs-panel">
        <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-               <?php wp_link_category_checklist($link->link_id); ?>
+               <?php
+               if ( isset($link->link_id) )
+                       wp_link_category_checklist($link->link_id);
+               else
+                       wp_link_category_checklist();
+               ?>
        </ul>
 </div>
 
        </ul>
 </div>
 
@@ -128,35 +148,44 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
 <?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');
-?>
-
-<?php do_meta_boxes('link', 'normal', $link); ?>
-
-<h2><?php _e('Advanced Options'); ?></h2>
 
 
-<?php function link_target_meta_box($link) { ?>
+/**
+ * Display form fields for changing link target.
+ *
+ * @since 2.6.0
+ *
+ * @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="hidden"><?php _e('Target') ?></legend>
 <label for="link_target_blank" class="selectit">
-<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($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">
 <code>_blank</code></label><br />
 <label for="link_target_top" class="selectit">
-<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo(($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">
 <code>_top</code></label><br />
 <label for="link_target_none" class="selectit">
-<input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($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>
 </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>
 <?php
 }
 <?php _e('none') ?></label>
 </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>
 <?php
 }
-add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
+add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core');
 
 
+/**
+ * Display xfn form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $link
+ */
 function link_xfn_meta_box($link) {
 ?>
 <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>
 function link_xfn_meta_box($link) {
 ?>
 <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 $link->link_rel; ?>" /></td>
+               <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>
        </tr>
        <tr>
                <td colspan="2">
        </tr>
        <tr>
                <td colspan="2">
@@ -262,22 +291,29 @@ function link_xfn_meta_box($link) {
 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
 <?php
 }
 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
 <?php
 }
-add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
+add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'normal', 'core');
 
 
+/**
+ * Display advanced link options form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $link
+ */
 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>
 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>
-               <td><input type="text" name="link_image" id="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
+               <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>
        </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 $link->link_rss; ?>" size="50" style="width: 95%" /></td>
+               <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>
        </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>
-               <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
+               <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo  ( isset( $link->link_notes ) ? $link->link_notes : ''); ?></textarea></td>
        </tr>
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
        </tr>
        <tr class="form-field">
                <th valign="top"  scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
@@ -285,7 +321,7 @@ function link_advanced_meta_box($link) {
                <?php
                        for ($r = 0; $r < 10; $r++) {
                                echo('            <option value="'.$r.'" ');
                <?php
                        for ($r = 0; $r < 10; $r++) {
                                echo('            <option value="'.$r.'" ');
-                               if ($link->link_rating == $r)
+                               if ( isset($link->link_rating) && $link->link_rating == $r)
                                        echo 'selected="selected"';
                                echo('>'.$r.'</option>');
                        }
                                        echo 'selected="selected"';
                                echo('>'.$r.'</option>');
                        }
@@ -295,7 +331,75 @@ function link_advanced_meta_box($link) {
 </table>
 <?php
 }
 </table>
 <?php
 }
-add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
+add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core');
+
+do_action('do_meta_boxes', 'link', 'normal', $link);
+do_action('do_meta_boxes', 'link', 'advanced', $link);
+do_action('do_meta_boxes', 'link', 'side', $link);
+
+require_once ('admin-header.php');
+
+?>
+
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
+<?php if ( isset( $_GET['added'] ) ) : ?>
+<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
+<?php endif; ?>
+
+<?php
+if ( !empty($form) )
+       echo $form;
+if ( !empty($link_added) )
+       echo $link_added;
+
+wp_nonce_field( $nonce_action );
+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="side-info-column" class="inner-sidebar">
+<?php
+
+do_action('submitlink_box');
+$side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
+
+?>
+</div>
+
+<div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
+<div id="post-body-content" class="has-sidebar-content">
+<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" />
+    <p><?php _e('Example: Nifty blogging software'); ?></p>
+</div>
+</div>
+
+<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" />
+    <p><?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?></p>
+</div>
+</div>
+
+<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" />
+    <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
+</div>
+</div>
+
+<?php
+
+do_meta_boxes('link', 'normal', $link);
 
 do_meta_boxes('link', 'advanced', $link);
 
 
 do_meta_boxes('link', 'advanced', $link);
 
@@ -310,7 +414,7 @@ if ( $link_id ) : ?>
 
 </div>
 </div>
 
 </div>
 </div>
-
 </div>
 
 </form>
 </div>
 
 </form>
+</div>
index eb58d20c268ee9d2d8f46539c6ed689d10c27887..5d1caea078ca9b3e612936716cfd9d78bf66cb8f 100644 (file)
@@ -1,10 +1,29 @@
 <?php
 <?php
+/**
+ * Edit page form for inclusion in the administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Post ID global.
+ * @name $post_ID
+ * @var int
+ */
+if ( ! isset( $post_ID ) )
+       $post_ID = 0;
+if ( ! isset( $temp_ID ) )
+       $temp_ID = 0;
+
 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( $_GET['_wp_original_http_referer'] ) ) );
+$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[2] = __('Custom field updated.');
 $messages[3] = __('Custom field deleted.');
 $messages[4] = __('Page updated.');
 $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) ) );
 
 if ( isset($_GET['revision']) )
        $messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
 
 if ( isset($_GET['revision']) )
        $messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
@@ -12,7 +31,7 @@ if ( isset($_GET['revision']) )
 $notice = false;
 $notices[1] = __( 'There is an autosave of this page that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
 
 $notice = false;
 $notices[1] = __( 'There is an autosave of this page that is more recent than the version below.  <a href="%s">View the autosave</a>.' );
 
-if (!isset($post_ID) || 0 == $post_ID) {
+if ( 0 == $post_ID) {
        $form_action = 'post';
        $nonce_action = 'add-page';
        $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
        $form_action = 'post';
        $nonce_action = 'add-page';
        $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
@@ -22,7 +41,7 @@ if (!isset($post_ID) || 0 == $post_ID) {
        $form_action = 'editpost';
        $nonce_action = 'update-page_' . $post_ID;
        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
        $form_action = 'editpost';
        $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 );
+       $autosave = wp_get_post_autosave( $post_ID );
        if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
 }
        if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
                $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
 }
@@ -30,193 +49,277 @@ if (!isset($post_ID) || 0 == $post_ID) {
 $temp_ID = (int) $temp_ID;
 $user_ID = (int) $user_ID;
 
 $temp_ID = (int) $temp_ID;
 $user_ID = (int) $user_ID;
 
+/**
+ * Display submit form fields.
+ *
+ * @since 2.7.0
+ *
+ * @param object $post
+ */
+function page_submit_meta_box($post) {
+       global $action;
+
+       $can_publish = current_user_can('publish_pages');
 ?>
 ?>
+<div class="submitbox" id="submitpage">
 
 
-<?php if ( $notice ) : ?>
-<div id="notice" class="error"><p><?php echo $notice ?></p></div>
-<?php endif; ?>
-<?php if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-<?php endif; ?>
+<div id="minor-publishing">
 
 
-<form name="post" action="page.php" method="post" id="post">
-<div class="wrap">
-<h2><?php _e('Write Page') ?></h2>
+<?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') ); ?>" />
+</div>
 
 
-<?php
-wp_nonce_field($nonce_action);
+<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" />
+<?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" />
+<?php } ?>
+</div>
 
 
-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 ?>" />
-<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 ); ?>" />
-<?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())); ?>" />
-<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
+<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)))); ?>
 
 
-<div id="poststuff">
+<a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview" id="post-preview" tabindex="4"><?php _e('Preview'); ?></a>
+<input type="hidden" name="wp-preview" id="wp-preview" value="" />
+</div>
 
 
-<div class="submitbox" id="submitpage">
+<div class="clear"></div>
+</div><?php // /minor-publishing-actions ?>
 
 
-<div id="previewview">
-<?php if ( 'publish' == $post->post_status ) { ?>
-<a href="<?php echo clean_url(get_permalink($post->ID)); ?>" target="_blank"  tabindex="4"><?php _e('View this Page'); ?></a>
-<?php } elseif ( 'edit' == $action ) { ?>
-<a href="<?php echo clean_url(apply_filters('preview_post_link', add_query_arg('preview', 'true', get_permalink($post->ID)))); ?>" target="_blank" tabindex="4"><?php _e('Preview this Page'); ?></a>
-<?php } ?>
-</div>
+<div id="misc-publishing-actions">
 
 
-<div class="inside">
-<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
-<p>
-<select name='post_status' tabindex='4' id='post_status'>
-<?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages')
-// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown)
-if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) : 
+<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">
+<?php
+switch ( $post->post_status ) {
+       case 'private':
+               _e('Privately Published');
+               break;
+       case 'publish':
+               _e('Published');
+               break;
+       case 'future':
+               _e('Scheduled');
+               break;
+       case 'pending':
+               _e('Pending Review');
+               break;
+       case 'draft':
+               _e('Draft');
+               break;
+}
 ?>
 ?>
-<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
-<?php endif; ?>
-<?php if ( 'future' == $post->post_status ) : ?>
-<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
+</span></b>
+<?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; ?>" />
+<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>
+<?php elseif ( 'private' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
+<?php elseif ( 'future' == $post->post_status ) : ?>
+<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
 <?php endif; ?>
 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
 <?php endif; ?>
 <option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
-<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
+<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
 </select>
 </select>
+
+ <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
+ <a href="#post_status" class="cancel-post-status hide-if-no-js"><?php _e('Cancel'); ?></a>
+</div>
+
+<?php } ?>
+</div><?php // /misc-pub-section ?>
+
+<div class="misc-pub-section " id="visibility">
+<?php _e('Visibility:'); ?> <b><span id="post-visibility-display"><?php
+
+if ( 'private' == $post->post_status ) {
+       $post->post_password = '';
+       $visibility = 'private';
+       $visibility_trans = __('Private');
+} elseif ( !empty( $post->post_password ) ) {
+       $visibility = 'password';
+       $visibility_trans = __('Password protected');
+} else {
+       $visibility = '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>
+
+<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="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>
+<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>
-<?php if ( current_user_can( 'publish_posts' ) ) : ?> 
-<p id="private-checkbox"><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>
-<?php endif; ?>
+</div>
+<?php } ?>
+
+</div><?php // /misc-pub-section ?>
 
 <?php
 
 <?php
-if ($post_ID) {
+$datef = _c( 'M j, Y @ G:i|Publish box date format');
+if ( 0 != $post->ID ) {
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
        if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
-               $stamp = __('Scheduled for:<br />%1$s at %2$s');
-       } else if ( 'publish' == $post->post_status ) { // already published
-               $stamp = __('Published on:<br />%1$s at %2$s');
-       } else if ( '0000-00-00 00:00:00' == $post->post_date ) { // draft, 1 or more saves, no date specified
-               $stamp = __('Publish immediately');
+               $stamp = __('Scheduled for: <b>%1$s</b>');
+       } else if ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
+               $stamp = __('Published on: <b>%1$s</b>');
+       } else if ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
+               $stamp = __('Publish <b>immediately</b>');
+       } else if ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
+               $stamp = __('Schedule for: <b>%1$s</b>');
        } else { // draft, 1 or more saves, date specified
        } else { // draft, 1 or more saves, date specified
-               $stamp = __('Publish on:<br />%1$s at %2$s');
+               $stamp = __('Publish on: <b>%1$s</b>');
        }
        }
-       $date = mysql2date(get_option('date_format'), $post->post_date);
-       $time = mysql2date(get_option('time_format'), $post->post_date);
+       $date = date_i18n( $datef, strtotime( $post->post_date ) );
 } else { // draft (no saves, and thus no date specified)
 } else { // draft (no saves, and thus no date specified)
-       $stamp = __('Publish immediately');
-       $date = mysql2date(get_option('date_format'), current_time('mysql'));
-       $time = mysql2date(get_option('time_format'), current_time('mysql'));
+       $stamp = __('Publish <b>immediately</b>');
+       $date = date_i18n( $datef, strtotime( current_time('mysql') ) );
 }
 ?>
 }
 ?>
-<p class="curtime"><?php printf($stamp, $date, $time); ?>
-&nbsp;<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js" tabindex='4'><?php _e('Edit') ?></a></p>
+<?php 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>
+       <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 id='timestampdiv' class='hide-if-js'><?php touch_time(($action == 'edit'),1,4); ?></div>
+</div>
+<div class="clear"></div>
+</div>
 
 
+<div id="major-publishing-actions">
+<?php do_action('post_submitbox_start'); ?>
+<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>
+<?php } ?>
 </div>
 
 </div>
 
-<p class="submit">
-<input type="submit" name="save" class="button button-highlighted" value="<?php _e('Save'); ?>" tabindex="4" />
+<div id="publishing-action">
 <?php
 <?php
-if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
-?>
-<?php if ( current_user_can('publish_pages') ) : ?>
-       <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />
+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 : ?>
 <?php else : ?>
-       <input name="publish" type="submit" class="button" id="publish" tabindex="5" accesskey="p" value="<?php _e('Submit for Review') ?>" />
+       <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 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 } ?>
+</div>
+<div class="clear"></div>
+</div>
+</div>
 <?php
 }
 <?php
 }
-
-if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
-       echo "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;post=$post_ID", 'delete-page_' . $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 page '%s'\n  'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete&nbsp;page') . "</a>";
+add_meta_box('pagesubmitdiv', __('Publish'), 'page_submit_meta_box', 'page', 'side', 'core');
+
+/**
+ * Display page password form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
+function page_password_meta_box($post){
 ?>
 ?>
-<br class="clear" />
-<?php if ($post_ID): ?>
-<?php 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));
-} 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));
+<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><?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
 }
 }
+// add_meta_box('pagepassworddiv', __('Privacy Options'), 'page_password_meta_box', 'page', 'side', 'core');
+
+/**
+ * Display page attributes form fields.
+ *
+ * @since 2.7.0
+ *
+ * @param object $post
+ */
+function page_attributes_meta_box($post){
 ?>
 ?>
-<br class="clear" />
-<?php endif; ?>
-<span id="autosave"></span>
-<span id="wp-word-count"></span>
-</p>
-
-<div class="side-info">
-<h5><?php _e('Related') ?></h5>
-
-<ul>
-<?php if ($post_ID): ?>
-<li><a href="edit-pages.php?page_id=<?php echo $post_ID ?>"><?php _e('See Comments on this Page') ?></a></li>
-<?php endif; ?>
-<li><a href="edit-comments.php"><?php _e('Manage All Comments') ?></a></li>
-<li><a href="edit-pages.php"><?php _e('Manage All Pages') ?></a></li>
-<?php do_action('page_relatedlinks_list'); ?>
-</ul>
-</div>
-<?php do_action('submitpage_box'); ?>
-</div>
-
-<div id="post-body">
-<div id="titlediv">
-<h3><label for="title"><?php _e('Title') ?></label></h3>
-<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" />
-</div>
-<div class="inside">
-<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
-       <div id="edit-slug-box">
-<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
-       echo $sample_permalink_html;
-endif; ?>
-       </div>
-</div>
-</div>
-
-<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><label for="content"><?php _e('Page') ?></label></h3>
-<?php the_editor($post->post_content); ?>
-<?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 ); ?>
-</div>
-
-<?php do_meta_boxes('page', 'normal', $post); ?>
-
-<?php do_action('edit_page_form'); ?>
-
-<h2><?php _e('Advanced Options'); ?></h2>
-
-
-<?php 
+<h5><?php _e('Parent') ?></h5>
+<label class="hidden" 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
+       if ( 0 != count( get_page_templates() ) ) {
+?>
+<h5><?php _e('Template') ?></h5>
+<label class="hidden" 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
+       }
+?>
+<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><?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
+}
+add_meta_box('pageparentdiv', __('Attributes'), 'page_attributes_meta_box', 'page', 'side', 'core');
+
+/**
+ * Display custom field for page form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function page_custom_meta_box($post){
 ?>
 <div id="postcustomstuff">
 function page_custom_meta_box($post){
 ?>
 <div id="postcustomstuff">
-<table cellpadding="3">
 <?php
 $metadata = has_meta($post->ID);
 list_meta($metadata);
 <?php
 $metadata = has_meta($post->ID);
 list_meta($metadata);
-?>
-
-</table>
-<?php
-       meta_form();
+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 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
 }
-add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'advanced', 'core');
-
+add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'normal', 'core');
+
+/**
+ * Display comments status form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function page_comments_status_meta_box($post){
 ?>
 <input name="advanced_view" type="hidden" value="1" />
 function page_comments_status_meta_box($post){
 ?>
 <input name="advanced_view" type="hidden" value="1" />
@@ -225,92 +328,168 @@ function page_comments_status_meta_box($post){
 <?php _e('Allow Comments') ?></label></p>
 <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 Pings') ?></label></p>
 <p><?php _e('These settings apply to this page only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
 <?php _e('Allow Comments') ?></label></p>
 <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 Pings') ?></label></p>
 <p><?php _e('These settings apply to this page only. &#8220;Pings&#8221; are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
-<?php 
-}
-add_meta_box('pagecommentstatusdiv', __('Comments &amp; Pings'), 'page_comments_status_meta_box', 'page', 'advanced', 'core');
-
-function page_password_meta_box($post){
-?>
-<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 echo attribute_escape( $post->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
 }
 <?php
 }
-add_meta_box('pagepassworddiv', __('Password Protect This Page'), 'page_password_meta_box', 'page', 'advanced', 'core');
-
+add_meta_box('pagecommentstatusdiv', __('Discussion'), 'page_comments_status_meta_box', 'page', 'normal', 'core');
+
+/**
+ * Display page slug form fields.
+ *
+ * @since 2.6.0
+ *
+ * @param object $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 ); ?>" />
 <?php
 }
 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 ); ?>" />
 <?php
 }
-add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'advanced', 'core');
-
-function page_parent_meta_box($post){
-?>
-<label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label>
-<select name="parent_id" id="parent_id">
-<option value='0'><?php _e('Main Page (no parent)'); ?></option>
-<?php parent_dropdown($post->post_parent); ?>
-</select>
-<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
-}
-add_meta_box('pageparentdiv', __('Page Parent'), 'page_parent_meta_box', 'page', 'advanced', 'core');
-
-if ( 0 != count( get_page_templates() ) ) {
-       function page_template_meta_box($post){
-?>
-<label class="hidden" 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
-       }
-       add_meta_box('pagetemplatediv', __('Page Template'), 'page_template_meta_box', 'page', 'advanced', 'core');
-}
-
-function page_order_meta_box($post){
-?>
-<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><?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
-}
-add_meta_box('pageorderdiv', __('Page Order'), 'page_order_meta_box', 'page', 'advanced', 'core');
-
+add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'normal', 'core');
 
 
-$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
+$authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
 if ( $post->post_author && !in_array($post->post_author, $authors) )
        $authors[] = $post->post_author;
 if ( $authors && count( $authors ) > 1 ) {
 if ( $post->post_author && !in_array($post->post_author, $authors) )
        $authors[] = $post->post_author;
 if ( $authors && count( $authors ) > 1 ) {
+       /**
+        * Display page author form fields, when more than one author exists.
+        *
+        * @since 2.6.0
+        *
+        * @param object $post
+        */
        function page_author_meta_box($post){
                global $current_user, $user_ID;
        function page_author_meta_box($post){
                global $current_user, $user_ID;
-               $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
+               $authors = get_editable_user_ids( $current_user->id, true, 'page' ); // TODO: ROLE SYSTEM
                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) ); ?>
 <?php
        }
                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) ); ?>
 <?php
        }
-       add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'advanced', 'core');
+       add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'normal', 'core');
 }
 
 }
 
-
-if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+if ( 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+/**
+ * Display list of page revisions.
+ *
+ * @since 2.6.0
+ *
+ * @param object $post
+ */
 function page_revisions_meta_box($post) {
        wp_list_post_revisions();
 }
 function page_revisions_meta_box($post) {
        wp_list_post_revisions();
 }
-add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'advanced', 'core');
+add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'normal', 'core');
 endif;
 
 endif;
 
-do_meta_boxes('page', 'advanced', $post);
+do_action('do_meta_boxes', 'page', 'normal', $post);
+do_action('do_meta_boxes', 'page', 'advanced', $post);
+do_action('do_meta_boxes', 'page', 'side', $post);
+
+require_once('admin-header.php');
+?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
+<form name="post" action="page.php" method="post" id="post">
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
+<?php if (isset($_GET['message'])) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+
+<?php
+wp_nonce_field($nonce_action);
+
+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 ?>" />
+<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 ); ?>" />
+<?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())); ?>" />
+<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
+
+<div id="poststuff" class="metabox-holder">
+
+<div id="side-info-column" class="inner-sidebar">
+
+<?php
+
+do_action('submitpage_box');
+$side_meta_boxes = do_meta_boxes('page', '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="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" />
+</div>
+<div class="inside">
+<?php $sample_permalink_html = get_sample_permalink_html($post->ID); ?>
+       <div id="edit-slug-box">
+<?php if ( ! empty($post->ID) && ! empty($sample_permalink_html) ) :
+       echo $sample_permalink_html;
+endif; ?>
+       </div>
+</div>
+</div>
 
 
+<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">
+       <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));
+               } 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>
 </div>
+
+<?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 ); ?>
 </div>
 
 </div>
 
+<?php
+
+do_meta_boxes('page', 'normal', $post);
+do_action('edit_page_form');
+do_meta_boxes('page', 'advanced', $post);
+
+?>
+
+</div>
+</div>
 </div>
 
 </form>
 </div>
 
 </form>
+</div>
 
 <script type="text/javascript">
 try{document.post.title.focus();}catch(e){}
 
 <script type="text/javascript">
 try{document.post.title.focus();}catch(e){}
index c49bc1ffc28f9c2ffee27403a80b21ce6cdc5376..fd817e3ad14b8558d5ac311939e7ec7e6acf5deb 100644 (file)
 <?php
 <?php
+/**
+ * Edit Pages Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-// Handle bulk deletes
-if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
-       check_admin_referer('bulk-pages');
-       foreach( (array) $_GET['delete'] as $post_id_del ) {
-               $post_del = & get_post($post_id_del);
-
-               if ( !current_user_can('delete_page', $post_id_del) )
-                       wp_die( __('You are not allowed to delete this page.') );
-
-               if ( $post_del->post_type == 'attachment' ) {
-                       if ( ! wp_delete_attachment($post_id_del) )
-                               wp_die( __('Error in deleting...') );
-               } else {
-                       if ( !wp_delete_post($post_id_del) )
-                               wp_die( __('Error in deleting...') );
-               }
+// Handle bulk actions
+if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
+       $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
+
+       switch ( $doaction ) {
+               case 'delete':
+                       if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
+                               check_admin_referer('bulk-pages');
+                               $deleted = 0;
+                               foreach( (array) $_GET['post'] as $post_id_del ) {
+                                       $post_del = & get_post($post_id_del);
+
+                                       if ( !current_user_can('delete_page', $post_id_del) )
+                                               wp_die( __('You are not allowed to delete this page.') );
+
+                                       if ( $post_del->post_type == 'attachment' ) {
+                                               if ( ! wp_delete_attachment($post_id_del) )
+                                                       wp_die( __('Error in deleting...') );
+                                       } else {
+                                               if ( !wp_delete_post($post_id_del) )
+                                                       wp_die( __('Error in deleting...') );
+                                       }
+                                       $deleted++;
+                               }
+                       }
+                       break;
+               case 'edit':
+                       if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
+                               check_admin_referer('bulk-pages');
+
+                               if ( -1 == $_GET['_status'] ) {
+                                       $_GET['post_status'] = null;
+                                       unset($_GET['_status'], $_GET['post_status']);
+                               } else {
+                                       $_GET['post_status'] = $_GET['_status'];
+                               }
+
+                               $done = bulk_edit_posts($_GET);
+                       }
+                       break;
        }
 
        $sendback = wp_get_referer();
        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
        }
 
        $sendback = wp_get_referer();
        if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
-       $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
-
+       if ( isset($done) ) {
+               $done['updated'] = count( $done['updated'] );
+               $done['skipped'] = count( $done['skipped'] );
+               $done['locked'] = count( $done['locked'] );
+               $sendback = add_query_arg( $done, $sendback );
+       }
+       if ( isset($deleted) )
+               $sendback = add_query_arg('deleted', $deleted, $sendback);
        wp_redirect($sendback);
        exit();
        wp_redirect($sendback);
        exit();
-} elseif ( !empty($_GET['_wp_http_referer']) ) {
-        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
         exit;
 }
 
-$title = __('Pages');
-$parent_file = 'edit.php';
-wp_enqueue_script('admin-forms');
+if ( empty($title) )
+       $title = __('Edit Pages');
+$parent_file = 'edit-pages.php';
+wp_enqueue_script('inline-edit-post');
 
 $post_stati  = array(  //      array( adj, noun )
 
 $post_stati  = array(  //      array( adj, noun )
-               'publish' => array(__('Published'), __('Published pages'), __ngettext_noop('Published (%s)', 'Published (%s)')),
-               'future' => array(__('Scheduled'), __('Scheduled pages'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
-               'pending' => array(__('Pending Review'), __('Pending pages'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
-               'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
-               'private' => array(__('Private'), __('Private pages'), __ngettext_noop('Private (%s)', 'Private (%s)'))
+               '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>'))
        );
 
        );
 
-$post_status_label = __('Manage Pages');
-$post_status_q = '';
+$query = array('post_type' => 'page', 'orderby' => 'menu_order title', 'what_to_show' => 'posts',
+       'posts_per_page' => -1, 'posts_per_archive_page' => -1, 'order' => 'asc');
+
+$post_status_label = __('Pages');
 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
        $post_status_label = $post_stati[$_GET['post_status']][1];
 if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) {
        $post_status_label = $post_stati[$_GET['post_status']][1];
-       $post_status_q = '&post_status=' . $_GET['post_status'];
-       $post_status_q .= '&perm=readable';
+       $query['post_status'] = $_GET['post_status'];
+       $query['perm'] = 'readable';
 }
 
 }
 
-$query_str = "post_type=page&orderby=menu_order title&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc";
+$query = apply_filters('manage_pages_query', $query);
+wp($query);
 
 
-$query_str = apply_filters('manage_pages_query', $query_str);
-wp($query_str);
-
-if ( is_singular() )
+if ( is_singular() ) {
        wp_enqueue_script( 'admin-comments' );
        wp_enqueue_script( 'admin-comments' );
-require_once('admin-header.php');
+       enqueue_comment_hotkeys_js();
+}
+
+require_once('admin-header.php'); ?>
 
 
-?>
 <div class="wrap">
 <div class="wrap">
-<form id="posts-filter" action="" method="get">
-<h2><?php
-// Use $_GET instead of is_ since they can override each other
-$h2_search = isset($_GET['s']) && $_GET['s'] ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( stripslashes( $_GET['s'] ) ) ) : '';
-$h2_author = '';
-if ( isset($_GET['author']) && $_GET['author'] ) {
-       $author_user = get_userdata( (int) $_GET['author'] );
-       $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
+<?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 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'] ) );
+       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'] ) );
+       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'] ) );
+       unset($_GET['locked']);
+}
+
+if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
+       printf( __ngettext( 'Page deleted.', '%s pages deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
+       unset($_GET['deleted']);
 }
 }
-printf( _c( '%1$s%2$s%3$s|You can reorder these: 1: Pages, 2: by {s}, 3: matching {s}' ), $post_status_label, $h2_author, $h2_search );
-?></h2>
+$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
+?>
+</p></div>
+<?php } ?>
+
+<?php if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
+<div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit page'); ?></a></p></div>
+<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
+endif; ?>
 
 
+<form id="posts-filter" action="" method="get">
 <ul class="subsubsub">
 <?php
 
 $avail_post_stati = get_available_post_statuses('page');
 <ul class="subsubsub">
 <?php
 
 $avail_post_stati = get_available_post_statuses('page');
-
+if ( empty($locked_post_status) ) :
 $status_links = array();
 $num_posts = wp_count_posts('page', 'readable');
 $status_links = array();
 $num_posts = wp_count_posts('page', 'readable');
+$total_posts = array_sum( (array) $num_posts );
 $class = empty($_GET['post_status']) ? ' class="current"' : '';
 $class = empty($_GET['post_status']) ? ' class="current"' : '';
-$status_links[] = "<li><a href=\"edit-pages.php\"$class>".__('All Pages')."</a>";
+$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>';
 foreach ( $post_stati as $status => $label ) {
        $class = '';
 
        if ( !in_array($status, $avail_post_stati) )
                continue;
 
 foreach ( $post_stati as $status => $label ) {
        $class = '';
 
        if ( !in_array($status, $avail_post_stati) )
                continue;
 
-       if ( $status == $_GET['post_status'] )
+       if ( isset( $_GET['post_status'] ) && $status == $_GET['post_status'] )
                $class = ' class="current"';
 
                $class = ' class="current"';
 
-       $status_links[] = "<li><a href=\"edit-pages.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-pages.php?post_status=$status'$class>" . sprintf( _nc( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
 }
 }
-echo implode(' |</li>', $status_links) . '</li>';
+echo implode( " |</li>\n", $status_links ) . '</li>';
 unset($status_links);
 unset($status_links);
+endif;
 ?>
 </ul>
 
 ?>
 </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" />
+</p>
+
 <?php if ( isset($_GET['post_status'] ) ) : ?>
 <input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
 <?php if ( isset($_GET['post_status'] ) ) : ?>
 <input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
-<?php
-endif;
-if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
-<div id="message" class="updated fade"><p><strong><?php _e('Your page has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View page'); ?></a> | <a href="page.php?action=edit&amp;post=<?php echo $_GET['posted']; ?>"><?php _e('Edit page'); ?></a></p></div>
-<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
-endif;
-?>
+<?php endif; ?>
 
 
-<p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Pages' ); ?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
-       <input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
-</p>
+<?php if ($posts) { ?>
 
 <div class="tablenav">
 
 <?php
 
 <div class="tablenav">
 
 <?php
-$pagenum = absint( $_GET['pagenum'] );
+$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 if ( empty($pagenum) )
        $pagenum = 1;
-if( !$per_page || $per_page < 0 )
+if( ! isset( $per_page ) || $per_page < 0 )
        $per_page = 20;
 
        $per_page = 20;
 
-$num_pages = ceil(count($posts) / $per_page);
+$num_pages = ceil($wp_query->post_count / $per_page);
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
        'total' => $num_pages,
        'current' => $pagenum
 ));
 
        'total' => $num_pages,
        'current' => $pagenum
 ));
 
-if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
-?>
-
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+if ( $page_links ) : ?>
+<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
+       number_format_i18n( ( $pagenum - 1 ) * $per_page + 1 ),
+       number_format_i18n( min( $pagenum * $per_page, $wp_query->post_count ) ),
+       number_format_i18n( $wp_query->post_count ),
+       $page_links
+); echo $page_links_text; ?></div>
+<?php endif; ?>
+
+<div class="alignleft actions">
+<select name="action">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<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" />
 <?php wp_nonce_field('bulk-pages'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
 <?php wp_nonce_field('bulk-pages'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
-<br class="clear" />
+<div class="clear"></div>
 
 
-<?php
-
-$all = !( $h2_search || $post_status_q );
-
-if ($posts) {
-?>
-<table class="widefat">
+<table class="widefat page fixed" cellspacing="0">
   <thead>
   <tr>
   <thead>
   <tr>
-<?php $posts_columns = wp_manage_pages_columns(); ?>
-<?php foreach($posts_columns as $post_column_key => $column_display_name) {
-       if ( 'cb' === $post_column_key )
-               $class = ' class="check-column"';
-       elseif ( 'comments' === $post_column_key )
-               $class = ' class="num"';
-       else
-               $class = '';
-?>
-       <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
-<?php } ?>
+<?php print_column_headers('edit-pages'); ?>
   </tr>
   </thead>
   </tr>
   </thead>
+
+  <tfoot>
+  <tr>
+<?php print_column_headers('edit-pages', false); ?>
+  </tr>
+  </tfoot>
+
   <tbody>
   <?php page_rows($posts, $pagenum, $per_page); ?>
   </tbody>
 </table>
 
   <tbody>
   <?php page_rows($posts, $pagenum, $per_page); ?>
   </tbody>
 </table>
 
-</form>
-
-<div id="ajax-response"></div>
-
+<div class="tablenav">
 <?php
 <?php
-} else {
+if ( $page_links )
+       echo "<div class='tablenav-pages'>$page_links_text</div>";
 ?>
 ?>
-</form>
+
+<div class="alignleft actions">
+<select name="action2">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<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" />
+</div>
+
+<br class="clear" />
+</div>
+
+<?php } else { ?>
+<div class="clear"></div>
 <p><?php _e('No pages found.') ?></p>
 <?php
 } // end if ($posts)
 ?>
 
 <p><?php _e('No pages found.') ?></p>
 <?php
 } // end if ($posts)
 ?>
 
-<div class="tablenav">
-<?php
-if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
-?>
-<br class="clear" />
-</div>
+</form>
+
+<?php inline_edit_row( 'page' ) ?>
+
+<div id="ajax-response"></div>
+
 
 <?php
 
 
 <?php
 
@@ -209,24 +287,24 @@ if ( 1 == count($posts) && is_singular() ) :
 
 <br class="clear" />
 
 
 <br class="clear" />
 
-<table class="widefat" style="margin-top: .5em">
+<table class="widefat" cellspacing="0">
 <thead>
   <tr>
 <thead>
   <tr>
-    <th scope="col"><?php _e('Comment') ?></th>
-    <th scope="col"><?php _e('Date') ?></th>
-    <th scope="col"><?php _e('Actions') ?></th>
+    <th scope="col" class="column-comment"><?php echo _c('Comment|noun') ?></th>
+    <th scope="col" class="column-author"><?php _e('Author') ?></th>
+    <th scope="col" class="column-date"><?php _e('Submitted') ?></th>
   </tr>
 </thead>
 <tbody id="the-comment-list" class="list:comment">
 <?php
        foreach ($comments as $comment)
   </tr>
 </thead>
 <tbody id="the-comment-list" class="list:comment">
 <?php
        foreach ($comments as $comment)
-               _wp_comment_row( $comment->comment_ID, 'detail', false, false );
+               _wp_comment_row( $comment->comment_ID, 'single', false, false );
 ?>
 </tbody>
 </table>
 
 <?php
 ?>
 </tbody>
 </table>
 
 <?php
-
+wp_comment_reply();
 endif; // comments
 endif; // posts;
 
 endif; // comments
 endif; // posts;
 
@@ -234,4 +312,20 @@ 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 0906b68c8bb69050b1f7c9470812f1292f9e9d67..37e58f0a302403e4d981772f963c00a7ca511126 100644 (file)
-<?php if ( ! defined('ABSPATH') ) die(); ?>
-<table class="widefat">
+<?php
+/**
+ * Edit posts rows table for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( ! defined('ABSPATH') ) die();
+?>
+<table class="widefat post fixed" cellspacing="0">
        <thead>
        <tr>
        <thead>
        <tr>
-
-<?php $posts_columns = wp_manage_posts_columns(); ?>
-<?php foreach($posts_columns as $post_column_key => $column_display_name) {
-       if ( 'cb' === $post_column_key )
-               $class = ' class="check-column"';
-       elseif ( 'comments' === $post_column_key )
-               $class = ' class="num"';
-       else
-               $class = '';
-?>
-       <th scope="col"<?php echo $class; ?>><?php echo $column_display_name; ?></th>
-<?php } ?>
-
+<?php print_column_headers('edit'); ?>
        </tr>
        </thead>
        </tr>
        </thead>
-       <tbody>
-<?php
-if ( have_posts() ) {
-$bgcolor = '';
-add_filter('the_title','wp_specialchars');
-
-// Create array of post IDs.
-$post_ids = array();
-foreach ( $wp_query->posts as $a_post )
-       $post_ids[] = $a_post->ID;
-
-$comment_pending_count = get_pending_comments_num($post_ids);
-
-while (have_posts()) : the_post();
-$class = 'alternate' == $class ? '' : 'alternate';
-global $current_user;
-$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
-$title = get_the_title();
-if ( empty($title) )
-       $title = __('(no title)');
-?>
-       <tr id='post-<?php echo $id; ?>' class='<?php echo trim( $class . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
-
-<?php
-
-foreach($posts_columns as $column_name=>$column_display_name) {
-
-       switch($column_name) {
-
-       case 'cb':
-               ?>
-               <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /><?php } ?></th>
-               <?php
-               break;
-       case 'modified':
-       case 'date':
-               if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
-                       $t_time = $h_time = __('Unpublished');
-               } else {
-                       if ( 'modified' == $column_name ) {
-                               $t_time = get_the_modified_time(__('Y/m/d g:i:s A'));
-                               $m_time = $post->post_modified;
-                               $time = get_post_modified_time('G', true);
-                       } else {
-                               $t_time = get_the_time(__('Y/m/d g:i:s A'));
-                               $m_time = $post->post_date;
-                               $time = get_post_time('G', true);
-                       }
-                       if ( ( abs(time() - $time) ) < 86400 ) {
-                               if ( ( 'future' == $post->post_status) )
-                                       $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
-                               else
-                                       $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
-                       } else {
-                               $h_time = mysql2date(__('Y/m/d'), $m_time);
-                       }
-               }
-               ?>
-               <td><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name) ?></abbr></td>
-               <?php
-               break;
-       case 'title':
-               ?>
-               <td><strong><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><a class="row-title" href="post.php?action=edit&amp;post=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $title ?></a><?php } else { echo $title; } ?></strong>
-               <?php if ( !empty($post->post_password) ) { _e(' &#8212; <strong>Protected</strong>'); } elseif ('private' == $post->post_status) { _e(' &#8212; <strong>Private</strong>'); } ?></td>
-               <?php
-               break;
 
 
-       case 'categories':
-               ?>
-               <td><?php
-               $categories = get_the_category();
-               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>";
-                       echo join( ', ', $out );
-               } else {
-                       _e('Uncategorized');
-               }
-               ?></td>
-               <?php
-               break;
-
-       case 'tags':
-               ?>
-               <td><?php
-               $tags = get_the_tags();
-               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>";
-                       echo join( ', ', $out );
-               } else {
-                       _e('No Tags');
-               }
-               ?></td>
-               <?php
-               break;
-
-       case 'comments':
-               ?>
-               <td class="num"><div class="post-com-count-wrapper">
-               <?php
-               $left = isset($comment_pending_count) ? $comment_pending_count[$post->ID] : 0;
-               $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
-               if ( $left )
-                       echo '<strong>';
-               comments_number("<a href='edit.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit.php?p=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
-               if ( $left )
-                       echo '</strong>';
-               ?>
-               </div></td>
-               <?php
-               break;
-
-       case 'author':
-               ?>
-               <td><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
-               <?php
-               break;
-
-       case 'status':
-               ?>
-               <td>
-               <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink">
-               <?php
-               switch ( $post->post_status ) {
-                       case 'publish' :
-                       case 'private' :
-                               _e('Published');
-                               break;
-                       case 'future' :
-                               _e('Scheduled');
-                               break;
-                       case 'pending' :
-                               _e('Pending Review');
-                               break;
-                       case 'draft' :
-                               _e('Unpublished');
-                               break;
-               }
-               ?>
-               </a>
-               </td>
-               <?php
-               break;
-
-       case 'control_view':
-               ?>
-               <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
-               <?php
-               break;
-
-       case 'control_edit':
-               ?>
-               <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td>
-               <?php
-               break;
-
-       case 'control_delete':
-               ?>
-               <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>
-               <?php
-               break;
-
-       default:
-               ?>
-               <td><?php do_action('manage_posts_custom_column', $column_name, $id); ?></td>
-               <?php
-               break;
-       }
-}
-?>
+       <tfoot>
+       <tr>
+<?php print_column_headers('edit', false); ?>
        </tr>
        </tr>
-<?php
-endwhile;
-} else {
-?>
-  <tr style='background-color: <?php echo $bgcolor; ?>'>
-    <td colspan="8"><?php _e('No posts found.') ?></td>
-  </tr>
-<?php
-} // end if ( have_posts() )
-?>
+       </tfoot>
+
+       <tbody>
+<?php post_rows(); ?>
        </tbody>
        </tbody>
-</table>
+</table>
\ No newline at end of file
index de0f6c8f778c6288f5081eb2f7f47499ee16de39..f2218ac067433cf2ddd37771fe998b2b62e11e89 100644 (file)
@@ -1,41 +1,40 @@
 <?php
 <?php
-if ( ! empty($tag_ID) ) {
-       $heading = __('Edit Tag');
-       $submit_text = __('Edit Tag');
-       $form = '<form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate">';
-       $action = 'editedtag';
-       $nonce_action = 'update-tag_' . $tag_ID;
-       do_action('edit_tag_form_pre', $tag);
-} else {
-       $heading = __('Add Tag');
-       $submit_text = __('Add Tag');
-       $form = '<form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">';
-       $action = 'addtag';
-       $nonce_action = 'add-tag';
-       do_action('add_tag_form_pre', $tag);
+/**
+ * Edit tag form for inclusion in administration panels.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+if ( empty($tag_ID) ) { ?>
+       <div id="message" class="updated fade"><p><strong><?php _e('A tag was not selected for editing.'); ?></strong></p></div>
+<?php
+       return;
 }
 }
-?>
+
+do_action('edit_tag_form_pre', $tag); ?>
 
 <div class="wrap">
 
 <div class="wrap">
-<h2><?php echo $heading ?></h2>
+<?php screen_icon(); ?>
+<h2><?php _e('Edit Tag'); ?></h2>
 <div id="ajax-response"></div>
 <div id="ajax-response"></div>
-<?php echo $form ?>
-<input type="hidden" name="action" value="<?php echo $action ?>" />
+<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 $tag->term_id ?>" />
-<?php wp_original_referer_field(true, 'previous'); wp_nonce_field($nonce_action); ?>
+<?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>
        <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 echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
+                       <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>
                </tr>
                <tr class="form-field">
                        <th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
             <p><?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>
-                       <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
+                       <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>
                </tr>
        </table>
             <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>
                </tr>
        </table>
-<p class="submit"><input type="submit" class="button" name="submit" value="<?php echo $submit_text ?>" /></p>
+<p class="submit"><input type="submit" class="button-primary" name="submit" value="<?php _e('Update Tag'); ?>" /></p>
 <?php do_action('edit_tag_form', $tag); ?>
 </form>
 </div>
 <?php do_action('edit_tag_form', $tag); ?>
 </form>
 </div>
index fffe7cab0b4a3207b28693bef49781f6f1d69f36..41467ecb9a81de15ed8789dff98ab35dc09f3e74 100644 (file)
@@ -1,12 +1,19 @@
 <?php
 <?php
+/**
+ * Edit Tags Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __('Tags');
 require_once('admin.php');
 
 $title = __('Tags');
-$parent_file = 'edit.php';
 
 
-wp_reset_vars(array('action', 'tag'));
+wp_reset_vars( array('action', 'tag') );
 
 
-if ( isset($_GET['deleteit']) && isset($_GET['delete_tags']) )
+if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
        $action = 'bulk-delete';
 
 switch($action) {
        $action = 'bulk-delete';
 
 switch($action) {
@@ -65,6 +72,7 @@ case 'bulk-delete':
 break;
 
 case 'edit':
 break;
 
 case 'edit':
+       $title = __('Edit Tag');
 
        require_once ('admin-header.php');
        $tag_ID = (int) $_GET['tag_ID'];
 
        require_once ('admin-header.php');
        $tag_ID = (int) $_GET['tag_ID'];
@@ -100,13 +108,16 @@ break;
 
 default:
 
 
 default:
 
-if ( !empty($_GET['_wp_http_referer']) ) {
-        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
         exit;
 }
 
-wp_enqueue_script( 'admin-tags' );
-wp_enqueue_script('admin-forms');
+$can_manage = current_user_can('manage_categories');
+
+wp_enqueue_script('admin-tags');
+if ( $can_manage )
+       wp_enqueue_script('inline-edit-tax');
 
 require_once ('admin-header.php');
 
 
 require_once ('admin-header.php');
 
@@ -115,43 +126,47 @@ $messages[2] = __('Tag deleted.');
 $messages[3] = __('Tag updated.');
 $messages[4] = __('Tag not added.');
 $messages[5] = __('Tag not updated.');
 $messages[3] = __('Tag updated.');
 $messages[4] = __('Tag not added.');
 $messages[5] = __('Tag not updated.');
-$messages[6] = __('Tags deleted.');
-?>
+$messages[6] = __('Tags deleted.'); ?>
+
+<div class="wrap nosubsub">
+<?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( stripslashes($_GET['s']) ) ); ?>
+</h2>
 
 
-<?php if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 
 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
 endif; ?>
 
-<div class="wrap">
-
-<form id="posts-filter" action="" method="get">
-<?php if ( current_user_can('manage_categories') ) : ?>
-       <h2><?php printf(__('Manage Tags (<a href="%s">add new</a>)'), '#addtag') ?> </h2>
-<?php else : ?>
-       <h2><?php _e('Manage Tags') ?> </h2>
-<?php endif; ?>
-
-<p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Tags' ); ?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
+<form class="search-form" action="" method="get">
+<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" />
 </p>
        <input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
 </p>
-
+</form>
 <br class="clear" />
 
 <br class="clear" />
 
-<div class="tablenav">
+<div id="col-container">
 
 
+<div id="col-right">
+<div class="col-wrap">
+<form id="posts-filter" action="" method="get">
+<div class="tablenav">
 <?php
 <?php
-$pagenum = absint( $_GET['pagenum'] );
+$pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
 if ( empty($pagenum) )
        $pagenum = 1;
 if ( empty($pagenum) )
        $pagenum = 1;
-if( !$tagsperpage || $tagsperpage < 0 )
-       $tagsperpage = 20;
+
+$tagsperpage = apply_filters("tagsperpage",20);
 
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ),
        'format' => '',
 
 $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),
        'current' => $pagenum
 ));
        'total' => ceil(wp_count_terms('post_tag') / $tagsperpage),
        'current' => $pagenum
 ));
@@ -160,53 +175,127 @@ if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+<div class="alignleft actions">
+<select name="action">
+<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" />
 <?php wp_nonce_field('bulk-tags'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
 <?php wp_nonce_field('bulk-tags'); ?>
 </div>
 
 <br class="clear" />
 </div>
 
-<br class="clear" />
+<div class="clear"></div>
 
 
-<table class="widefat">
+<table class="widefat tag fixed" cellspacing="0">
        <thead>
        <tr>
        <thead>
        <tr>
-       <th scope="col" class="check-column"><input type="checkbox" /></th>
-        <th scope="col"><?php _e('Name') ?></th>
-        <th scope="col" class="num" style="width: 90px"><?php _e('Posts') ?></th>
+<?php print_column_headers('edit-tags'); ?>
        </tr>
        </thead>
        </tr>
        </thead>
+
+       <tfoot>
+       <tr>
+<?php print_column_headers('edit-tags', false); ?>
+       </tr>
+       </tfoot>
+
        <tbody id="the-list" class="list:tag">
 <?php
 
        <tbody id="the-list" class="list:tag">
 <?php
 
-$searchterms = trim( $_GET['s'] );
+$searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
 
 $count = tag_rows( $pagenum, $tagsperpage, $searchterms );
 ?>
        </tbody>
 </table>
 
 $count = tag_rows( $pagenum, $tagsperpage, $searchterms );
 ?>
        </tbody>
 </table>
-</form>
 
 <div class="tablenav">
 
 <div class="tablenav">
-
 <?php
 if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 <?php
 if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
+
+<div class="alignleft actions">
+<select name="action2">
+<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" />
+</div>
+
 <br class="clear" />
 </div>
 <br class="clear" />
 </div>
+
 <br class="clear" />
 <br class="clear" />
+</form>
+</div>
+</div><!-- /col-right -->
+
+<div id="col-left">
+<div class="col-wrap">
 
 
+<div class="tagcloud">
+<h3><?php _e('Popular Tags'); ?></h3>
+<?php
+if ( $can_manage )
+       wp_tag_cloud(array('link' => 'edit'));
+else
+       wp_tag_cloud();
+?>
+</div>
+
+<?php if ( $can_manage ) {
+       do_action('add_tag_form_pre'); ?>
+
+<div class="form-wrap">
+<h3><?php _e('Add a New Tag'); ?></h3>
+<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" />
+<?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>
 </div>
 
 </div>
 
-<?php if ( current_user_can('manage_categories') ) : ?>
+<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>
+</div>
 
 
-<br />
-<?php include('edit-tag-form.php'); ?>
+<p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p>
+<?php do_action('add_tag_form'); ?>
+</form></div>
+<?php } ?>
 
 
-<?php endif; ?>
+</div>
+</div><!-- /col-left -->
+
+</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
 break;
 
 <?php
 break;
index 467a9bb540314d995ca9aac9c967a9bd50a39201..9d148a81a82e482eca8eaad46c22821314ca2f9d 100644 (file)
 <?php
 <?php
+/**
+ * Edit Posts Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-// Handle bulk deletes
-if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
-       check_admin_referer('bulk-posts');
-       foreach( (array) $_GET['delete'] as $post_id_del ) {
-               $post_del = & get_post($post_id_del);
-
-               if ( !current_user_can('delete_post', $post_id_del) )
-                       wp_die( __('You are not allowed to delete this post.') );
-
-               if ( $post_del->post_type == 'attachment' ) {
-                       if ( ! wp_delete_attachment($post_id_del) )
-                               wp_die( __('Error in deleting...') );
-               } else {
-                       if ( !wp_delete_post($post_id_del) )
-                               wp_die( __('Error in deleting...') );
-               }
+// Back-compat for viewing comments of an entry
+if ( $_redirect = intval( max( @$_GET['p'], @$_GET['attachment_id'], @$_GET['page_id'] ) ) ) {
+       wp_redirect( admin_url('edit-comments.php?p=' . $_redirect ) );
+       exit;
+} else {
+       unset( $_redirect );
+}
+
+// Handle bulk actions
+if ( isset($_GET['action']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
+       $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
+
+       switch ( $doaction ) {
+               case 'delete':
+                       if ( isset($_GET['post']) && ! isset($_GET['bulk_edit']) && (isset($_GET['doaction']) || isset($_GET['doaction2'])) ) {
+                               check_admin_referer('bulk-posts');
+                               $deleted = 0;
+                               foreach( (array) $_GET['post'] as $post_id_del ) {
+                                       $post_del = & get_post($post_id_del);
+
+                                       if ( !current_user_can('delete_post', $post_id_del) )
+                                               wp_die( __('You are not allowed to delete this post.') );
+
+                                       if ( $post_del->post_type == 'attachment' ) {
+                                               if ( ! wp_delete_attachment($post_id_del) )
+                                                       wp_die( __('Error in deleting...') );
+                                       } else {
+                                               if ( !wp_delete_post($post_id_del) )
+                                                       wp_die( __('Error in deleting...') );
+                                       }
+                                       $deleted++;
+                               }
+                       }
+                       break;
+               case 'edit':
+                       if ( isset($_GET['post']) && isset($_GET['bulk_edit']) ) {
+                               check_admin_referer('bulk-posts');
+
+                               if ( -1 == $_GET['_status'] ) {
+                                       $_GET['post_status'] = null;
+                                       unset($_GET['_status'], $_GET['post_status']);
+                               } else {
+                                       $_GET['post_status'] = $_GET['_status'];
+                               }
+
+                               $done = bulk_edit_posts($_GET);
+                       }
+                       break;
        }
 
        $sendback = wp_get_referer();
        }
 
        $sendback = wp_get_referer();
-       if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
-       elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
-       $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
-
+       if ( strpos($sendback, 'post.php') !== false ) $sendback = admin_url('post-new.php');
+       elseif ( strpos($sendback, 'attachments.php') !== false ) $sendback = admin_url('attachments.php');
+       if ( isset($done) ) {
+               $done['updated'] = count( $done['updated'] );
+               $done['skipped'] = count( $done['skipped'] );
+               $done['locked'] = count( $done['locked'] );
+               $sendback = add_query_arg( $done, $sendback );
+       }
+       if ( isset($deleted) )
+               $sendback = add_query_arg('deleted', $deleted, $sendback);
        wp_redirect($sendback);
        exit();
        wp_redirect($sendback);
        exit();
-} elseif ( !empty($_GET['_wp_http_referer']) ) {
-        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
         exit;
 }
 
-$title = __('Posts');
+if ( empty($title) )
+       $title = __('Edit Posts');
 $parent_file = 'edit.php';
 $parent_file = 'edit.php';
-wp_enqueue_script('admin-forms');
+wp_enqueue_script('inline-edit-post');
 
 list($post_stati, $avail_post_stati) = wp_edit_posts_query();
 
 
 list($post_stati, $avail_post_stati) = wp_edit_posts_query();
 
-if ( 1 == count($posts) && is_singular() )
-       wp_enqueue_script( 'admin-comments' );
 require_once('admin-header.php');
 
 if ( !isset( $_GET['paged'] ) )
        $_GET['paged'] = 1;
 
 require_once('admin-header.php');
 
 if ( !isset( $_GET['paged'] ) )
        $_GET['paged'] = 1;
 
-?>
+if ( empty($_GET['mode']) )
+       $mode = 'list';
+else
+       $mode = attribute_escape($_GET['mode']); ?>
 
 <div class="wrap">
 
 <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>
 
 
-<form id="posts-filter" action="" method="get">
-<h2><?php
-if ( is_single() ) {
-       printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
-} else {
-       $post_status_label = _c('Manage Posts|manage posts header');
-       if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) )
-        $post_status_label = $post_stati[$_GET['post_status']][1];
-       if ( $post_listing_pageable && !is_archive() && !is_search() )
-               $h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_status_label) : sprintf(__('Latest %s'), $post_status_label);
-       else
-               $h2_noun = $post_status_label;
-       // Use $_GET instead of is_ since they can override each other
-       $h2_author = '';
-       $_GET['author'] = (int) $_GET['author'];
-       if ( $_GET['author'] != 0 ) {
-               if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion
-                       $h2_author = ' ' . __('by other authors');
-               } else {
-                       $author_user = get_userdata( get_query_var( 'author' ) );
-                       $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
-               }
-       }
-       $h2_search = isset($_GET['s'])   && $_GET['s']   ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( get_search_query() ) ) : '';
-       $h2_cat    = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in &#8220;%s&#8221;'), single_cat_title('', false) ) : '';
-       $h2_tag    = isset($_GET['tag']) && $_GET['tag'] ? ' ' . sprintf( __('tagged with &#8220;%s&#8221;'), single_tag_title('', false) ) : '';
-       $h2_month  = isset($_GET['m'])   && $_GET['m']   ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
-       printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month );
+<?php
+if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
+<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $_GET['posted'] ); ?>"><?php _e('Edit post'); ?></a></p></div>
+<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
+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'] ) {
+       printf( __ngettext( '%s post updated.', '%s posts updated.', $_GET['updated'] ), number_format_i18n( $_GET['updated'] ) );
+       unset($_GET['updated']);
+}
+
+if ( isset($_GET['skipped']) && (int) $_GET['skipped'] )
+       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'] ) );
+       unset($_GET['locked']);
+}
+
+if ( isset($_GET['deleted']) && (int) $_GET['deleted'] ) {
+       printf( __ngettext( 'Post deleted.', '%s posts deleted.', $_GET['deleted'] ), number_format_i18n( $_GET['deleted'] ) );
+       unset($_GET['deleted']);
 }
 }
-?></h2>
+
+$_SERVER['REQUEST_URI'] = remove_query_arg( array('locked', 'skipped', 'updated', 'deleted'), $_SERVER['REQUEST_URI'] );
+?>
+</p></div>
+<?php } ?>
+
+<form id="posts-filter" action="" method="get">
 
 <ul class="subsubsub">
 <?php
 
 <ul class="subsubsub">
 <?php
+if ( empty($locked_post_status) ) :
 $status_links = array();
 $num_posts = wp_count_posts( 'post', 'readable' );
 $status_links = array();
 $num_posts = wp_count_posts( 'post', 'readable' );
+$total_posts = array_sum( (array) $num_posts );
 $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
 $class = empty( $_GET['post_status'] ) ? ' class="current"' : '';
-$status_links[] = "<li><a href='edit.php' $class>" . __('All Posts') . '</a>';
+$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>';
+
+
 foreach ( $post_stati as $status => $label ) {
        $class = '';
 
 foreach ( $post_stati as $status => $label ) {
        $class = '';
 
@@ -93,52 +152,53 @@ foreach ( $post_stati as $status => $label ) {
 
        if ( empty( $num_posts->$status ) )
                continue;
 
        if ( empty( $num_posts->$status ) )
                continue;
-       if ( $status == $_GET['post_status'] )
+       if ( isset($_GET['post_status']) && $status == $_GET['post_status'] )
                $class = ' class="current"';
 
                $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( __ngettext( $label[2][0], $label[2][1], $num_posts->$status ), number_format_i18n( $num_posts->$status ) ) . '</a>';
 }
 }
-echo implode( ' |</li>', $status_links ) . '</li>';
+echo implode( " |</li>\n", $status_links ) . '</li>';
 unset( $status_links );
 unset( $status_links );
-?>
-</ul>
-
-<?php if ( isset($_GET['post_status'] ) ) : ?>
-<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
-<?php
-endif;
-
-if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
-<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $_GET['posted']; ?>"><?php _e('Edit post'); ?></a></p></div>
-<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
 endif;
 ?>
 endif;
 ?>
+</ul>
 
 
-<p id="post-search">
+<p class="search-box">
        <label class="hidden" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
        <label class="hidden" 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="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" />
 </p>
 
        <input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
 </p>
 
-<div class="tablenav">
+<?php if ( isset($_GET['post_status'] ) ) : ?>
+<input type="hidden" name="post_status" value="<?php echo attribute_escape($_GET['post_status']) ?>" />
+<?php endif; ?>
+<input type="hidden" name="mode" value="<?php echo $mode; ?>" />
 
 
+<?php if ( have_posts() ) { ?>
+
+<div class="tablenav">
 <?php
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'paged', '%#%' ),
        'format' => '',
 <?php
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'paged', '%#%' ),
        'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
        'total' => $wp_query->max_num_pages,
        'current' => $_GET['paged']
 ));
 
        'total' => $wp_query->max_num_pages,
        'current' => $_GET['paged']
 ));
 
-if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
 ?>
 
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+<div class="alignleft actions">
+<select name="action">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<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" />
 <?php wp_nonce_field('bulk-posts'); ?>
 <?php wp_nonce_field('bulk-posts'); ?>
-<?php
+
+<?php // view filters
 if ( !is_singular() ) {
 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
 
 if ( !is_singular() ) {
 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC";
 
@@ -146,16 +206,18 @@ $arc_result = $wpdb->get_results( $arc_query );
 
 $month_count = count($arc_result);
 
 
 $month_count = count($arc_result);
 
-if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
+if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) {
+$m = isset($_GET['m']) ? (int)$_GET['m'] : 0;
+?>
 <select name='m'>
 <select name='m'>
-<option<?php selected( @$_GET['m'], 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
+<option<?php selected( $m, 0 ); ?> value='0'><?php _e('Show all dates'); ?></option>
 <?php
 foreach ($arc_result as $arc_row) {
        if ( $arc_row->yyear == 0 )
                continue;
        $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
 
 <?php
 foreach ($arc_result as $arc_row) {
        if ( $arc_row->yyear == 0 )
                continue;
        $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
 
-       if ( $arc_row->yyear . $arc_row->mmonth == $_GET['m'] )
+       if ( $arc_row->yyear . $arc_row->mmonth == $m )
                $default = ' selected="selected"';
        else
                $default = '';
                $default = ' selected="selected"';
        else
                $default = '';
@@ -179,66 +241,75 @@ do_action('restrict_manage_posts');
 <?php } ?>
 </div>
 
 <?php } ?>
 </div>
 
-<br class="clear" />
-</div>
+<?php if ( $page_links ) { ?>
+<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
+       number_format_i18n( ( $_GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page'] + 1 ),
+       number_format_i18n( min( $_GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ),
+       number_format_i18n( $wp_query->found_posts ),
+       $page_links
+); echo $page_links_text; ?></div>
+<?php } ?>
 
 
-<br class="clear" />
+<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>
+</div>
 
 
-<?php include( 'edit-post-rows.php' ); ?>
+<div class="clear"></div>
+</div>
 
 
-</form>
+<div class="clear"></div>
 
 
-<div id="ajax-response"></div>
+<?php include( 'edit-post-rows.php' ); ?>
 
 <div class="tablenav">
 
 <?php
 if ( $page_links )
 
 <div class="tablenav">
 
 <?php
 if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
+       echo "<div class='tablenav-pages'>$page_links_text</div>";
 ?>
 
 ?>
 
+<div class="alignleft actions">
+<select name="action2">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<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" />
 <br class="clear" />
 </div>
 <br class="clear" />
 </div>
-
 <br class="clear" />
 <br class="clear" />
+</div>
 
 
-<?php
-
-if ( 1 == count($posts) && is_singular() ) :
-
-       $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
-       if ( $comments ) :
-               // Make sure comments, post, and post_author are cached
-               update_comment_cache($comments);
-               $post = get_post($id);
-               $authordata = get_userdata($post->post_author);
-       ?>
-
-<br class="clear" />
+<?php } else { // have_posts() ?>
+<div class="clear"></div>
+<p><?php _e('No posts found') ?></p>
+<?php } ?>
 
 
-<table class="widefat" style="margin-top: .5em">
-<thead>
-  <tr>
-    <th scope="col"><?php _e('Comment') ?></th>
-    <th scope="col"><?php _e('Date') ?></th>
-    <th scope="col"><?php _e('Actions') ?></th>
-  </tr>
-</thead>
-<tbody id="the-comment-list" class="list:comment">
-<?php
-       foreach ($comments as $comment)
-               _wp_comment_row( $comment->comment_ID, 'detail', false, false );
-?>
-</tbody>
-</table>
+</form>
 
 
-<?php
+<?php inline_edit_row( 'post' ); ?>
 
 
-endif; // comments
-endif; // posts;
+<div id="ajax-response"></div>
 
 
-?>
+<br class="clear" />
 
 </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 08a0b25716508f4775de7e5ded491a92ecb91cc7..dbe1b143c8c70ce25dfba846bbdc02dc0991d2ad 100644 (file)
@@ -1,11 +1,21 @@
 <?php
 <?php
+/**
+ * WordPress Export Administration Panel
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once ('admin.php');
 require_once ('admin.php');
+
+/** Load WordPress export API */
 require_once('includes/export.php');
 $title = __('Export');
 require_once('includes/export.php');
 $title = __('Export');
-$parent_file = 'edit.php';
 
 if ( isset( $_GET['download'] ) ) {
 
 if ( isset( $_GET['download'] ) ) {
-       export_wp( $_GET['author'] );
+       $author = isset($_GET['author']) ? $_GET['author'] : 'all';
+       export_wp( $author );
        die();
 }
 
        die();
 }
 
@@ -13,7 +23,9 @@ require_once ('admin-header.php');
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Export'); ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $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('Once you&#8217;ve saved the download file, you can use the Import function on another WordPress blog to import this blog.'); ?></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>
 <p><?php _e('Once you&#8217;ve saved the download file, you can use the Import function on another WordPress blog to import this blog.'); ?></p>
@@ -37,7 +49,7 @@ foreach ( $authors as $id ) {
 </td>
 </tr>
 </table>
 </td>
 </tr>
 </table>
-<p class="submit"><input type="submit" name="submit" value="<?php _e('Download Export File'); ?>" />
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Download Export File'); ?>" />
 <input type="hidden" name="download" value="true" />
 </p>
 </form>
 <input type="hidden" name="download" value="true" />
 </p>
 </form>
index baf6c1993529e4e9c95d9c7ea0692b1bd43ba994..65a2ee6b9bb24ec6f0587a09dfba4d74caedf3ab 100644 (file)
@@ -1,20 +1,83 @@
 <?php
 <?php
+/**
+ * Defines the Gears manifest file for Google Gears offline storage.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
+/** Set ABSPATH for execution */
 define( 'ABSPATH', dirname(dirname(__FILE__)) );
 define( 'WPINC', '/wp-includes' );
 
 define( 'ABSPATH', dirname(dirname(__FILE__)) );
 define( 'WPINC', '/wp-includes' );
 
+/**
+ * @ignore
+ */
 function __() {}
 function __() {}
+
+/**
+ * @ignore
+ */
+function _c() {}
+
+/**
+ * @ignore
+ */
 function add_filter() {}
 function add_filter() {}
+
+/**
+ * @ignore
+ */
 function attribute_escape() {}
 function attribute_escape() {}
+
+/**
+ * @ignore
+ */
 function apply_filters() {}
 function apply_filters() {}
+
+/**
+ * @ignore
+ */
 function get_option() {}
 function get_option() {}
+
+/**
+ * @ignore
+ */
 function is_lighttpd_before_150() {}
 function is_lighttpd_before_150() {}
+
+/**
+ * @ignore
+ */
 function add_action() {}
 function add_action() {}
+
+/**
+ * @ignore
+ */
 function do_action_ref_array() {}
 function do_action_ref_array() {}
+
+/**
+ * @ignore
+ */
 function get_bloginfo() {}
 function get_bloginfo() {}
+
+/**
+ * @ignore
+ */
 function is_admin() {return true;}
 function is_admin() {return true;}
+
+/**
+ * @ignore
+ */
 function site_url() {}
 function site_url() {}
+
+/**
+ * @ignore
+ */
 function admin_url() {}
 function admin_url() {}
+
+/**
+ * @ignore
+ */
 function wp_guess_url() {}
 
 require(ABSPATH . '/wp-includes/script-loader.php');
 function wp_guess_url() {}
 
 require(ABSPATH . '/wp-includes/script-loader.php');
@@ -28,8 +91,9 @@ wp_default_styles($wp_styles);
 
 $defaults = $man_version = '';
 foreach ( $wp_scripts->registered as $script ) {
 
 $defaults = $man_version = '';
 foreach ( $wp_scripts->registered as $script ) {
-       if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue;
+       if ( empty($script->src) ) continue;
        $ver = empty($script->ver) ? $wp_version : $script->ver;
        $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;
        $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $script->src );
        $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
        $man_version .= $ver;
@@ -46,7 +110,7 @@ foreach ( $wp_styles->registered as $style ) {
        if ( isset($style->extra['rtl']) && $style->extra['rtl'] ) {
                if ( is_bool( $style->extra['rtl'] ) )
                        $rtl_href = str_replace( '.css', '-rtl.css', $src );
        if ( isset($style->extra['rtl']) && $style->extra['rtl'] ) {
                if ( is_bool( $style->extra['rtl'] ) )
                        $rtl_href = str_replace( '.css', '-rtl.css', $src );
-               else 
+               else
                        $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
 
                $defaults .= '{ "url" : "' . $rtl_href . '?ver=' . $ver . '" },' . "\n";
                        $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
 
                $defaults .= '{ "url" : "' . $rtl_href . '?ver=' . $ver . '" },' . "\n";
@@ -64,7 +128,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
 ?>
 {
 "betaManifestVersion" : 1,
 ?>
 {
 "betaManifestVersion" : 1,
-"version" : "<?php echo $man_version; ?>_20080810",
+"version" : "<?php echo $man_version; ?>_20081201",
 "entries" : [
 <?php echo $defaults; ?>
 
 "entries" : [
 <?php echo $defaults; ?>
 
@@ -72,85 +136,126 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
 { "url" : "images/align-left.png" },
 { "url" : "images/align-none.png" },
 { "url" : "images/align-right.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/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/comment-grey-bubble.png" },
-{ "url" : "images/comment-pill.gif" },
-{ "url" : "images/comment-stalk-classic.gif" },
-{ "url" : "images/comment-stalk-fresh.gif" },
-{ "url" : "images/comment-stalk-rtl.gif" },
 { "url" : "images/date-button.gif" },
 { "url" : "images/date-button.gif" },
+{ "url" : "images/ed-bg.gif" },
 { "url" : "images/fade-butt.png" },
 { "url" : "images/fade-butt.png" },
-{ "url" : "images/gear.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/logo-ghost.png" },
 { "url" : "images/logo-login.gif" },
-{ "url" : "images/logo.gif" },
-{ "url" : "images/media-button-gallery.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/media-button-image.gif" },
 { "url" : "images/media-button-music.gif" },
 { "url" : "images/media-button-other.gif" },
 { "url" : "images/media-button-video.gif" },
-{ "url" : "images/media-buttons.gif" },
-{ "url" : "images/tab.png" },
-{ "url" : "images/tail.gif" },
-{ "url" : "images/toggle-arrow-rtl.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.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/wordpress-logo.png" },
+{ "url" : "images/wp-logo.gif" },
 { "url" : "images/xit.gif" },
 { "url" : "images/xit.gif" },
-{ "url" : "images/loading-publish.gif" },
-{ "url" : "images/loading.gif" },
-{ "url" : "images/required.gif" },
-{ "url" : "images/no.png" },
 { "url" : "images/yes.png" },
 
 { "url" : "images/yes.png" },
 
-<?php if ( is_file(ABSPATH.'/wp-includes/js/tinymce/tiny_mce.js') ) { ?>
-{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/utils/validate.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311g" },
-{ "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" },
-
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311g" },
-{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" },
-
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311g" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" },
-{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" },
+<?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 },
 
 { "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/icons.gif" },
 { "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" },
@@ -179,18 +284,22 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
 { "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/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/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/wpeditimage/img/image.png" },
-{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" },
 { "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/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 } ?>
 
 { "url" : "../wp-includes/images/crystal/archive.png" },
 <?php } ?>
 
 { "url" : "../wp-includes/images/crystal/archive.png" },
@@ -204,6 +313,5 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
 { "url" : "../wp-includes/images/crystal/spreadsheet.png" },
 { "url" : "../wp-includes/images/rss.png" },
 { "url" : "../wp-includes/js/thickbox/loadingAnimation.gif" },
 { "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" },
-{ "url" : "../wp-includes/js/swfupload/swfupload_f9.swf" }
+{ "url" : "../wp-includes/js/thickbox/tb-close.png" }
 ]}
 ]}
diff --git a/wp-admin/images/archive-link.png b/wp-admin/images/archive-link.png
new file mode 100644 (file)
index 0000000..4c70895
Binary files /dev/null and b/wp-admin/images/archive-link.png differ
diff --git a/wp-admin/images/blue-grad.png b/wp-admin/images/blue-grad.png
new file mode 100644 (file)
index 0000000..3d338d7
Binary files /dev/null and b/wp-admin/images/blue-grad.png differ
index 09f13bc3c77d38bbf59d7a1d076df9fc1342c1d0..c5b64a5e92da2f5250adcbc6798d1d7385a28374 100644 (file)
Binary files a/wp-admin/images/browse-happy.gif and b/wp-admin/images/browse-happy.gif differ
diff --git a/wp-admin/images/bubble_bg-rtl.gif b/wp-admin/images/bubble_bg-rtl.gif
new file mode 100644 (file)
index 0000000..5cfbefe
Binary files /dev/null and b/wp-admin/images/bubble_bg-rtl.gif differ
diff --git a/wp-admin/images/button-grad-active.png b/wp-admin/images/button-grad-active.png
new file mode 100644 (file)
index 0000000..0177e5b
Binary files /dev/null and b/wp-admin/images/button-grad-active.png differ
diff --git a/wp-admin/images/button-grad.png b/wp-admin/images/button-grad.png
new file mode 100644 (file)
index 0000000..3f96366
Binary files /dev/null and b/wp-admin/images/button-grad.png differ
diff --git a/wp-admin/images/comment-pill.gif b/wp-admin/images/comment-pill.gif
deleted file mode 100644 (file)
index 2fabf99..0000000
Binary files a/wp-admin/images/comment-pill.gif and /dev/null differ
diff --git a/wp-admin/images/comment-stalk-classic.gif b/wp-admin/images/comment-stalk-classic.gif
deleted file mode 100644 (file)
index 3cf83a5..0000000
Binary files a/wp-admin/images/comment-stalk-classic.gif and /dev/null differ
diff --git a/wp-admin/images/comment-stalk-fresh.gif b/wp-admin/images/comment-stalk-fresh.gif
deleted file mode 100644 (file)
index 9048949..0000000
Binary files a/wp-admin/images/comment-stalk-fresh.gif and /dev/null differ
diff --git a/wp-admin/images/comment-stalk-rtl.gif b/wp-admin/images/comment-stalk-rtl.gif
deleted file mode 100644 (file)
index 6b0cb0b..0000000
Binary files a/wp-admin/images/comment-stalk-rtl.gif and /dev/null differ
diff --git a/wp-admin/images/ed-bg.gif b/wp-admin/images/ed-bg.gif
new file mode 100644 (file)
index 0000000..a00467c
Binary files /dev/null and b/wp-admin/images/ed-bg.gif differ
diff --git a/wp-admin/images/fav-arrow-rtl.gif b/wp-admin/images/fav-arrow-rtl.gif
new file mode 100644 (file)
index 0000000..9c9fd15
Binary files /dev/null and b/wp-admin/images/fav-arrow-rtl.gif differ
diff --git a/wp-admin/images/fav-arrow.gif b/wp-admin/images/fav-arrow.gif
new file mode 100644 (file)
index 0000000..69e0352
Binary files /dev/null and b/wp-admin/images/fav-arrow.gif differ
diff --git a/wp-admin/images/fav-top.png b/wp-admin/images/fav-top.png
new file mode 100644 (file)
index 0000000..85a6852
Binary files /dev/null and b/wp-admin/images/fav-top.png differ
diff --git a/wp-admin/images/fav.png b/wp-admin/images/fav.png
new file mode 100644 (file)
index 0000000..f3cbe54
Binary files /dev/null and b/wp-admin/images/fav.png differ
diff --git a/wp-admin/images/gear.png b/wp-admin/images/gear.png
deleted file mode 100644 (file)
index f7ac7f4..0000000
Binary files a/wp-admin/images/gear.png and /dev/null differ
diff --git a/wp-admin/images/generic.png b/wp-admin/images/generic.png
new file mode 100644 (file)
index 0000000..3bcbc04
Binary files /dev/null and b/wp-admin/images/generic.png differ
diff --git a/wp-admin/images/gray-grad.png b/wp-admin/images/gray-grad.png
new file mode 100644 (file)
index 0000000..99c45ce
Binary files /dev/null and b/wp-admin/images/gray-grad.png differ
diff --git a/wp-admin/images/icons32-vs.png b/wp-admin/images/icons32-vs.png
new file mode 100644 (file)
index 0000000..4683174
Binary files /dev/null and b/wp-admin/images/icons32-vs.png differ
diff --git a/wp-admin/images/icons32.png b/wp-admin/images/icons32.png
new file mode 100644 (file)
index 0000000..6677d1c
Binary files /dev/null and b/wp-admin/images/icons32.png differ
diff --git a/wp-admin/images/list-vs.png b/wp-admin/images/list-vs.png
new file mode 100644 (file)
index 0000000..85faa8a
Binary files /dev/null and b/wp-admin/images/list-vs.png differ
diff --git a/wp-admin/images/list.png b/wp-admin/images/list.png
new file mode 100644 (file)
index 0000000..827556e
Binary files /dev/null and b/wp-admin/images/list.png differ
index fc1baf55512a96cb6f7925c136015becaa6d6e6a..4282004fb747f7e57dc1b617b213d8bafbb265e7 100644 (file)
Binary files a/wp-admin/images/loading-publish.gif and b/wp-admin/images/loading-publish.gif differ
index ad57ace11dffbb606a9b463788d4bfbc34c265c6..58335f7f58627d214ae9723f6e9827eb8bf2c57b 100644 (file)
Binary files a/wp-admin/images/logo-ghost.png and b/wp-admin/images/logo-ghost.png differ
index 276faf1d4a3e67cbe003f38549749cc08c7ee971..72422b206f538517908553407bd44e91a2ce4252 100644 (file)
Binary files a/wp-admin/images/logo-login.gif and b/wp-admin/images/logo-login.gif differ
index cd49514d7488aceff085adaa5c081f3bda26e482..8024d4807622702e0e65f4234d1822be138bc332 100644 (file)
Binary files a/wp-admin/images/logo.gif and b/wp-admin/images/logo.gif differ
diff --git a/wp-admin/images/marker.png b/wp-admin/images/marker.png
new file mode 100644 (file)
index 0000000..3929bbb
Binary files /dev/null and b/wp-admin/images/marker.png differ
diff --git a/wp-admin/images/mask.png b/wp-admin/images/mask.png
new file mode 100644 (file)
index 0000000..b0a4d40
Binary files /dev/null and b/wp-admin/images/mask.png differ
diff --git a/wp-admin/images/media-button-gallery.gif b/wp-admin/images/media-button-gallery.gif
deleted file mode 100644 (file)
index 1191778..0000000
Binary files a/wp-admin/images/media-button-gallery.gif and /dev/null differ
diff --git a/wp-admin/images/media-buttons.gif b/wp-admin/images/media-buttons.gif
deleted file mode 100644 (file)
index 2266040..0000000
Binary files a/wp-admin/images/media-buttons.gif and /dev/null differ
diff --git a/wp-admin/images/menu-arrows.gif b/wp-admin/images/menu-arrows.gif
new file mode 100644 (file)
index 0000000..ec854c1
Binary files /dev/null and b/wp-admin/images/menu-arrows.gif differ
diff --git a/wp-admin/images/menu-bits-rtl.gif b/wp-admin/images/menu-bits-rtl.gif
new file mode 100644 (file)
index 0000000..3765bfb
Binary files /dev/null and b/wp-admin/images/menu-bits-rtl.gif differ
diff --git a/wp-admin/images/menu-bits.gif b/wp-admin/images/menu-bits.gif
new file mode 100644 (file)
index 0000000..9a10a9a
Binary files /dev/null and b/wp-admin/images/menu-bits.gif differ
diff --git a/wp-admin/images/menu-dark-rtl.gif b/wp-admin/images/menu-dark-rtl.gif
new file mode 100644 (file)
index 0000000..7bfd25d
Binary files /dev/null and b/wp-admin/images/menu-dark-rtl.gif differ
diff --git a/wp-admin/images/menu-dark.gif b/wp-admin/images/menu-dark.gif
new file mode 100644 (file)
index 0000000..739b888
Binary files /dev/null and b/wp-admin/images/menu-dark.gif differ
diff --git a/wp-admin/images/menu-vs.png b/wp-admin/images/menu-vs.png
new file mode 100644 (file)
index 0000000..eb53fe8
Binary files /dev/null and b/wp-admin/images/menu-vs.png differ
diff --git a/wp-admin/images/menu.png b/wp-admin/images/menu.png
new file mode 100644 (file)
index 0000000..2696d7c
Binary files /dev/null and b/wp-admin/images/menu.png differ
diff --git a/wp-admin/images/resize.gif b/wp-admin/images/resize.gif
new file mode 100644 (file)
index 0000000..6a1b41c
Binary files /dev/null and b/wp-admin/images/resize.gif differ
diff --git a/wp-admin/images/screen-options-left.gif b/wp-admin/images/screen-options-left.gif
new file mode 100644 (file)
index 0000000..d692d86
Binary files /dev/null and b/wp-admin/images/screen-options-left.gif differ
diff --git a/wp-admin/images/screen-options-right-up.gif b/wp-admin/images/screen-options-right-up.gif
new file mode 100644 (file)
index 0000000..908e37f
Binary files /dev/null and b/wp-admin/images/screen-options-right-up.gif differ
diff --git a/wp-admin/images/screen-options-right.gif b/wp-admin/images/screen-options-right.gif
new file mode 100644 (file)
index 0000000..e2508a0
Binary files /dev/null and b/wp-admin/images/screen-options-right.gif differ
diff --git a/wp-admin/images/se.png b/wp-admin/images/se.png
new file mode 100644 (file)
index 0000000..c9d8fdd
Binary files /dev/null and b/wp-admin/images/se.png differ
diff --git a/wp-admin/images/star.gif b/wp-admin/images/star.gif
new file mode 100644 (file)
index 0000000..ff671f7
Binary files /dev/null and b/wp-admin/images/star.gif differ
diff --git a/wp-admin/images/tab.png b/wp-admin/images/tab.png
deleted file mode 100644 (file)
index 413c755..0000000
Binary files a/wp-admin/images/tab.png and /dev/null differ
diff --git a/wp-admin/images/tail.gif b/wp-admin/images/tail.gif
deleted file mode 100644 (file)
index 3f8e7d5..0000000
Binary files a/wp-admin/images/tail.gif and /dev/null differ
diff --git a/wp-admin/images/wheel.png b/wp-admin/images/wheel.png
new file mode 100644 (file)
index 0000000..97b343d
Binary files /dev/null and b/wp-admin/images/wheel.png differ
diff --git a/wp-admin/images/white-grad-active.png b/wp-admin/images/white-grad-active.png
new file mode 100644 (file)
index 0000000..0478015
Binary files /dev/null and b/wp-admin/images/white-grad-active.png differ
diff --git a/wp-admin/images/white-grad.png b/wp-admin/images/white-grad.png
new file mode 100644 (file)
index 0000000..aaf57aa
Binary files /dev/null and b/wp-admin/images/white-grad.png differ
diff --git a/wp-admin/images/wp-logo.gif b/wp-admin/images/wp-logo.gif
new file mode 100644 (file)
index 0000000..42bc676
Binary files /dev/null and b/wp-admin/images/wp-logo.gif differ
index 45ca450fda0a4df0b4fe0283ec6ecf53562b1f28..9c321e43dee09eaaac354b2e60e8f901a30a5ce0 100644 (file)
@@ -1,12 +1,21 @@
 <?php
 <?php
+/**
+ * Import WordPress Administration Panel
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once ('admin.php');
 $title = __('Import');
 require_once ('admin.php');
 $title = __('Import');
-$parent_file = 'edit.php';
 require_once ('admin-header.php');
 require_once ('admin-header.php');
+$parent_file = 'tools.php';
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Import'); ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $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
@@ -32,7 +41,7 @@ if (empty ($importers)) {
        echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
 } else {
 ?>
        echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
 } else {
 ?>
-<table class="widefat">
+<table class="widefat" cellspacing="0">
 
 <?php
        $style = '';
 
 <?php
        $style = '';
index 140d8f2bbd745cdcfb7c9351b10f6591b25d1d00..0879cd11b0cb4ad96654f0b03618ae57786a8f8b 100644 (file)
@@ -1,14 +1,51 @@
 <?php
 <?php
-
-define( 'MAX_RESULTS',        50 ); // How many records per GData query
-define( 'MAX_EXECUTION_TIME', 20 ); // How many seconds to let the script run
-define( 'STATUS_INTERVAL',     3 ); // How many seconds between status bar updates
-
+/**
+ * Blogger Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * How many records per GData query
+ *
+ * @package WordPress
+ * @subpackage Blogger_Import
+ * @var int
+ * @since unknown
+ */
+define( 'MAX_RESULTS',        50 );
+
+/**
+ * How many seconds to let the script run
+ *
+ * @package WordPress
+ * @subpackage Blogger_Import
+ * @var int
+ * @since unknown
+ */
+define( 'MAX_EXECUTION_TIME', 20 );
+
+/**
+ * How many seconds between status bar updates
+ *
+ * @package WordPress
+ * @subpackage Blogger_Import
+ * @var int
+ * @since unknown
+ */
+define( 'STATUS_INTERVAL',     3 );
+
+/**
+ * Blogger Importer class
+ *
+ * @since unknown
+ */
 class Blogger_Import {
 
        // Shows the welcome screen and the magic auth link.
        function greet() {
 class Blogger_Import {
 
        // Shows the welcome screen and the magic auth link.
        function greet() {
-               $next_url = get_option('siteurl') . '/wp-admin/index.php?import=blogger&noheader=true';
+               $next_url = get_option('siteurl') . '/wp-admin/index.php?import=blogger&amp;noheader=true';
                $auth_url = "https://www.google.com/accounts/AuthSubRequest";
                $title = __('Import Blogger');
                $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
                $auth_url = "https://www.google.com/accounts/AuthSubRequest";
                $title = __('Import Blogger');
                $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.');
@@ -17,7 +54,10 @@ class Blogger_Import {
                $auth = __('Authorize');
 
                echo "
                $auth = __('Authorize');
 
                echo "
-               <div class='wrap'><h2>$title</h2><p>$welcome</p><p>$prereqs</p><p>$stepone</p>
+               <div class='wrap'>
+               ".screen_icon()."
+               <h2>$title</h2>
+               <p>$welcome</p><p>$prereqs</p><p>$stepone</p>
                        <form action='$auth_url' method='get'>
                                <p class='submit' style='text-align:left;'>
                                        <input type='submit' class='button' value='$auth' />
                        <form action='$auth_url' method='get'>
                                <p class='submit' style='text-align:left;'>
                                        <input type='submit' class='button' value='$auth' />
@@ -31,7 +71,9 @@ class Blogger_Import {
        }
 
        function uh_oh($title, $message, $info) {
        }
 
        function uh_oh($title, $message, $info) {
-               echo "<div class='wrap'><h2>$title</h2><p>$message</p><pre>$info</pre></div>";
+               echo "<div class='wrap'>";
+               screen_icon();
+               echo "<h2>$title</h2><p>$message</p><pre>$info</pre></div>";
        }
 
        function auth() {
        }
 
        function auth() {
@@ -181,9 +223,10 @@ class Blogger_Import {
                        $rows .= "<tr id='blog$i'><td class='blogtitle'>$blogtitle</td><td class='bloghost'>{$blog['host']}</td><td class='bar'>$pstat</td><td class='bar'>$cstat</td><td class='submit'><input type='submit' class='button' id='submit$i' value='$value' /><input type='hidden' name='blog' value='$i' /></td></tr>\n";
                }
 
                        $rows .= "<tr id='blog$i'><td class='blogtitle'>$blogtitle</td><td class='bloghost'>{$blog['host']}</td><td class='bar'>$pstat</td><td class='bar'>$cstat</td><td class='submit'><input type='submit' class='button' id='submit$i' value='$value' /><input type='hidden' name='blog' value='$i' /></td></tr>\n";
                }
 
-               echo "<div class='wrap'><h2>$title</h2><noscript>$noscript</noscript><table cellpadding='5px'><thead><td>$name</td><td>$url</td><td>$posts</td><td>$comments</td><td>$action</td></thead>\n$rows</table></form></div>";
+               echo "<div class='wrap'><h2>$title</h2><noscript>$noscript</noscript><table cellpadding='5px'><thead><tr><td>$name</td><td>$url</td><td>$posts</td><td>$comments</td><td>$action</td></tr></thead>\n$rows</table></div>";
                echo "
                <script type='text/javascript'>
                echo "
                <script type='text/javascript'>
+               /* <![CDATA[ */
                        var strings = {cont:'$continue',stop:'$stop',stopping:'$stopping',authors:'$authors',nothing:'$nothing'};
                        var blogs = {};
                        function blog(i, title, mode, status){
                        var strings = {cont:'$continue',stop:'$stop',stopping:'$stopping',authors:'$authors',nothing:'$nothing'};
                        var blogs = {};
                        function blog(i, title, mode, status){
@@ -296,6 +339,7 @@ class Blogger_Import {
                        };
                        $init
                        jQuery.each(blogs, function(i, me){me.init();});
                        };
                        $init
                        jQuery.each(blogs, function(i, me){me.init();});
+               /* ]]> */
                </script>\n";
        }
 
                </script>\n";
        }
 
@@ -485,7 +529,7 @@ class Blogger_Import {
        }
 
        function import_post( $entry ) {
        }
 
        function import_post( $entry ) {
-               global $wpdb, $importing_blog;
+               global $importing_blog;
 
                // The old permalink is all Blogger gives us to link comments to their posts.
                if ( isset( $entry->draft ) )
 
                // The old permalink is all Blogger gives us to link comments to their posts.
                if ( isset( $entry->draft ) )
@@ -506,7 +550,7 @@ class Blogger_Import {
                $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
 
                // Clean up content
                $post_status  = isset( $entry->draft ) ? 'draft' : 'publish';
 
                // Clean up content
-               $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_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 = str_replace('<br>', '<br />', $post_content);
                $post_content = str_replace('<hr>', '<hr />', $post_content);
 
@@ -559,7 +603,7 @@ class Blogger_Import {
                $comment_content = addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) );
 
                // Clean up content
                $comment_content = addslashes( $this->no_apos( html_entity_decode( $entry->content ) ) );
 
                // Clean up content
-               $comment_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_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 = str_replace('<br>', '<br />', $comment_content);
                $comment_content = str_replace('<hr>', '<hr />', $comment_content);
 
@@ -618,11 +662,11 @@ class Blogger_Import {
                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&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='$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) {
-               global $wpdb, $importer_users;
+               global $importer_users;
                if ( ! isset( $importer_users ) )
                        $importer_users = (array) get_users_of_blog();
 
                if ( ! isset( $importer_users ) )
                        $importer_users = (array) get_users_of_blog();
 
@@ -777,7 +821,7 @@ class Blogger_Import {
                                echo $result->get_error_message();
                } elseif ( isset($_GET['token']) )
                        $this->auth();
                                echo $result->get_error_message();
                } elseif ( isset($_GET['token']) )
                        $this->auth();
-               elseif ( $this->token && $this->token_is_valid() )
+               elseif ( isset($this->token) && $this->token_is_valid() )
                        $this->show_blogs();
                else
                        $this->greet();
                        $this->show_blogs();
                else
                        $this->greet();
@@ -788,7 +832,7 @@ class Blogger_Import {
                        $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');
                        $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');
-                       echo "<div class='wrap'><h2>$restart</h2><p>$message</p><form method='post' action='?import=blogger&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 6bb63a7bdf3bfc0220b8da5b448c2a9a1e2dc9a4..afec323c3bc80619ef69a6deb90ecf29a74f2c0f 100644 (file)
@@ -1,13 +1,27 @@
 <?php
 <?php
-
-/* By Shayne Sweeney - http://www.theshayne.com/ */
-
+/**
+ * Blogware XML Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ * @author Shayne Sweeney
+ * @link http://www.theshayne.com/
+ */
+
+/**
+ * Blogware XML Importer class
+ *
+ * Extract posts from Blogware XML export file into your blog.
+ *
+ * @since unknown
+ */
 class BW_Import {
 
        var $file;
 
        function header() {
                echo '<div class="wrap">';
 class BW_Import {
 
        var $file;
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Blogware').'</h2>';
        }
 
                echo '<h2>'.__('Import Blogware').'</h2>';
        }
 
@@ -75,7 +89,7 @@ class BW_Import {
                        }
 
                        // Clean up content
                        }
 
                        // Clean up content
-                       $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_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_content = str_replace('<br>', '<br />', $post_content);
                        $post_content = str_replace('<hr>', '<hr />', $post_content);
                        $post_content = $wpdb->escape($post_content);
@@ -115,7 +129,7 @@ class BW_Import {
                                        $comment_content = $this->unhtmlentities($comment_content);
 
                                        // Clean up content
                                        $comment_content = $this->unhtmlentities($comment_content);
 
                                        // Clean up content
-                                       $comment_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_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);
                                        $comment_content = str_replace('<br>', '<br />', $comment_content);
                                        $comment_content = str_replace('<hr>', '<hr />', $comment_content);
                                        $comment_content = $wpdb->escape($comment_content);
index 4bd884c87c52ed625949ecadf90ea165e8088e9c..c528c2251c8324206b276120a15257484c6b81d3 100644 (file)
@@ -1,9 +1,24 @@
 <?php
 <?php
-
+/**
+ * BunnyTags Plugin Tag Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * BunnyTags Plugin tag converter
+ *
+ * This will process the BunnyTags plugin tags and convert them to the WordPress
+ * 2.3 taxonomy.
+ *
+ * @since unknown
+ */
 class BunnyTags_Import {
 
        function header() {
                echo '<div class="wrap">';
 class BunnyTags_Import {
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Bunny&#8217;s Technorati Tags').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
                echo '<h2>'.__('Import Bunny&#8217;s Technorati Tags').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
@@ -20,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" value="'.__('Import Tags').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Import Tags').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -90,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" value="'.__('Next').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
index da1047ffb272be85c4171bda3204e8cdda2f81b0..d51f04172aa0a1a52faa54abba1407902bfb8cf1 100644 (file)
@@ -1,7 +1,11 @@
 <?php
 <?php
-/*
- * DotClear import plugin
- * by Thomas Quinot - http://thomas.quinot.org/
+/**
+ * DotClear Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ * @author Thomas Quinot
+ * @link http://thomas.quinot.org/
  */
 
 /**
  */
 
 /**
 
 if(!function_exists('get_comment_count'))
 {
 
 if(!function_exists('get_comment_count'))
 {
+       /**
+        * Get the comment count for posts.
+        *
+        * @package WordPress
+        * @subpackage Dotclear_Import
+        *
+        * @param int $post_ID Post ID
+        * @return int
+        */
        function get_comment_count($post_ID)
        {
                global $wpdb;
        function get_comment_count($post_ID)
        {
                global $wpdb;
@@ -19,6 +32,15 @@ if(!function_exists('get_comment_count'))
 
 if(!function_exists('link_exists'))
 {
 
 if(!function_exists('link_exists'))
 {
+       /**
+        * Check whether link already exists.
+        *
+        * @package WordPress
+        * @subpackage Dotclear_Import
+        *
+        * @param string $linkname
+        * @return int
+        */
        function link_exists($linkname)
        {
                global $wpdb;
        function link_exists($linkname)
        {
                global $wpdb;
@@ -40,31 +62,73 @@ if(!function_exists('link_exists'))
 //    This cries out for a C-implementation to be included in PHP core
 //
 
 //    This cries out for a C-implementation to be included in PHP core
 //
 
+/**
+ * @package WordPress
+ * @subpackage Dotclear_Import
+ *
+ * @param string $char
+ * @return string
+ */
 function valid_1byte($char) {
        if(!is_int($char)) return false;
                return ($char & 0x80) == 0x00;
 }
 
 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;
 }
 
 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;
 }
 
 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;
 }
 
 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;
 }
 
 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;
 function valid_utf8($string) {
        $len = strlen($string);
        $i = 0;
@@ -92,6 +156,13 @@ function valid_utf8($string) {
        return true; // done
 }
 
        return true; // done
 }
 
+/**
+ * @package WordPress
+ * @subpackage Dotclear_Import
+ *
+ * @param string $s
+ * @return string
+ */
 function csc ($s) {
        if (valid_utf8 ($s)) {
                return $s;
 function csc ($s) {
        if (valid_utf8 ($s)) {
                return $s;
@@ -100,18 +171,34 @@ function csc ($s) {
        }
 }
 
        }
 }
 
+/**
+ * @package WordPress
+ * @subpackage Dotclear_Import
+ *
+ * @param string $s
+ * @return string
+ */
 function textconv ($s) {
        return csc (preg_replace ('|(?<!<br />)\s*\n|', ' ', $s));
 }
 
 /**
 function textconv ($s) {
        return csc (preg_replace ('|(?<!<br />)\s*\n|', ' ', $s));
 }
 
 /**
-       The Main Importer Class
-**/
+ * Dotclear Importer class
+ *
+ * Will process the WordPress eXtended RSS files that you upload from the export
+ * file.
+ *
+ * @package WordPress
+ * @subpackage Importer
+ *
+ * @since unknown
+ */
 class Dotclear_Import {
 
        function header()
        {
                echo '<div class="wrap">';
 class Dotclear_Import {
 
        function header()
        {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import DotClear').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
        }
                echo '<h2>'.__('Import DotClear').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
        }
@@ -128,7 +215,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" value="'.attribute_escape(__('Import Categories')).'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.attribute_escape(__('Import Categories')).'" /></p>';
                echo '</form></div>';
        }
 
                echo '</form></div>';
        }
 
@@ -545,7 +632,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('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Users')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Users')));
                echo '</form>';
 
        }
                echo '</form>';
 
        }
@@ -558,7 +645,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('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Posts')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -572,7 +659,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('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Comments')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -584,7 +671,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('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Import Links')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Links')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -597,7 +684,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('<input type="submit" name="submit" value="%s" />', attribute_escape(__('Finish')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Finish')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -644,7 +731,7 @@ class Dotclear_Import {
                printf('<tr><th><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('DotClear Database User:'));
                printf('<tr><th><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('DotClear Database Password:'));
                printf('<tr><th><label for="dbname">%s</label></th><td><input type="text" name="dbname" id="dbname" /></td></tr>', __('DotClear Database Name:'));
                printf('<tr><th><label for="dbuser">%s</label></th><td><input type="text" name="dbuser" id="dbuser" /></td></tr>', __('DotClear Database User:'));
                printf('<tr><th><label for="dbpass">%s</label></th><td><input type="password" name="dbpass" id="dbpass" /></td></tr>', __('DotClear Database Password:'));
                printf('<tr><th><label for="dbname">%s</label></th><td><input type="text" name="dbname" id="dbname" /></td></tr>', __('DotClear Database Name:'));
-               printf('<tr><th><label for="dbhost">%s</label></th><td><input type="text" name="dbhost" nameid="dbhost" value="localhost" /></td></tr>', __('DotClear Database Host:'));
+               printf('<tr><th><label for="dbhost">%s</label></th><td><input type="text" name="dbhost" id="dbhost" value="localhost" /></td></tr>', __('DotClear Database Host:'));
                printf('<tr><th><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix" value="dc_"/></td></tr>', __('DotClear Table prefix:'));
                printf('<tr><th><label for="dccharset">%s</label></th><td><input type="text" name="dccharset" id="dccharset" value="ISO-8859-15"/></td></tr>', __('Originating character set:'));
                echo '</table>';
                printf('<tr><th><label for="dbprefix">%s</label></th><td><input type="text" name="dbprefix" id="dbprefix" value="dc_"/></td></tr>', __('DotClear Table prefix:'));
                printf('<tr><th><label for="dccharset">%s</label></th><td><input type="text" name="dccharset" id="dccharset" value="ISO-8859-15"/></td></tr>', __('Originating character set:'));
                echo '</table>';
@@ -742,5 +829,7 @@ class Dotclear_Import {
 }
 
 $dc_import = new Dotclear_Import();
 }
 
 $dc_import = new Dotclear_Import();
+
 register_importer('dotclear', __('DotClear'), __('Import categories, users, posts, comments, and links from a DotClear blog.'), array ($dc_import, 'dispatch'));
 register_importer('dotclear', __('DotClear'), __('Import categories, users, posts, comments, and links from a DotClear blog.'), array ($dc_import, 'dispatch'));
+
 ?>
 ?>
index 58aa7577155270ba177a8067d04e4ed314f05bd9..5ff91edfdae27280d7ab20469a450f171f5e5e51 100644 (file)
@@ -1,11 +1,26 @@
 <?php
 <?php
-
+/**
+ * GreyMatter Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * GreyMatter Importer class
+ *
+ * Basic GreyMatter to WordPress importer, will import posts, comments, and
+ * posts karma.
+ *
+ * @since unknown
+ */
 class GM_Import {
 
        var $gmnames = array ();
 
        function header() {
                echo '<div class="wrap">';
 class GM_Import {
 
        var $gmnames = array ();
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import GreyMatter').'</h2>';
        }
 
                echo '<h2>'.__('Import GreyMatter').'</h2>';
        }
 
@@ -31,7 +46,7 @@ class GM_Import {
 </ul>
 <p>&nbsp;</p>
 
 </ul>
 <p>&nbsp;</p>
 
-<form name="stepOne" method="get">
+<form name="stepOne" method="get" action="">
 <input type="hidden" name="import" value="greymatter" />
 <input type="hidden" name="step" value="1" />
 <?php wp_nonce_field('import-greymatter'); ?>
 <input type="hidden" name="import" value="greymatter" />
 <input type="hidden" name="step" value="1" />
 <?php wp_nonce_field('import-greymatter'); ?>
@@ -51,8 +66,7 @@ class GM_Import {
        <?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>
 </tr>
 </table>
        <?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>
 </tr>
 </table>
-</p>
-<p><input type="submit" name="submit" value="<?php _e('Start Importing') ?>" class="button" /></p>
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Start Importing') ?>" /></p>
 </form>
 <?php
                $this->footer();
 </form>
 <?php
                $this->footer();
index 1bb0ad6d307558790fbc19a5c5ba897fa8510c2d..ba479528b91a22d485b8fd8d337571044631e3f5 100644 (file)
@@ -1,9 +1,23 @@
 <?php
 <?php
-
+/**
+ * Jeromes Keyword Plugin Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * Jeromes Keyword Plugin Importer class
+ *
+ * Will convert Jeromes Keyword Plugin tags to WordPress taxonomy tags.
+ *
+ * @since 2.3
+ */
 class JeromesKeyword_Import {
 
        function header() {
                echo '<div class="wrap">';
 class JeromesKeyword_Import {
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Jerome&#8217;s Keywords').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
                echo '<h2>'.__('Import Jerome&#8217;s Keywords').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
@@ -106,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" value="'.__('Next').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -139,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" value="'.__('Next').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Next').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
index bd8394ed948479ff87c3c53d9e6919c752e706b1..294750c30fa64b7a8dd5d8c522b2c7b82b42656b 100644 (file)
@@ -1,11 +1,25 @@
 <?php
 <?php
-
+/**
+ * LiveJournal Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * LiveJournal Importer class
+ *
+ * Imports your LiveJournal XML exported file into WordPress.
+ *
+ * @since unknown
+ */
 class LJ_Import {
 
        var $file;
 
        function header() {
                echo '<div class="wrap">';
 class LJ_Import {
 
        var $file;
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import LiveJournal').'</h2>';
        }
 
                echo '<h2>'.__('Import LiveJournal').'</h2>';
        }
 
@@ -56,7 +70,7 @@ class LJ_Import {
                        $post_content = $this->unhtmlentities($post_content);
 
                        // Clean up content
                        $post_content = $this->unhtmlentities($post_content);
 
                        // Clean up content
-                       $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_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_content = str_replace('<br>', '<br />', $post_content);
                        $post_content = str_replace('<hr>', '<hr />', $post_content);
                        $post_content = $wpdb->escape($post_content);
@@ -92,7 +106,7 @@ class LJ_Import {
                                        $comment_content = $this->unhtmlentities($comment_content);
 
                                        // Clean up content
                                        $comment_content = $this->unhtmlentities($comment_content);
 
                                        // Clean up content
-                                       $comment_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $comment_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);
                                        $comment_content = str_replace('<br>', '<br />', $comment_content);
                                        $comment_content = str_replace('<hr>', '<hr />', $comment_content);
                                        $comment_content = $wpdb->escape($comment_content);
index 5968095ca375dc4b5cbf686cccbbc212843debe0..48d4de3b694afbd1bd46012422d6727649a4eb1b 100644 (file)
@@ -1,5 +1,18 @@
 <?php
 <?php
-
+/**
+ * Movable Type and Typepad Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * Moveable Type and Typepad Importer class
+ *
+ * Upload your exported Movable Type or Typepad entries into WordPress.
+ *
+ * @since unknown
+ */
 class MT_Import {
 
        var $posts = array ();
 class MT_Import {
 
        var $posts = array ();
@@ -11,6 +24,7 @@ class MT_Import {
 
        function header() {
                echo '<div class="wrap">';
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Movable Type or TypePad').'</h2>';
        }
 
                echo '<h2>'.__('Import Movable Type or TypePad').'</h2>';
        }
 
@@ -32,7 +46,7 @@ class MT_Import {
        <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="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" value="<?php echo attribute_escape(__('Import mt-export.txt')); ?>" />
+<input type="submit" class="button" value="<?php echo attribute_escape(__('Import mt-export.txt')); ?>" />
 </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>
 </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>
@@ -42,7 +56,7 @@ class MT_Import {
        }
 
        function users_form($n) {
        }
 
        function users_form($n) {
-               global $wpdb, $testing;
+               global $wpdb;
                $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
 ?><select name="userselect[<?php echo $n; ?>]">
        <option value="#NONE#"><?php _e('- Select -') ?></option>
                $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY ID");
 ?><select name="userselect[<?php echo $n; ?>]">
        <option value="#NONE#"><?php _e('- Select -') ?></option>
@@ -56,12 +70,38 @@ class MT_Import {
        </select>
        <?php
 
        </select>
        <?php
 
+       }
+
+       function has_gzip() {
+               return is_callable('gzopen');
+       }
+
+       function fopen($filename, $mode='r') {
+               if ( $this->has_gzip() )
+                       return gzopen($filename, $mode);
+               return fopen($filename, $mode);
+       }
+
+       function feof($fp) {
+               if ( $this->has_gzip() )
+                       return gzeof($fp);
+               return feof($fp);
+       }
 
 
+       function fgets($fp, $len=8192) {
+               if ( $this->has_gzip() )
+                       return gzgets($fp, $len);
+               return fgets($fp, $len);
        }
 
        }
 
+       function fclose($fp) {
+               if ( $this->has_gzip() )
+                       return gzclose($fp);
+               return fclose($fp);
+       }
+
        //function to check the authorname and do the mapping
        function checkauthor($author) {
        //function to check the authorname and do the mapping
        function checkauthor($author) {
-               global $wpdb;
                //mtnames is an array with the names in the mt import file
                $pass = wp_generate_password();
                if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
                //mtnames is an array with the names in the mt import file
                $pass = wp_generate_password();
                if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
@@ -69,7 +109,7 @@ class MT_Import {
                        $this->mtnames[$this->j] = $author; //add that new mt author name to an array
                        $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
                        if (!$user_id) { //banging my head against the desk now.
                        $this->mtnames[$this->j] = $author; //add that new mt author name to an array
                        $user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
                        if (!$user_id) { //banging my head against the desk now.
-                               if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
+                               if ($this->newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
                                        $user_id = wp_create_user($author, $pass);
                                        $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
                                } else {
                                        $user_id = wp_create_user($author, $pass);
                                        $this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
                                } else {
@@ -90,12 +130,12 @@ class MT_Import {
                $temp = array();
                $authors = array();
 
                $temp = array();
                $authors = array();
 
-               $handle = fopen($this->file, 'r');
+               $handle = $this->fopen($this->file, 'r');
                if ( $handle == null )
                        return false;
 
                $in_comment = false;
                if ( $handle == null )
                        return false;
 
                $in_comment = false;
-               while ( $line = fgets($handle) ) {
+               while ( $line = $this->fgets($handle) ) {
                        $line = trim($line);
 
                        if ( 'COMMENT:' == $line )
                        $line = trim($line);
 
                        if ( 'COMMENT:' == $line )
@@ -118,7 +158,7 @@ class MT_Import {
                                array_push($authors, "$next");
                }
 
                                array_push($authors, "$next");
                }
 
-               fclose($handle);
+               $this->fclose($handle);
 
                return $authors;
        }
 
                return $authors;
        }
@@ -152,6 +192,7 @@ class MT_Import {
        function mt_authors_form() {
 ?>
 <div class="wrap">
        function mt_authors_form() {
 ?>
 <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('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>
 <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('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>
@@ -171,7 +212,7 @@ class MT_Import {
                        echo '</label></li>';
                }
 
                        echo '</label></li>';
                }
 
-               echo '<input type="submit" value="'.__('Submit').'">'.'<br />';
+               echo '<p class="submit"><input type="submit" class="button" value="'.__('Submit').'"></p>'.'<br />';
                echo '</form>';
                echo '</ol></div>';
 
                echo '</form>';
                echo '</ol></div>';
 
@@ -224,10 +265,10 @@ class MT_Import {
                        if ( 0 != count($post->categories) ) {
                                wp_create_categories($post->categories, $post_id);
                        }
                        if ( 0 != count($post->categories) ) {
                                wp_create_categories($post->categories, $post_id);
                        }
-                       
+
                         // Add tags or keywords
                        if ( 1 < strlen($post->post_keywords) ) {
                         // Add tags or keywords
                        if ( 1 < strlen($post->post_keywords) ) {
-                               // Keywords exist. 
+                               // Keywords exist.
                                printf(__('<br />Adding tags <i>%s</i>...'), stripslashes($post->post_keywords));
                                wp_add_post_tags($post_id, $post->post_keywords);
                        }
                                printf(__('<br />Adding tags <i>%s</i>...'), stripslashes($post->post_keywords));
                                wp_add_post_tags($post_id, $post->post_keywords);
                        }
@@ -273,7 +314,7 @@ class MT_Import {
        function process_posts() {
                global $wpdb;
 
        function process_posts() {
                global $wpdb;
 
-               $handle = fopen($this->file, 'r');
+               $handle = $this->fopen($this->file, 'r');
                if ( $handle == null )
                        return false;
 
                if ( $handle == null )
                        return false;
 
@@ -286,7 +327,7 @@ class MT_Import {
 
                echo "<div class='wrap'><ol>";
 
 
                echo "<div class='wrap'><ol>";
 
-               while ( $line = fgets($handle) ) {
+               while ( $line = $this->fgets($handle) ) {
                        $line = trim($line);
 
                        if ( '-----' == $line ) {
                        $line = trim($line);
 
                        if ( '-----' == $line ) {
@@ -397,8 +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.
-
-                               $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 ) {
@@ -415,6 +458,8 @@ class MT_Import {
                        }
                }
 
                        }
                }
 
+               $this->fclose($handle);
+
                echo '</ol>';
 
                wp_import_cleanup($this->id);
                echo '</ol>';
 
                wp_import_cleanup($this->id);
similarity index 82%
rename from wp-admin/link-import.php
rename to wp-admin/import/opml.php
index a2d6e4d565e3446d816abd2958020e09c09e3c18..8148acf6f42a2dabf00df5acb5dc2434298a7f43 100644 (file)
@@ -1,11 +1,22 @@
 <?php
 <?php
-// Links
-// Copyright (C) 2002 Mike Little -- mike@zed1.com
-
-require_once('admin.php');
-$parent_file = 'edit.php';
+/**
+ * Links Import Administration Panel.
+ *
+ * @copyright 2002 Mike Little <mike@zed1.com>
+ * @author Mike Little <mike@zed1.com>
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
+$parent_file = 'tools.php';
+$submenu_file = 'import.php';
 $title = __('Import Blogroll');
 
 $title = __('Import Blogroll');
 
+class OPML_Import {
+
+       function dispatch() {
+               global $wpdb, $user_ID;
 $step = $_POST['step'];
 if (!$step) $step = 0;
 ?>
 $step = $_POST['step'];
 if (!$step) $step = 0;
 ?>
@@ -20,9 +31,9 @@ switch ($step) {
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-
+<?php screen_icon(); ?>
 <h2><?php _e('Import your blogroll from another system') ?> </h2>
 <h2><?php _e('Import your blogroll from another system') ?> </h2>
-<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
+<form enctype="multipart/form-data" action="admin.php?import=opml" method="post" name="blogroll">
 <?php wp_nonce_field('import-bookmarks') ?>
 
 <p><?php _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.'); ?></p>
 <?php wp_nonce_field('import-bookmarks') ?>
 
 <p><?php _e('If a program or website you use allows you to export your links or subscriptions as OPML you may import them here.'); ?></p>
@@ -91,6 +102,7 @@ foreach ($categories as $category) {
                        $blogrolling = false;
                }
 
                        $blogrolling = false;
                }
 
+               global $opml, $updated_timestamp, $all_links, $map, $names, $urls, $targets, $descriptions, $feeds;
                if ( isset($opml_url) && $opml_url != '' ) {
                        if ( $blogrolling === true ) {
                                $opml = wp_remote_fopen($opml_url);
                if ( isset($opml_url) && $opml_url != '' ) {
                        if ( $blogrolling === true ) {
                                $opml = wp_remote_fopen($opml_url);
@@ -98,6 +110,7 @@ foreach ($categories as $category) {
                                $opml = file_get_contents($opml_url);
                        }
 
                                $opml = file_get_contents($opml_url);
                        }
 
+                       /** Load OPML Parser */
                        include_once('link-parse-opml.php');
 
                        $link_count = count($names);
                        include_once('link-parse-opml.php');
 
                        $link_count = count($names);
@@ -130,7 +143,13 @@ if ( ! $blogrolling )
                break;
        } // end case 1
 } // end switch
                break;
        } // end case 1
 } // end switch
+       }
 
 
-include('admin-footer.php');
+       function OPML_Import() {}
+}
 
 
-?>
\ No newline at end of file
+$opml_importer = new OPML_Import();
+
+register_importer('opml', __('Blogroll'), __('Import links in OPML format.'), array(&$opml_importer, 'dispatch'));
+
+?>
index 60a449007bb20a8d30aa838e0ad43899c69801ce..832396f50efeed1c08b48f597e210241acfaafb0 100644 (file)
@@ -1,5 +1,20 @@
 <?php
 <?php
-
+/**
+ * RSS Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * RSS Importer
+ *
+ * Will process a RSS feed for importing posts into WordPress. This is a very
+ * limited importer and should only be used as the last resort, when no other
+ * importer is available.
+ *
+ * @since unknown
+ */
 class RSS_Import {
 
        var $posts = array ();
 class RSS_Import {
 
        var $posts = array ();
@@ -7,6 +22,7 @@ class RSS_Import {
 
        function header() {
                echo '<div class="wrap">';
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import RSS').'</h2>';
        }
 
                echo '<h2>'.__('Import RSS').'</h2>';
        }
 
@@ -87,7 +103,7 @@ class RSS_Import {
                        }
 
                        // Clean up content
                        }
 
                        // Clean up content
-                       $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_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 = str_replace('<br>', '<br />', $post_content);
                        $post_content = str_replace('<hr>', '<hr />', $post_content);
 
index 53b339a0b7e14a4149d0dc1967094628fb729eab..54c501f817624ea7123a82f47a3ace3f0edd923e 100644 (file)
@@ -1,7 +1,22 @@
 <?php
 <?php
+/**
+ * Simple Tags Plugin Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * Simple Tags Plugin Tags converter class.
+ *
+ * Will convert Simple Tags Plugin tags over to the WordPress 2.3 taxonomy.
+ *
+ * @since unknown
+ */
 class STP_Import {
        function header()  {
                echo '<div class="wrap">';
 class STP_Import {
        function header()  {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Simple Tagging').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
                echo '<h2>'.__('Import Simple Tagging').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
@@ -18,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" value="'.__('Step 1').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 1').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -78,7 +93,7 @@ class STP_Import {
 
                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" value="'.__('Step 2').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 2').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -94,7 +109,7 @@ class STP_Import {
                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 '<form action="admin.php?import=stp&amp;step=3" method="post">';
                wp_nonce_field('import-stp');
                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 '<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" value="'.__('Step 3').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 3').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
index bbddc08d382d5947bc9b08c38b81e9103d16c201..413f0331ef59584ac827c4e4aab287e8d6954836 100644 (file)
@@ -1,10 +1,22 @@
 <?php
 /**
 <?php
 /**
-       Add These Functions to make our lives easier
-**/
+ * TextPattern Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
 
 if(!function_exists('get_comment_count'))
 {
 
 if(!function_exists('get_comment_count'))
 {
+       /**
+        * Get the comment count for posts.
+        *
+        * @package WordPress
+        * @subpackage Textpattern_Import
+        *
+        * @param int $post_ID Post ID
+        * @return int
+        */
        function get_comment_count($post_ID)
        {
                global $wpdb;
        function get_comment_count($post_ID)
        {
                global $wpdb;
@@ -14,6 +26,15 @@ if(!function_exists('get_comment_count'))
 
 if(!function_exists('link_exists'))
 {
 
 if(!function_exists('link_exists'))
 {
+       /**
+        * Check whether link already exists.
+        *
+        * @package WordPress
+        * @subpackage Textpattern_Import
+        *
+        * @param string $linkname
+        * @return int
+        */
        function link_exists($linkname)
        {
                global $wpdb;
        function link_exists($linkname)
        {
                global $wpdb;
@@ -22,13 +43,16 @@ if(!function_exists('link_exists'))
 }
 
 /**
 }
 
 /**
-       The Main Importer Class
-**/
+ * TextPattern Importer Class
+ *
+ * @since unknown
+ */
 class Textpattern_Import {
 
        function header()
        {
                echo '<div class="wrap">';
 class Textpattern_Import {
 
        function header()
        {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Textpattern').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
        }
                echo '<h2>'.__('Import Textpattern').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'</p>';
        }
@@ -46,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" class="button" name="submit" value="'.attribute_escape(__('Import')).'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.attribute_escape(__('Import')).'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -481,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('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Users')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Users')));
                echo '</form>';
 
        }
                echo '</form>';
 
        }
@@ -494,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('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Posts')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Posts')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -508,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('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Comments')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Comments')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -520,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('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Import Links')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Import Links')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -533,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('<input type="submit" class="button" name="submit" value="%s" />', attribute_escape(__('Finish')));
+               printf('<p class="submit"><input type="submit" name="submit" class="button" value="%s" /></p>', attribute_escape(__('Finish')));
                echo '</form>';
        }
 
                echo '</form>';
        }
 
@@ -670,5 +694,7 @@ class Textpattern_Import {
 }
 
 $txp_import = new Textpattern_Import();
 }
 
 $txp_import = new Textpattern_Import();
+
 register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog.'), array ($txp_import, 'dispatch'));
 register_importer('textpattern', __('Textpattern'), __('Import categories, users, posts, comments, and links from a Textpattern blog.'), array ($txp_import, 'dispatch'));
+
 ?>
 ?>
index 759809eccdbfe3a2513bb9c443c108a2c8959405..7478fe46f1e4e9671d021dfe18697124460ac7c2 100644 (file)
@@ -1,9 +1,23 @@
 <?php
 <?php
-
+/**
+ * The Ultimate Tag Warrior Importer.
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * Ultimate Tag Warrior Converter to 2.3 taxonomy.
+ *
+ * This converts the Ultimate Tag Warrior tags to the 2.3 WordPress taxonomy.
+ *
+ * @since 2.3.0
+ */
 class UTW_Import {
 
        function header()  {
                echo '<div class="wrap">';
 class UTW_Import {
 
        function header()  {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import Ultimate Tag Warrior').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
                echo '<h2>'.__('Import Ultimate Tag Warrior').'</h2>';
                echo '<p>'.__('Steps may take a few minutes depending on the size of your database. Please be patient.').'<br /><br /></p>';
        }
@@ -19,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" value="'.__('Step 1').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 1').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -106,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" value="'.__('Step 2').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 2').'" /></p>';
                echo '</form>';
                echo '</div>';
        }
                echo '</form>';
                echo '</div>';
        }
@@ -142,7 +156,7 @@ class UTW_Import {
 
                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" value="'.__('Step 3').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 3').'" /></p>';
                echo '</form>';
                echo '</div>';
 
                echo '</form>';
                echo '</div>';
 
@@ -161,7 +175,7 @@ class UTW_Import {
 
                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" value="'.__('Step 4').'" /></p>';
+               echo '<p class="submit"><input type="submit" name="submit" class="button" value="'.__('Step 4').'" /></p>';
                echo '</form>';
                echo '</div>';
 
                echo '</form>';
                echo '</div>';
 
index 5271abe008e082be035d17bcf74b0f88e25026e8..762ccb3f2c647e07456d8199492c7fc7d105291c 100644 (file)
@@ -1,5 +1,19 @@
 <?php
 <?php
-
+/**
+ * WordPress Importer
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * WordPress Importer
+ *
+ * Will process the WordPress eXtended RSS files that you upload from the export
+ * file.
+ *
+ * @since unknown
+ */
 class WP_Import {
 
        var $post_ids_processed = array ();
 class WP_Import {
 
        var $post_ids_processed = array ();
@@ -20,6 +34,7 @@ class WP_Import {
 
        function header() {
                echo '<div class="wrap">';
 
        function header() {
                echo '<div class="wrap">';
+               screen_icon();
                echo '<h2>'.__('Import WordPress').'</h2>';
        }
 
                echo '<h2>'.__('Import WordPress').'</h2>';
        }
 
@@ -35,7 +50,7 @@ class WP_Import {
 
        function greet() {
                echo '<div class="narrow">';
 
        function greet() {
                echo '<div class="narrow">';
-               echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, comments, custom fields, and categories into this blog.').'</p>';
+               echo '<p>'.__('Howdy! Upload your WordPress eXtended RSS (WXR) file and we&#8217;ll import the posts, pages, comments, custom fields, categories, and tags into this blog.').'</p>';
                echo '<p>'.__('Choose a WordPress WXR file to upload, then click Upload file and import.').'</p>';
                wp_import_upload_form("admin.php?import=wordpress&amp;step=1");
                echo '</div>';
                echo '<p>'.__('Choose a WordPress WXR file to upload, then click Upload file and import.').'</p>';
                wp_import_upload_form("admin.php?import=wordpress&amp;step=1");
                echo '</div>';
@@ -92,6 +107,11 @@ class WP_Import {
                                if ( !$is_wxr_file && preg_match('|xmlns:wp="http://wordpress[.]org/export/\d+[.]\d+/"|', $importline) )
                                        $is_wxr_file = true;
 
                                if ( !$is_wxr_file && preg_match('|xmlns:wp="http://wordpress[.]org/export/\d+[.]\d+/"|', $importline) )
                                        $is_wxr_file = true;
 
+                               if ( false !== strpos($importline, '<wp:base_site_url>') ) {
+                                       preg_match('|<wp:base_site_url>(.*?)</wp:base_site_url>|is', $importline, $url);
+                                       $this->base_url = $url[1];
+                                       continue;
+                               }
                                if ( false !== strpos($importline, '<wp:category>') ) {
                                        preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
                                        $this->categories[] = $category[1];
                                if ( false !== strpos($importline, '<wp:category>') ) {
                                        preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
                                        $this->categories[] = $category[1];
@@ -178,6 +198,7 @@ class WP_Import {
 
        function wp_authors_form() {
 ?>
 
        function wp_authors_form() {
 ?>
+<?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 <code>admin</code>s entries.'); ?></p>
 <?php
 <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 <code>admin</code>s entries.'); ?></p>
 <?php
@@ -187,9 +208,9 @@ class WP_Import {
 
 
                $authors = $this->get_wp_authors();
 
 
                $authors = $this->get_wp_authors();
-               echo '<ol id="authors">';
                echo '<form action="?import=wordpress&amp;step=2&amp;id=' . $this->id . '" method="post">';
                wp_nonce_field('import-wordpress');
                echo '<form action="?import=wordpress&amp;step=2&amp;id=' . $this->id . '" method="post">';
                wp_nonce_field('import-wordpress');
+               echo '<ol id="authors">';
                $j = -1;
                foreach ($authors as $author) {
                        ++ $j;
                $j = -1;
                foreach ($authors as $author) {
                        ++ $j;
@@ -201,6 +222,7 @@ class WP_Import {
                if ( $this->allow_fetch_attachments() ) {
 ?>
 </ol>
                if ( $this->allow_fetch_attachments() ) {
 ?>
 </ol>
+<?php screen_icon(); ?>
 <h2><?php _e('Import Attachments'); ?></h2>
 <p>
        <input type="checkbox" value="1" name="attachments" id="import-attachments" />
 <h2><?php _e('Import Attachments'); ?></h2>
 <p>
        <input type="checkbox" value="1" name="attachments" id="import-attachments" />
@@ -210,7 +232,9 @@ class WP_Import {
 <?php
                }
 
 <?php
                }
 
-               echo '<input type="submit" value="'.attribute_escape( __('Submit') ).'">'.'<br />';
+               echo '<p class="submit">';
+               echo '<input type="submit" class="button" value="'.attribute_escape( __('Submit') ).'" />'.'<br />';
+               echo '</p>';
                echo '</form>';
 
        }
                echo '</form>';
 
        }
@@ -218,7 +242,7 @@ 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="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30" /></label> <br />');
                }
                else {
                        echo __('Map to existing').'<br />';
                }
                else {
                        echo __('Map to existing').'<br />';
@@ -320,7 +344,6 @@ class WP_Import {
        }
 
        function process_posts() {
        }
 
        function process_posts() {
-               $i = -1;
                echo '<ol>';
 
                $this->get_entries(array(&$this, 'process_post'));
                echo '<ol>';
 
                $this->get_entries(array(&$this, 'process_post'));
@@ -339,7 +362,7 @@ class WP_Import {
                $post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
                if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already
                        return 0;
                $post_ID = (int) $this->get_tag( $post, 'wp:post_id' );
                if ( $post_ID && !empty($this->post_ids_processed[$post_ID]) ) // Processed already
                        return 0;
-               
+
                set_time_limit( 60 );
 
                // There are only ever one of these
                set_time_limit( 60 );
 
                // There are only ever one of these
@@ -358,12 +381,12 @@ class WP_Import {
                $post_author    = $this->get_tag( $post, 'dc:creator' );
 
                $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
                $post_author    = $this->get_tag( $post, 'dc:creator' );
 
                $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
-               $post_excerpt = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);
+               $post_excerpt = preg_replace_callback('|<(/?[A-Z]+)|', create_function('$match', 'return "<" . strtolower($match[1]);'), $post_excerpt);
                $post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
                $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
 
                $post_content = $this->get_tag( $post, 'content:encoded' );
                $post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
                $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
 
                $post_content = $this->get_tag( $post, 'content:encoded' );
-               $post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_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 = str_replace('<br>', '<br />', $post_content);
                $post_content = str_replace('<hr>', '<hr />', $post_content);
 
@@ -390,6 +413,7 @@ class WP_Import {
                if ( $post_exists ) {
                        echo '<li>';
                        printf(__('Post <em>%s</em> already exists.'), stripslashes($post_title));
                if ( $post_exists ) {
                        echo '<li>';
                        printf(__('Post <em>%s</em> already exists.'), stripslashes($post_title));
+                       $comment_post_ID = $post_id = $post_exists;
                } else {
 
                        // If it has parent, process parent first.
                } else {
 
                        // If it has parent, process parent first.
@@ -410,6 +434,7 @@ class WP_Import {
                        $post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
 
                        $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
                        $post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
 
                        $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
+                       $postdata['import_id'] = $post_ID;
                        if ($post_type == 'attachment') {
                                $remote_url = $this->get_tag( $post, 'wp:attachment_url' );
                                if ( !$remote_url )
                        if ($post_type == 'attachment') {
                                $remote_url = $this->get_tag( $post, 'wp:attachment_url' );
                                if ( !$remote_url )
@@ -436,6 +461,8 @@ class WP_Import {
                        if (count($categories) > 0) {
                                $post_cats = array();
                                foreach ($categories as $category) {
                        if (count($categories) > 0) {
                                $post_cats = array();
                                foreach ($categories as $category) {
+                                       if ( '' == $category )
+                                               continue;
                                        $slug = sanitize_term_field('slug', $category, 0, 'category', 'db');
                                        $cat = get_term_by('slug', $slug, 'category');
                                        $cat_ID = 0;
                                        $slug = sanitize_term_field('slug', $category, 0, 'category', 'db');
                                        $cat = get_term_by('slug', $slug, 'category');
                                        $cat_ID = 0;
@@ -444,6 +471,8 @@ class WP_Import {
                                        if ($cat_ID == 0) {
                                                $category = $wpdb->escape($category);
                                                $cat_ID = wp_insert_category(array('cat_name' => $category));
                                        if ($cat_ID == 0) {
                                                $category = $wpdb->escape($category);
                                                $cat_ID = wp_insert_category(array('cat_name' => $category));
+                                               if ( is_wp_error($cat_ID) )
+                                                       continue;
                                        }
                                        $post_cats[] = $cat_ID;
                                }
                                        }
                                        $post_cats[] = $cat_ID;
                                }
@@ -454,6 +483,8 @@ class WP_Import {
                        if (count($tags) > 0) {
                                $post_tags = array();
                                foreach ($tags as $tag) {
                        if (count($tags) > 0) {
                                $post_tags = array();
                                foreach ($tags as $tag) {
+                                       if ( '' == $tag )
+                                               continue;
                                        $slug = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
                                        $tag_obj = get_term_by('slug', $slug, 'post_tag');
                                        $tag_id = 0;
                                        $slug = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
                                        $tag_obj = get_term_by('slug', $slug, 'post_tag');
                                        $tag_id = 0;
@@ -462,6 +493,8 @@ class WP_Import {
                                        if ( $tag_id == 0 ) {
                                                $tag = $wpdb->escape($tag);
                                                $tag_id = wp_insert_term($tag, 'post_tag');
                                        if ( $tag_id == 0 ) {
                                                $tag = $wpdb->escape($tag);
                                                $tag_id = wp_insert_term($tag, 'post_tag');
+                                               if ( is_wp_error($tag_id) )
+                                                       continue;
                                                $tag_id = $tag_id['term_id'];
                                        }
                                        $post_tags[] = intval($tag_id);
                                                $tag_id = $tag_id['term_id'];
                                        }
                                        $post_tags[] = intval($tag_id);
@@ -525,6 +558,11 @@ class WP_Import {
        function process_attachment($postdata, $remote_url) {
                if ($this->fetch_attachments and $remote_url) {
                        printf( __('Importing attachment <em>%s</em>... '), htmlspecialchars($remote_url) );
        function process_attachment($postdata, $remote_url) {
                if ($this->fetch_attachments and $remote_url) {
                        printf( __('Importing attachment <em>%s</em>... '), htmlspecialchars($remote_url) );
+
+                       // If the URL is absolute, but does not contain http, upload it assuming the base_site_url variable
+                       if ( preg_match('/^\/[\w\W]+$/', $remote_url) )
+                               $remote_url = rtrim($this->base_url,'/').$remote_url;
+
                        $upload = $this->fetch_remote_file($postdata, $remote_url);
                        if ( is_wp_error($upload) ) {
                                printf( __('Remote file error: %s'), htmlspecialchars($upload->get_error_message()) );
                        $upload = $this->fetch_remote_file($postdata, $remote_url);
                        if ( is_wp_error($upload) ) {
                                printf( __('Remote file error: %s'), htmlspecialchars($upload->get_error_message()) );
@@ -579,10 +617,16 @@ class WP_Import {
                // fetch the remote url and write it to the placeholder file
                $headers = wp_get_http($url, $upload['file']);
 
                // fetch the remote url and write it to the placeholder file
                $headers = wp_get_http($url, $upload['file']);
 
+               //Request failed
+               if ( ! $headers ) {
+                       @unlink($upload['file']);
+                       return new WP_Error( 'import_file_error', __('Remote server did not respond') );
+               }
+
                // make sure the fetch was successful
                if ( $headers['response'] != '200' ) {
                        @unlink($upload['file']);
                // make sure the fetch was successful
                if ( $headers['response'] != '200' ) {
                        @unlink($upload['file']);
-                       return new WP_Error( 'import_file_error', sprintf(__('Remote file returned error response %d'), intval($headers['response'])) );
+                       return new WP_Error( 'import_file_error', sprintf(__('Remote file returned error response %1$d %2$s'), $headers['response'], get_status_header_desc($headers['response']) ) );
                }
                elseif ( isset($headers['content-length']) && filesize($upload['file']) != $headers['content-length'] ) {
                        @unlink($upload['file']);
                }
                elseif ( isset($headers['content-length']) && filesize($upload['file']) != $headers['content-length'] ) {
                        @unlink($upload['file']);
@@ -691,10 +735,12 @@ class WP_Import {
 
                $this->import_start();
                $this->get_authors_from_post();
 
                $this->import_start();
                $this->get_authors_from_post();
+               wp_suspend_cache_invalidation(true);
                $this->get_entries();
                $this->process_categories();
                $this->process_tags();
                $result = $this->process_posts();
                $this->get_entries();
                $this->process_categories();
                $this->process_tags();
                $result = $this->process_posts();
+               wp_suspend_cache_invalidation(false);
                $this->backfill_parents();
                $this->backfill_attachment_urls();
                $this->import_end();
                $this->backfill_parents();
                $this->backfill_attachment_urls();
                $this->import_end();
@@ -746,8 +792,15 @@ class WP_Import {
        }
 }
 
        }
 }
 
+/**
+ * Register WordPress Importer
+ *
+ * @since unknown
+ * @var WP_Import
+ * @name $wp_import
+ */
 $wp_import = new WP_Import();
 
 $wp_import = new WP_Import();
 
-register_importer('wordpress', 'WordPress', __('Import <strong>posts, comments, custom fields, pages, and categories</strong> from a WordPress export file.'), array ($wp_import, 'dispatch'));
+register_importer('wordpress', 'WordPress', __('Import <strong>posts, pages, comments, custom fields, categories, and tags</strong> from a WordPress export file.'), array ($wp_import, 'dispatch'));
 
 ?>
 
 ?>
index ff6da0d56cd6dcdaa3a9cc84cbd77e1ac0d200b1..90098ee2f0bbf5ab6a80b615c14cdd31a6b601ea 100644 (file)
@@ -1,5 +1,19 @@
 <?php
 <?php
-
+/**
+ * WordPress Categories to Tags Converter.
+ *
+ * @package WordPress
+ * @subpackage Importer
+ */
+
+/**
+ * WordPress categories to tags converter class.
+ *
+ * Will convert WordPress categories to tags, removing the category after the
+ * process is complete and updating all posts to switch to the tag.
+ *
+ * @since unknown
+ */
 class WP_Categories_to_Tags {
        var $categories_to_convert = array();
        var $all_categories = array();
 class WP_Categories_to_Tags {
        var $categories_to_convert = array();
        var $all_categories = array();
@@ -50,6 +64,7 @@ class WP_Categories_to_Tags {
                echo '<br class="clear" />';
 
                if ( $cat_num > 0 ) {
                echo '<br class="clear" />';
 
                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 '<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 '<h2>' . sprintf( __ngettext( '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>';
@@ -103,7 +118,7 @@ function check_all_rows() {
 
                                 if ( in_array( intval($category->term_id),  $this->hybrids_ids ) )
                                        echo ' <a href="#note"> * </a>';
 
                                 if ( in_array( intval($category->term_id),  $this->hybrids_ids ) )
                                        echo ' <a href="#note"> * </a>';
-                               
+
                                if ( isset($hier[$category->term_id]) )
                                        $this->_category_children($category, $hier); ?></li>
 <?php          }
                                if ( isset($hier[$category->term_id]) )
                                        $this->_category_children($category, $hier); ?></li>
 <?php          }
@@ -125,6 +140,7 @@ function check_all_rows() {
                echo '<br class="clear" />';
 
                if ( $tags_num > 0 ) {
                echo '<br class="clear" />';
 
                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 '<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 '<h2>' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
                        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>';
@@ -243,7 +259,7 @@ function check_all_tagrows() {
 
                                        if ( ! ($id = is_term( $category->slug, 'post_tag' ) ) )
                                                $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
 
                                        if ( ! ($id = is_term( $category->slug, 'post_tag' ) ) )
                                                $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
-                                       
+
                                        $id = $id['term_taxonomy_id'];
                                        $posts = get_objects_in_term($category->term_id, 'category');
                                        $term_order = 0;
                                        $id = $id['term_taxonomy_id'];
                                        $posts = get_objects_in_term($category->term_id, 'category');
                                        $term_order = 0;
@@ -252,7 +268,7 @@ function check_all_tagrows() {
                                                $values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
                                                clean_post_cache($post);
                                        }
                                                $values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
                                                clean_post_cache($post);
                                        }
-                                       
+
                                        if ( $values ) {
                                                $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)");
 
                                        if ( $values ) {
                                                $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)");
 
@@ -262,7 +278,7 @@ function check_all_tagrows() {
                                        echo __('Converted successfully.') . "</li>\n";
                                        continue;
                                }
                                        echo __('Converted successfully.') . "</li>\n";
                                        continue;
                                }
-                               
+
                                // if tag already exists, add it to all posts in the category
                                if ( $tag_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $category->term_id) ) ) {
                                        $objects_ids = get_objects_in_term($category->term_id, 'category');
                                // if tag already exists, add it to all posts in the category
                                if ( $tag_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $category->term_id) ) ) {
                                        $objects_ids = get_objects_in_term($category->term_id, 'category');
index 9bd25136872ca42888fbb62192f77b6f23b4bc16..a75a19934d22aa4721e6f0b93495b31ea6642b06 100644 (file)
@@ -1,20 +1,54 @@
 <?php
 <?php
+/**
+ * Includes all of the WordPress Administration API files.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
+/** WordPress Bookmark Administration API */
 require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
 require_once(ABSPATH . 'wp-admin/includes/bookmark.php');
+
+/** WordPress Comment Administration API */
 require_once(ABSPATH . 'wp-admin/includes/comment.php');
 require_once(ABSPATH . 'wp-admin/includes/comment.php');
+
+/** WordPress Administration File API */
 require_once(ABSPATH . 'wp-admin/includes/file.php');
 require_once(ABSPATH . 'wp-admin/includes/file.php');
+
+/** WordPress Image Administration API */
 require_once(ABSPATH . 'wp-admin/includes/image.php');
 require_once(ABSPATH . 'wp-admin/includes/image.php');
+
+/** WordPress Media Administration API */
 require_once(ABSPATH . 'wp-admin/includes/media.php');
 require_once(ABSPATH . 'wp-admin/includes/media.php');
+
+/** WordPress Import Administration API */
 require_once(ABSPATH . 'wp-admin/includes/import.php');
 require_once(ABSPATH . 'wp-admin/includes/import.php');
+
+/** WordPress Misc Administration API */
 require_once(ABSPATH . 'wp-admin/includes/misc.php');
 require_once(ABSPATH . 'wp-admin/includes/misc.php');
+
+/** WordPress Plugin Administration API */
 require_once(ABSPATH . 'wp-admin/includes/plugin.php');
 require_once(ABSPATH . 'wp-admin/includes/plugin.php');
+
+/** WordPress Post Administration API */
 require_once(ABSPATH . 'wp-admin/includes/post.php');
 require_once(ABSPATH . 'wp-admin/includes/post.php');
+
+/** WordPress Taxonomy Administration API */
 require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
 require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
+
+/** WordPress Template Administration API */
 require_once(ABSPATH . 'wp-admin/includes/template.php');
 require_once(ABSPATH . 'wp-admin/includes/template.php');
+
+/** WordPress Theme Administration API */
 require_once(ABSPATH . 'wp-admin/includes/theme.php');
 require_once(ABSPATH . 'wp-admin/includes/theme.php');
+
+/** WordPress User Administration API */
 require_once(ABSPATH . 'wp-admin/includes/user.php');
 require_once(ABSPATH . 'wp-admin/includes/user.php');
+
+/** WordPress Update Administration API */
 require_once(ABSPATH . 'wp-admin/includes/update.php');
 
 require_once(ABSPATH . 'wp-admin/includes/update.php');
 
+/** WordPress Registration API */
 require_once(ABSPATH . WPINC . '/registration.php');
 
 require_once(ABSPATH . WPINC . '/registration.php');
 
-?>
+?>
\ No newline at end of file
index 697a71c4fcf02e42a90563dbd17f7a1553f09396..a0077a10b067362d24dcfa11a2a257b095722713 100644 (file)
@@ -1,9 +1,30 @@
 <?php
 <?php
-
+/**
+ * WordPress Bookmark Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function add_link() {
        return edit_link();
 }
 
 function add_link() {
        return edit_link();
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $link_id
+ * @return unknown
+ */
 function edit_link( $link_id = '' ) {
        if (!current_user_can( 'manage_links' ))
                wp_die( __( 'Cheatin&#8217; uh?' ));
 function edit_link( $link_id = '' ) {
        if (!current_user_can( 'manage_links' ))
                wp_die( __( 'Cheatin&#8217; uh?' ));
@@ -13,7 +34,7 @@ function edit_link( $link_id = '' ) {
        $_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_name'] = wp_specialchars( $_POST['link_name'] );
        $_POST['link_image'] = wp_specialchars( $_POST['link_image'] );
        $_POST['link_rss'] = clean_url($_POST['link_rss']);
-       if ( 'N' != $_POST['link_visible'] )
+       if ( !isset($_POST['link_visible']) || 'N' != $_POST['link_visible'] )
                $_POST['link_visible'] = 'Y';
 
        if ( !empty( $link_id ) ) {
                $_POST['link_visible'] = 'Y';
 
        if ( !empty( $link_id ) ) {
@@ -24,6 +45,13 @@ function edit_link( $link_id = '' ) {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_default_link_to_edit() {
        if ( isset( $_GET['linkurl'] ) )
                $link->link_url = clean_url( $_GET['linkurl']);
 function get_default_link_to_edit() {
        if ( isset( $_GET['linkurl'] ) )
                $link->link_url = clean_url( $_GET['linkurl']);
@@ -40,137 +68,206 @@ function get_default_link_to_edit() {
        return $link;
 }
 
        return $link;
 }
 
-function wp_delete_link($link_id) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $link_id
+ * @return unknown
+ */
+function wp_delete_link( $link_id ) {
        global $wpdb;
 
        global $wpdb;
 
-       do_action('delete_link', $link_id);
+       do_action( 'delete_link', $link_id );
+
+       wp_delete_object_term_relationships( $link_id, 'link_category' );
 
 
-       wp_delete_object_term_relationships($link_id, 'link_category');
+       $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->links WHERE link_id = %d", $link_id ) );
 
 
-       $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_id = %d", $link_id) );
+       do_action( 'deleted_link', $link_id );
 
 
-       do_action('deleted_link', $link_id);
+       clean_bookmark_cache( $link_id );
 
        return true;
 }
 
 
        return true;
 }
 
-function wp_get_link_cats($link_id = 0) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $link_id
+ * @return unknown
+ */
+function wp_get_link_cats( $link_id = 0 ) {
 
 
-       $cats = wp_get_object_terms($link_id, 'link_category', 'fields=ids');
+       $cats = wp_get_object_terms( $link_id, 'link_category', 'fields=ids' );
 
 
-       return array_unique($cats);
+       return array_unique( $cats );
 }
 
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $link_id
+ * @return unknown
+ */
 function get_link_to_edit( $link_id ) {
        return get_bookmark( $link_id, OBJECT, 'edit' );
 }
 
 function get_link_to_edit( $link_id ) {
        return get_bookmark( $link_id, OBJECT, 'edit' );
 }
 
-function wp_insert_link($linkdata) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $linkdata
+ * @return unknown
+ */
+function wp_insert_link( $linkdata, $wp_error = false ) {
        global $wpdb, $current_user;
 
        global $wpdb, $current_user;
 
-       $defaults = array('link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 );
+       $defaults = array( 'link_id' => 0, 'link_name' => '', 'link_url' => '', 'link_rating' => 0 );
 
 
-       $linkdata = wp_parse_args($linkdata, $defaults);
-       $linkdata = sanitize_bookmark($linkdata, 'db');
+       $linkdata = wp_parse_args( $linkdata, $defaults );
+       $linkdata = sanitize_bookmark( $linkdata, 'db' );
 
 
-       extract(stripslashes_deep($linkdata), EXTR_SKIP);
+       extract( stripslashes_deep( $linkdata ), EXTR_SKIP );
 
        $update = false;
 
 
        $update = false;
 
-       if ( !empty($link_id) )
+       if ( !empty( $link_id ) )
                $update = true;
 
                $update = true;
 
-       if ( trim( $link_name ) == '' )
-               return 0;
+       if ( trim( $link_name ) == '' ) {
+               if ( trim( $link_url ) != '' ) {
+                       $link_name = $link_url;
+               } else {
+                       return 0;
+               }
+       }
 
        if ( trim( $link_url ) == '' )
                return 0;
 
 
        if ( trim( $link_url ) == '' )
                return 0;
 
-       if ( empty($link_rating) )
+       if ( empty( $link_rating ) )
                $link_rating = 0;
 
                $link_rating = 0;
 
-       if ( empty($link_image) )
+       if ( empty( $link_image ) )
                $link_image = '';
 
                $link_image = '';
 
-       if ( empty($link_target) )
+       if ( empty( $link_target ) )
                $link_target = '';
 
                $link_target = '';
 
-       if ( empty($link_visible) )
+       if ( empty( $link_visible ) )
                $link_visible = 'Y';
 
                $link_visible = 'Y';
 
-       if ( empty($link_owner) )
+       if ( empty( $link_owner ) )
                $link_owner = $current_user->id;
 
                $link_owner = $current_user->id;
 
-       if ( empty($link_notes) )
+       if ( empty( $link_notes ) )
                $link_notes = '';
 
                $link_notes = '';
 
-       if ( empty($link_description) )
+       if ( empty( $link_description ) )
                $link_description = '';
 
                $link_description = '';
 
-       if ( empty($link_rss) )
+       if ( empty( $link_rss ) )
                $link_rss = '';
 
                $link_rss = '';
 
-       if ( empty($link_rel) )
+       if ( empty( $link_rel ) )
                $link_rel = '';
 
        // Make sure we set a valid category
                $link_rel = '';
 
        // Make sure we set a valid category
-       if (0 == count($link_category) || !is_array($link_category)) {
-               $link_category = array(get_option('default_link_category'));
+       if ( ! isset( $link_category ) ||0 == count( $link_category ) || !is_array( $link_category ) ) {
+               $link_category = array( get_option( 'default_link_category' ) );
        }
 
        if ( $update ) {
        }
 
        if ( $update ) {
-               $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_url = %s,
-                       link_name = %s, link_image = %s, link_target = %s, 
-                       link_visible = %s, link_description = %s, link_rating = %s, 
+               if ( false === $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->links SET link_url = %s,
+                       link_name = %s, link_image = %s, link_target = %s,
+                       link_visible = %s, link_description = %s, link_rating = %s,
                        link_rel = %s, link_notes = %s, link_rss = %s
                        link_rel = %s, link_notes = %s, link_rss = %s
-                       WHERE link_id = %s", $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id) );
+                       WHERE link_id = %s", $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id ) ) ) {
+                       if ( $wp_error )
+                               return new WP_Error( 'db_update_error', __( 'Could not update link in the database' ), $wpdb->last_error );
+                       else
+                               return 0;
+               }
        } else {
        } else {
-               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", 
-               $link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss) );
+               if ( false === $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
+               $link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss ) ) ) {
+                       if ( $wp_error )
+                               return new WP_Error( 'db_insert_error', __( 'Could not insert link into the database' ), $wpdb->last_error );
+                       else
+                               return 0;
+               }
                $link_id = (int) $wpdb->insert_id;
        }
 
                $link_id = (int) $wpdb->insert_id;
        }
 
-       wp_set_link_cats($link_id, $link_category);
+       wp_set_link_cats( $link_id, $link_category );
 
        if ( $update )
 
        if ( $update )
-               do_action('edit_link', $link_id);
+               do_action( 'edit_link', $link_id );
        else
        else
-               do_action('add_link', $link_id);
+               do_action( 'add_link', $link_id );
+
+       clean_bookmark_cache( $link_id );
 
        return $link_id;
 }
 
 
        return $link_id;
 }
 
-function wp_set_link_cats($link_id = 0, $link_categories = array()) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $link_id
+ * @param unknown_type $link_categories
+ */
+function wp_set_link_cats( $link_id = 0, $link_categories = array() ) {
        // If $link_categories isn't already an array, make it one:
        // If $link_categories isn't already an array, make it one:
-       if (!is_array($link_categories) || 0 == count($link_categories))
-               $link_categories = array(get_option('default_link_category'));
+       if ( !is_array( $link_categories ) || 0 == count( $link_categories ) )
+               $link_categories = array( get_option( 'default_link_category' ) );
+
+       $link_categories = array_map( 'intval', $link_categories );
+       $link_categories = array_unique( $link_categories );
 
 
-       $link_categories = array_map('intval', $link_categories);
-       $link_categories = array_unique($link_categories);
+       wp_set_object_terms( $link_id, $link_categories, 'link_category' );
 
 
-       wp_set_object_terms($link_id, $link_categories, 'link_category');
+       clean_bookmark_cache( $link_id );
 }      // wp_set_link_cats()
 
 }      // wp_set_link_cats()
 
-function wp_update_link($linkdata) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $linkdata
+ * @return unknown
+ */
+function wp_update_link( $linkdata ) {
        $link_id = (int) $linkdata['link_id'];
 
        $link_id = (int) $linkdata['link_id'];
 
-       $link = get_link($link_id, ARRAY_A);
+       $link = get_link( $link_id, ARRAY_A );
 
        // Escape data pulled from DB.
 
        // Escape data pulled from DB.
-       $link = add_magic_quotes($link);
+       $link = add_magic_quotes( $link );
 
        // Passed link category list overwrites existing category list if not empty.
 
        // Passed link category list overwrites existing category list if not empty.
-       if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
-                        && 0 != count($linkdata['link_category']) )
+       if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
+                        && 0 != count( $linkdata['link_category'] ) )
                $link_cats = $linkdata['link_category'];
        else
                $link_cats = $link['link_category'];
 
        // Merge old and new fields with new fields overwriting old ones.
                $link_cats = $linkdata['link_category'];
        else
                $link_cats = $link['link_category'];
 
        // Merge old and new fields with new fields overwriting old ones.
-       $linkdata = array_merge($link, $linkdata);
+       $linkdata = array_merge( $link, $linkdata );
        $linkdata['link_category'] = $link_cats;
 
        $linkdata['link_category'] = $link_cats;
 
-       return wp_insert_link($linkdata);
+       return wp_insert_link( $linkdata );
 }
 
 }
 
-?>
\ No newline at end of file
+?>
index 5ef92bfddac2404a9b4400ccb83c0c696c0bca4d..c947f4484d47b86e4348adf845a4a3b2e8bc892c 100644 (file)
  * @link http://www.phpclasses.org/browse/package/1743.html Site
  * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
  */
  * @link http://www.phpclasses.org/browse/package/1743.html Site
  * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
  */
+
+/**
+ * FTP implementation using fsockopen to connect.
+ *
+ * @package PemFTP
+ * @subpackage Pure
+ * @since 2.5
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
+ */
 class ftp extends ftp_base {
 
        function ftp($verb=FALSE, $le=FALSE) {
 class ftp extends ftp_base {
 
        function ftp($verb=FALSE, $le=FALSE) {
@@ -172,4 +186,5 @@ class ftp extends ftp_base {
                }
        }
 }
                }
        }
 }
+
 ?>
 ?>
index 99b40505695c99fb8f74b0d02b9249ac718b829e..4026dd0bb18ba8a391f9cfdf7c0c43f5e6171718 100644 (file)
  * @link http://www.phpclasses.org/browse/package/1743.html Site
  * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
  */
  * @link http://www.phpclasses.org/browse/package/1743.html Site
  * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
  */
+
+/**
+ * Socket Based FTP implementation
+ *
+ * @package PemFTP
+ * @subpackage Socket
+ * @since 2.5
+ *
+ * @version 1.0
+ * @copyright Alexey Dotsenko
+ * @author Alexey Dotsenko
+ * @link http://www.phpclasses.org/browse/package/1743.html Site
+ * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
+ */
 class ftp extends ftp_base {
 
        function ftp($verb=FALSE, $le=FALSE) {
 class ftp extends ftp_base {
 
        function ftp($verb=FALSE, $le=FALSE) {
index c10526bddb0554904674e18e0155f0c05a0fe90c..0bf25e9c7853cc3e1cbc3a6d0c2be5501933afc9 100644 (file)
  * @link http://www.phpclasses.org/browse/package/1743.html Site
  * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
  */
  * @link http://www.phpclasses.org/browse/package/1743.html Site
  * @license LGPL License http://www.opensource.org/licenses/lgpl-license.html
  */
+
+/**
+ * Defines the newline characters, if not defined already.
+ *
+ * This can be redefined.
+ *
+ * @since 2.5
+ * @var string
+ */
 if(!defined('CRLF')) define('CRLF',"\r\n");
 if(!defined('CRLF')) define('CRLF',"\r\n");
+
+/**
+ * Sets whatever to autodetect ASCII mode.
+ *
+ * This can be redefined.
+ *
+ * @since 2.5
+ * @var int
+ */
 if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);
 if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);
+
+/**
+ *
+ * This can be redefined.
+ * @since 2.5
+ * @var int
+ */
 if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);
 if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);
+
+/**
+ *
+ * This can be redefined.
+ * @since 2.5
+ * @var int
+ */
 if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);
 if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);
-if(!defined('FTP_FORCE')) define('FTP_FORCE', TRUE);
+
+/**
+ * Whether to force FTP.
+ *
+ * This can be redefined.
+ *
+ * @since 2.5
+ * @var bool
+ */
+if(!defined('FTP_FORCE')) define('FTP_FORCE', true);
+
+/**
+ * @since 2.5
+ * @var string
+ */
 define('FTP_OS_Unix','u');
 define('FTP_OS_Unix','u');
+
+/**
+ * @since 2.5
+ * @var string
+ */
 define('FTP_OS_Windows','w');
 define('FTP_OS_Windows','w');
+
+/**
+ * @since 2.5
+ * @var string
+ */
 define('FTP_OS_Mac','m');
 
 define('FTP_OS_Mac','m');
 
+/**
+ * PemFTP base class
+ *
+ */
 class ftp_base {
        /* Public variables */
        var $LocalEcho;
 class ftp_base {
        /* Public variables */
        var $LocalEcho;
@@ -838,5 +898,6 @@ if (!extension_loaded('sockets')) {
        $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
        if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
 }
        $prefix = (PHP_SHLIB_SUFFIX == 'dll') ? 'php_' : '';
        if(!@dl($prefix . 'sockets.' . PHP_SHLIB_SUFFIX)) $mod_sockets=FALSE;
 }
+
 require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php";
 ?>
 require_once "class-ftp-".($mod_sockets?"sockets":"pure").".php";
 ?>
index b49074444852dd0d88725699c4b3067305ddd210..fcc5351c52503db198d5aee09a82516894c89e72 100644 (file)
@@ -1,51 +1,60 @@
 <?php
 <?php
-// --------------------------------------------------------------------------------
-// PhpConcept Library - Zip Module 2.5
-// --------------------------------------------------------------------------------
-// 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.44 2006/03/08 21:23:59 vblavet Exp $
-// --------------------------------------------------------------------------------
-
-  // ----- Constants
-  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.
-  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
-  define( 'PCLZIP_ERROR_EXTERNAL', 0 );
+/**
+ * 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 );
 
   // ----- 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
   define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
   define( 'PCLZIP_CB_PRE_ADD', 78003 );
   define( 'PCLZIP_CB_POST_ADD', 78004 );
   define( 'PCLZIP_CB_POST_EXTRACT', 78002 );
   define( 'PCLZIP_CB_PRE_ADD', 78003 );
   define( 'PCLZIP_CB_POST_ADD', 78004 );
-  /* For futur use
+  /* For future 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 );
index 820703e4db14299f2d96f5e85f9350e97cd20a42..eefdd1c28aaaf1d9c666c31e346022aa11510c41 100644 (file)
 <?php
 <?php
-class WP_Filesystem_Base{
+/**
+ * Base WordPress Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * Base WordPress Filesystem class for which Filesystem implementations extend
+ *
+ * @since 2.5
+ */
+class WP_Filesystem_Base {
+       /**
+        * Whether to display debug data for the connection or not.
+        *
+        * @since 2.5
+        * @access public
+        * @var bool
+        */
        var $verbose = false;
        var $verbose = false;
+       /**
+        * Cached list of local filepaths to maped remote filepaths.
+        *
+        * @since 2.7
+        * @access private
+        * @var array
+        */
        var $cache = array();
        var $cache = array();
-       
+
+       /**
+        * The Access method of the current connection, Set automatically.
+        *
+        * @since 2.5
+        * @access public
+        * @var string
+        */
        var $method = '';
        var $method = '';
-       
+
+       /**
+        * Returns the path on the remote filesystem of ABSPATH
+        *
+        * @since 2.7
+        * @access public
+        * @return string The location of the remote path.
+        */
        function abspath() {
        function abspath() {
-               if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false ) 
+               if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false )
                        return FTP_BASE;
                        return FTP_BASE;
-               return $this->find_folder(ABSPATH);
+               $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 = '/';
+               return $folder;
        }
        }
+       /**
+        * Returns the path on the remote filesystem of WP_CONTENT_DIR
+        *
+        * @since 2.7
+        * @access public
+        * @return string The location of the remote path.
+        */
        function wp_content_dir() {
        function wp_content_dir() {
-               if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false ) 
+               if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false )
                        return FTP_CONTENT_DIR;
                return $this->find_folder(WP_CONTENT_DIR);
        }
                        return FTP_CONTENT_DIR;
                return $this->find_folder(WP_CONTENT_DIR);
        }
+       /**
+        * Returns the path on the remote filesystem of WP_PLUGIN_DIR
+        *
+        * @since 2.7
+        * @access public
+        *
+        * @return string The location of the remote path.
+        */
        function wp_plugins_dir() {
        function wp_plugins_dir() {
-               if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false ) 
+               if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false )
                        return FTP_PLUGIN_DIR;
                return $this->find_folder(WP_PLUGIN_DIR);
        }
                        return FTP_PLUGIN_DIR;
                return $this->find_folder(WP_PLUGIN_DIR);
        }
+       /**
+        * Returns the path on the remote filesystem of the Themes Directory
+        *
+        * @since 2.7
+        * @access public
+        *
+        * @return string The location of the remote path.
+        */
        function wp_themes_dir() {
                return $this->wp_content_dir() . '/themes';
        }
        function wp_themes_dir() {
                return $this->wp_content_dir() . '/themes';
        }
-       //Back compat: use abspath() or wp_*_dir
+
+       /**
+        * Locates a folder on the remote filesystem.
+        *
+        * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
+        *
+        * @since 2.5
+        * @deprecated 2.7
+        * @access public
+        *
+        * @param string $base The folder to start searching from
+        * @param bool $echo True to display debug information
+        * @return string The location of the remote path.
+        */
        function find_base_dir($base = '.', $echo = false) {
        function find_base_dir($base = '.', $echo = false) {
+               _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
                $this->verbose = $echo;
                return $this->abspath();
        }
                $this->verbose = $echo;
                return $this->abspath();
        }
-       //Back compat: use ::abspath() or ::wp_*_dir
+       /**
+        * Locates a folder on the remote filesystem.
+        *
+        * Deprecated; use WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir() methods instead.
+        *
+        * @since 2.5
+        * @deprecated 2.7
+        * @access public
+        *
+        * @param string $base The folder to start searching from
+        * @param bool $echo True to display debug information
+        * @return string The location of the remote path.
+        */
        function get_base_dir($base = '.', $echo = false) {
        function get_base_dir($base = '.', $echo = false) {
+               _deprecated_function(__FUNCTION__, '2.7', 'WP_Filesystem::abspath() or WP_Filesystem::wp_*_dir()' );
                $this->verbose = $echo;
                return $this->abspath();
        }
                $this->verbose = $echo;
                return $this->abspath();
        }
-       
+
+       /**
+        * Locates a folder on the remote filesystem.
+        *
+        * Assumes that on Windows systems, Stripping off the Drive letter is OK
+        * Sanitizes \\ to / in windows filepaths.
+        *
+        * @since 2.7
+        * @access public
+        *
+        * @param string $folder the folder to locate
+        * @return string The location of the remote path.
+        */
        function find_folder($folder) {
        function find_folder($folder) {
-               $folder = str_replace('\\', '/', $folder); //Windows Sanitiation
+
+               $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
+               $folder = str_replace('\\', '/', $folder); //Windows path sanitiation
+
                if ( isset($this->cache[ $folder ] ) )
                        return $this->cache[ $folder ];
 
                if ( isset($this->cache[ $folder ] ) )
                        return $this->cache[ $folder ];
 
@@ -47,26 +156,37 @@ class WP_Filesystem_Base{
                        $this->cache[ $folder ] = $return;
                return $return;
        }
                        $this->cache[ $folder ] = $return;
                return $return;
        }
-       
-       // Assumes $folder is windows sanitized;
-       // Assumes that the drive letter is safe to be stripped off, Should not be a problem for windows servers.
+
+       /**
+        * Locates a folder on the remote filesystem.
+        *
+        * Expects Windows sanitized path
+        *
+        * @since 2.7
+        * @access private
+        *
+        * @param string $folder the folder to locate
+        * @param string $base the folder to start searching from
+        * @param bool $loop if the function has recursed, Internal use only
+        * @return string The location of the remote path.
+        */
        function search_for_folder($folder, $base = '.', $loop = false ) {
                if ( empty( $base ) || '.' == $base )
                        $base = trailingslashit($this->cwd());
        function search_for_folder($folder, $base = '.', $loop = false ) {
                if ( empty( $base ) || '.' == $base )
                        $base = trailingslashit($this->cwd());
-               
-               $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
-               
+
+               $folder = untrailingslashit($folder);
+
                $folder_parts = explode('/', $folder);
                $last_path = $folder_parts[ count($folder_parts) - 1 ];
                $folder_parts = explode('/', $folder);
                $last_path = $folder_parts[ count($folder_parts) - 1 ];
-               
+
                $files = $this->dirlist( $base );
                $files = $this->dirlist( $base );
-               
+
                foreach ( $folder_parts as $key ) {
                        if ( $key == $last_path )
                                continue; //We want this to be caught by the next code block.
 
                foreach ( $folder_parts as $key ) {
                        if ( $key == $last_path )
                                continue; //We want this to be caught by the next code block.
 
-                       //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder, 
-                       // If its found, change into it and follow through looking for it. 
+                       //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
+                       // 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 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 ]) ){
@@ -78,7 +198,7 @@ class WP_Filesystem_Base{
                                        return $ret;
                        }
                }
                                        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 )
                //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 )
@@ -88,13 +208,23 @@ class WP_Filesystem_Base{
                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.
                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 $this->search_for_folder($folder, '/', true);
+
        }
        }
-       
-       //Common Helper functions.
+
+       /**
+        * Returns the *nix style file permissions for a file
+        *
+        * From the PHP documentation page for fileperms()
+        *
+        * @link http://docs.php.net/fileperms
+        * @since 2.5
+        * @access public
+        *
+        * @param string $file string filename
+        * @return int octal representation of permissions
+        */
        function gethchmod($file){
        function gethchmod($file){
-               //From the PHP.net page for ...?
                $perms = $this->getchmod($file);
                if (($perms & 0xC000) == 0xC000) // Socket
                        $info = 's';
                $perms = $this->getchmod($file);
                if (($perms & 0xC000) == 0xC000) // Socket
                        $info = 's';
@@ -135,24 +265,52 @@ class WP_Filesystem_Base{
                                        (($perms & 0x0200) ? 'T' : '-'));
                return $info;
        }
                                        (($perms & 0x0200) ? 'T' : '-'));
                return $info;
        }
+
+       /**
+        * Converts *nix style file permissions to a octal number.
+        *
+        * Converts '-rw-r--r--' to 0644
+        * From "info at rvgate dot nl"'s comment on the PHP documentation for chmod()
+        *
+        * @link http://docs.php.net/manual/en/function.chmod.php#49614
+        * @since 2.5
+        * @access public
+        *
+        * @param string $mode string *nix style file permission
+        * @return int octal representation
+        */
        function getnumchmodfromh($mode) {
        function getnumchmodfromh($mode) {
-               $realmode = "";
-               $legal =  array("", "w", "r", "x", "-");
-               $attarray = preg_split("//", $mode);
+               $realmode = '';
+               $legal =  array('', 'w', 'r', 'x', '-');
+               $attarray = preg_split('//', $mode);
 
                for($i=0; $i < count($attarray); $i++)
                   if($key = array_search($attarray[$i], $legal))
                           $realmode .= $legal[$key];
 
                for($i=0; $i < count($attarray); $i++)
                   if($key = array_search($attarray[$i], $legal))
                           $realmode .= $legal[$key];
-                          
+
                $mode = str_pad($realmode, 9, '-');
                $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
                $mode = strtr($mode,$trans);
                $mode = str_pad($realmode, 9, '-');
                $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
                $mode = strtr($mode,$trans);
-               
+
                $newmode = '';
                $newmode .= $mode[0] + $mode[1] + $mode[2];
                $newmode .= $mode[3] + $mode[4] + $mode[5];
                $newmode .= $mode[6] + $mode[7] + $mode[8];
                return $newmode;
        }
                $newmode = '';
                $newmode .= $mode[0] + $mode[1] + $mode[2];
                $newmode .= $mode[3] + $mode[4] + $mode[5];
                $newmode .= $mode[6] + $mode[7] + $mode[8];
                return $newmode;
        }
+
+       /**
+        * Determines if the string provided contains binary characters.
+        *
+        * @since 2.7
+        * @access private
+        *
+        * @param string $text String to test against
+        * @return bool true if string is binary, false otherwise
+        */
+       function is_binary( $text ) {
+               return (bool) preg_match('|[^\x20-\x7E]|', $text); //chr(32)..chr(127)
+       }
 }
 }
+
 ?>
 ?>
index 77a7582669bfca178cba2d83188c9a38e2f604e5..4801b5f83576b84ad0f76ee9fc0d49feb94d2e04 100644 (file)
@@ -1,5 +1,19 @@
 <?php
 <?php
+/**
+ * WordPress Direct Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
 
 
+/**
+ * WordPress Filesystem Class for direct PHP file and folder manipulation.
+ *
+ * @since 2.5
+ * @package WordPress
+ * @subpackage Filesystem
+ * @uses WP_Filesystem_Base Extends class
+ */
 class WP_Filesystem_Direct  extends WP_Filesystem_Base {
        var $permission = null;
        var $errors = array();
 class WP_Filesystem_Direct  extends WP_Filesystem_Base {
        var $permission = null;
        var $errors = array();
@@ -218,7 +232,9 @@ class WP_Filesystem_Direct  extends WP_Filesystem_Base {
                        return false;
 
                $ret = array();
                        return false;
 
                $ret = array();
-               $dir = dir($path);
+               $dir = @dir($path);
+               if ( ! $dir )
+                       return false;
                while (false !== ($entry = $dir->read()) ) {
                        $struc = array();
                        $struc['name'] = $entry;
                while (false !== ($entry = $dir->read()) ) {
                        $struc = array();
                        $struc['name'] = $entry;
index 20699351d9d96fb52e1eaa8ecfa49acd1c9d7a96..a2805da80ddb992b351927e8f77403cb87b027bb 100644 (file)
@@ -1,5 +1,20 @@
 <?php
 <?php
-class WP_Filesystem_FTPext extends WP_Filesystem_Base{
+/**
+ * WordPress FTP Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * WordPress Filesystem Class for implementing FTP.
+ *
+ * @since 2.5
+ * @package WordPress
+ * @subpackage Filesystem
+ * @uses WP_Filesystem_Base Extends class
+ */
+class WP_Filesystem_FTPext extends WP_Filesystem_Base {
        var $link;
        var $timeout = 5;
        var $errors = array();
        var $link;
        var $timeout = 5;
        var $errors = array();
@@ -7,21 +22,6 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
 
        var $permission = null;
 
 
        var $permission = null;
 
-       var $filetypes = array(
-                                                       'php'=>FTP_ASCII,
-                                                       'css'=>FTP_ASCII,
-                                                       'txt'=>FTP_ASCII,
-                                                       'js'=>FTP_ASCII,
-                                                       'html'=>FTP_ASCII,
-                                                       'htm'=>FTP_ASCII,
-                                                       'xml'=>FTP_ASCII,
-
-                                                       'jpg'=>FTP_BINARY,
-                                                       'png'=>FTP_BINARY,
-                                                       'gif'=>FTP_BINARY,
-                                                       'bmp'=>FTP_BINARY
-                                                       );
-
        function WP_Filesystem_FTPext($opt='') {
                $this->method = 'ftpext';
                $this->errors = new WP_Error();
        function WP_Filesystem_FTPext($opt='') {
                $this->method = 'ftpext';
                $this->errors = new WP_Error();
@@ -57,7 +57,11 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
                else
                        $this->options['password'] = $opt['password'];
 
                else
                        $this->options['password'] = $opt['password'];
 
-               $this->options['ssl'] = ( !empty($opt['ssl']) );
+               $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'] );
        }
 
        function connect() {
        }
 
        function connect() {
@@ -76,28 +80,33 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
                        return false;
                }
 
                        return false;
                }
 
+               //Set the Connection to use Passive FTP
+               @ftp_pasv( $this->link, true );
+
                return true;
        }
 
        function setDefaultPermissions($perm) {
                $this->permission = $perm;
        }
                return true;
        }
 
        function setDefaultPermissions($perm) {
                $this->permission = $perm;
        }
-       
+
        function get_contents($file, $type = '', $resumepos = 0 ){
        function get_contents($file, $type = '', $resumepos = 0 ){
-               if( empty($type) ){
-                       $extension = substr(strrchr($file, "."), 1);
-                       $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
-               }
+               if( empty($type) )
+                       $type = FTP_BINARY;
+
                $temp = tmpfile();
                if ( ! $temp )
                        return false;
                $temp = tmpfile();
                if ( ! $temp )
                        return false;
+
                if( ! @ftp_fget($this->link, $temp, $file, $type, $resumepos) )
                        return false;
                if( ! @ftp_fget($this->link, $temp, $file, $type, $resumepos) )
                        return false;
+
                fseek($temp, 0); //Skip back to the start of the file being written to
                $contents = '';
                fseek($temp, 0); //Skip back to the start of the file being written to
                $contents = '';
-               while (!feof($temp)) {
+
+               while ( ! feof($temp) )
                        $contents .= fread($temp, 8192);
                        $contents .= fread($temp, 8192);
-               }
+
                fclose($temp);
                return $contents;
        }
                fclose($temp);
                return $contents;
        }
@@ -105,21 +114,23 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
                return explode("\n", $this->get_contents($file));
        }
        function put_contents($file, $contents, $type = '' ) {
                return explode("\n", $this->get_contents($file));
        }
        function put_contents($file, $contents, $type = '' ) {
-               if( empty($type) ) {
-                       $extension = substr(strrchr($file, "."), 1);
-                       $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
-               }
+               if( empty($type) )
+                       $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
+
                $temp = tmpfile();
                if ( ! $temp )
                        return false;
                $temp = tmpfile();
                if ( ! $temp )
                        return false;
+
                fwrite($temp, $contents);
                fseek($temp, 0); //Skip back to the start of the file being written to
                fwrite($temp, $contents);
                fseek($temp, 0); //Skip back to the start of the file being written to
+
                $ret = @ftp_fput($this->link, $file, $temp, $type);
                $ret = @ftp_fput($this->link, $file, $temp, $type);
+
                fclose($temp);
                return $ret;
        }
        function cwd() {
                fclose($temp);
                return $ret;
        }
        function cwd() {
-               $cwd = ftp_pwd($this->link);
+               $cwd = @ftp_pwd($this->link);
                if( $cwd )
                        $cwd = trailingslashit($cwd);
                return $cwd;
                if( $cwd )
                        $cwd = trailingslashit($cwd);
                return $cwd;
index 3b6cdcc8ade2e767679c001330cccb94bbd06449..d5ee3f97b4a4b4ad4c9b75f82b69e34d95935a0b 100644 (file)
@@ -1,4 +1,19 @@
 <?php
 <?php
+/**
+ * WordPress FTP Sockets Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * WordPress Filesystem Class for implementing FTP Sockets.
+ *
+ * @since 2.5
+ * @package WordPress
+ * @subpackage Filesystem
+ * @uses WP_Filesystem_Base Extends class
+ */
 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;
@@ -7,22 +22,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
 
        var $permission = null;
 
 
        var $permission = null;
 
-       var $filetypes = array(
-                                                       'php' => FTP_ASCII,
-                                                       'css' => FTP_ASCII,
-                                                       'txt' => FTP_ASCII,
-                                                       'js'  => FTP_ASCII,
-                                                       'html'=> FTP_ASCII,
-                                                       'htm' => FTP_ASCII,
-                                                       'xml' => FTP_ASCII,
-
-                                                       'jpg' => FTP_BINARY,
-                                                       'png' => FTP_BINARY,
-                                                       'gif' => FTP_BINARY,
-                                                       'bmp' => FTP_BINARY
-                                                       );
-
-       function WP_Filesystem_ftpsockets($opt='') {
+       function WP_Filesystem_ftpsockets($opt = '') {
                $this->method = 'ftpsockets';
                $this->errors = new WP_Error();
 
                $this->method = 'ftpsockets';
                $this->errors = new WP_Error();
 
@@ -86,51 +86,57 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                $this->permission = $perm;
        }
 
                $this->permission = $perm;
        }
 
-       function get_contents($file, $type = '', $resumepos = 0){
+       function get_contents($file, $type = '', $resumepos = 0) {
                if( ! $this->exists($file) )
                        return false;
 
                if( ! $this->exists($file) )
                        return false;
 
-               if( empty($type) ){
-                       $extension = substr(strrchr($file, '.'), 1);
-                       $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
-               }
+               if( empty($type) )
+                       $type = FTP_AUTOASCII;
                $this->ftp->SetType($type);
                $this->ftp->SetType($type);
+
                $temp = wp_tempnam( $file );
                $temp = wp_tempnam( $file );
+
                if ( ! $temphandle = fopen($temp, 'w+') )
                        return false;
                if ( ! $temphandle = fopen($temp, 'w+') )
                        return false;
+
                if ( ! $this->ftp->fget($temphandle, $file) ) {
                        fclose($temphandle);
                        unlink($temp);
                        return ''; //Blank document, File does exist, Its just blank.
                }
                if ( ! $this->ftp->fget($temphandle, $file) ) {
                        fclose($temphandle);
                        unlink($temp);
                        return ''; //Blank document, File does exist, Its just blank.
                }
+
                fseek($temphandle, 0); //Skip back to the start of the file being written to
                $contents = '';
                fseek($temphandle, 0); //Skip back to the start of the file being written to
                $contents = '';
+
                while ( ! feof($temphandle) )
                        $contents .= fread($temphandle, 8192);
                while ( ! feof($temphandle) )
                        $contents .= fread($temphandle, 8192);
+
                fclose($temphandle);
                unlink($temp);
                return $contents;
        }
 
                fclose($temphandle);
                unlink($temp);
                return $contents;
        }
 
-       function get_contents_array($file){
+       function get_contents_array($file) {
                return explode("\n", $this->get_contents($file) );
        }
 
        function put_contents($file, $contents, $type = '' ) {
                return explode("\n", $this->get_contents($file) );
        }
 
        function put_contents($file, $contents, $type = '' ) {
-               if( empty($type) ){
-                       $extension = substr(strrchr($file, '.'), 1);
-                       $type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
-               }
+               if( empty($type) )
+                       $type = $this->is_binary($contents) ? FTP_BINARY : FTP_ASCII;
+
                $this->ftp->SetType($type);
 
                $temp = wp_tempnam( $file );
                if ( ! $temphandle = fopen($temp, 'w+') ){
                $this->ftp->SetType($type);
 
                $temp = wp_tempnam( $file );
                if ( ! $temphandle = fopen($temp, 'w+') ){
-                       unlink($temp);          
+                       unlink($temp);
                        return false;
                }
                        return false;
                }
+
                fwrite($temphandle, $contents);
                fseek($temphandle, 0); //Skip back to the start of the file being written to
                fwrite($temphandle, $contents);
                fseek($temphandle, 0); //Skip back to the start of the file being written to
+
                $ret = $this->ftp->fput($file, $temphandle);
                $ret = $this->ftp->fput($file, $temphandle);
+
                fclose($temphandle);
                unlink($temp);
                return $ret;
                fclose($temphandle);
                unlink($temp);
                return $ret;
@@ -146,12 +152,12 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
        function chdir($file) {
                return $this->ftp->chdir($file);
        }
        function chdir($file) {
                return $this->ftp->chdir($file);
        }
-       
+
        function chgrp($file, $group, $recursive = false ) {
                return false;
        }
 
        function chgrp($file, $group, $recursive = false ) {
                return false;
        }
 
-       function chmod($file, $mode = false, $recursive = false ){
+       function chmod($file, $mode = false, $recursive = false ) {
                if( ! $mode )
                        $mode = $this->permission;
                if( ! $mode )
                if( ! $mode )
                        $mode = $this->permission;
                if( ! $mode )
@@ -251,7 +257,7 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                return $this->ftp->filesize($file);
        }
 
                return $this->ftp->filesize($file);
        }
 
-       function touch($file, $time = 0, $atime = 0 ){
+       function touch($file, $time = 0, $atime = 0 ) {
                return false;
        }
 
                return false;
        }
 
@@ -311,8 +317,9 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
                return $ret;
        }
 
                return $ret;
        }
 
-       function __destruct(){
+       function __destruct() {
                $this->ftp->quit();
        }
 }
                $this->ftp->quit();
        }
 }
+
 ?>
 ?>
diff --git a/wp-admin/includes/class-wp-filesystem-ssh2.php b/wp-admin/includes/class-wp-filesystem-ssh2.php
new file mode 100644 (file)
index 0000000..6da852d
--- /dev/null
@@ -0,0 +1,507 @@
+<?php
+/**
+ * WordPress SSH2 Filesystem.
+ *
+ * @package WordPress
+ * @subpackage Filesystem
+ */
+
+/**
+ * WordPress Filesystem Class for implementing SSH2.
+ *
+ * To use this class you must follow these steps for PHP 5.2.6+
+ *
+ * @contrib http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/ - Installation Notes
+ *
+ * Complie libssh2 (Note: Only 0.14 is officaly working with PHP 5.2.6+ right now.)
+ *
+ * cd /usr/src
+ * wget http://surfnet.dl.sourceforge.net/sourceforge/libssh2/libssh2-0.14.tar.gz
+ * tar -zxvf libssh2-0.14.tar.gz
+ * cd libssh2-0.14/
+ * ./configure
+ * make all install
+ *
+ * Note: No not leave the directory yet!
+ *
+ * Enter: pecl install -f ssh2
+ *
+ * Copy the ssh.so file it creates to your PHP Module Directory.
+ * Open up your PHP.INI file and look for where extensions are placed.
+ * Add in your PHP.ini file: extension=ssh2.so
+ *
+ * Restart Apache!
+ * Check phpinfo() streams to confirm that: ssh2.shell, ssh2.exec, ssh2.tunnel, ssh2.scp, ssh2.sftp  exist.
+ *
+ *
+ * @since 2.7
+ * @package WordPress
+ * @subpackage Filesystem
+ * @uses WP_Filesystem_Base Extends class
+ */
+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 $keys = false;
+       /*
+        * This is the timeout value for ssh results to comeback.
+        * Slower servers might need this incressed, but this number otherwise should not change.
+        *
+        * @parm $timeout int
+        *
+        */
+       var $timeout = 15;
+       var $errors = array();
+       var $options = array();
+
+       var $permission = 0644;
+
+       function WP_Filesystem_SSH2($opt='') {
+               $this->method = 'ssh2';
+               $this->errors = new WP_Error();
+
+               //Check if possible to use ssh2 functions.
+               if ( ! extension_loaded('ssh2') ) {
+                       $this->errors->add('no_ssh2_ext', __('The ssh2 PHP extension is not available'));
+                       return false;
+               }
+
+               // Set defaults:
+               if ( empty($opt['port']) )
+                       $this->options['port'] = 22;
+               else
+                       $this->options['port'] = $opt['port'];
+
+               if ( empty($opt['hostname']) )
+                       $this->errors->add('empty_hostname', __('SSH2 hostname is required'));
+               else
+                       $this->options['hostname'] = $opt['hostname'];
+
+               if ( isset($opt['base']) && ! empty($opt['base']) )
+                       $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']) ) ) {
+                       $this->options['public_key'] = $opt['public_key'];
+                       $this->options['private_key'] = $opt['private_key'];
+
+                       $this->options['hostkey'] = array("hostkey" => "ssh-rsa");
+
+                       $this->keys = true;
+               }
+
+
+               if ( empty ($opt['password']) ) {
+                       if ( !$this->keys )     //       password can be blank if we are using keys
+                               $this->errors->add('empty_password', __('SSH2 password is required'));
+               } else {
+                       $this->options['password'] = $opt['password'];
+               }
+
+       }
+
+       function connect() {
+               $this->debug("connect();");
+
+               if ( ! $this->keys ) {
+                       $this->link = @ssh2_connect($this->options['hostname'], $this->options['port']);
+               } else {
+                       $this->link = @ssh2_connect($this->options['hostname'], $this->options['port'], $this->options['hostkey']);
+               }
+
+               if ( ! $this->link ) {
+                       $this->errors->add('connect', sprintf(__('Failed to connect to SSH2 Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
+                       return false;
+               }
+
+               if ( !$this->keys ) {
+                       if ( ! @ssh2_auth_password($this->link, $this->options['username'], $this->options['password']) ) {
+                               $this->errors->add('auth', sprintf(__('Username/Password incorrect for %s'), $this->options['username']));
+                               return false;
+                       }
+               } else {
+                       if ( ! @ssh2_auth_pubkey_file($this->link, $this->options['username'], $this->options['public_key'], $this->options['private_key'], $this->options['password'] ) ) {
+                               $this->errors->add('auth', sprintf(__('Public and Private keys incorrent for %s'), $this->options['username']));
+                               return false;
+                       }
+               }
+
+               $this->sftp_link = ssh2_sftp($this->link);
+
+               return true;
+       }
+
+       function run_command($link, $command, $returnbool = false) {
+               $this->debug("run_command();");
+               if(!($stream = @ssh2_exec( $link, $command . "; echo \"__COMMAND_FINISHED__\";"))) {
+                       $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 {
+                               return $data;
+                       }
+               }
+               return false;
+       }
+
+       function debug($text)
+       {
+               if ($this->debugtest)
+               {
+                       echo "<br/>" . $text . "<br/>";
+               }
+       }
+
+       function setDefaultPermissions($perm) {
+               $this->debug("setDefaultPermissions();");
+               if ( $perm )
+                       $this->permission = $perm;
+       }
+
+       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;
+       }
+
+       function get_contents_array($file) {
+               $this->debug("get_contents_array();");
+               return explode("\n", $this->get_contents($file));
+       }
+
+       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;
+       }
+
+       function cwd() {
+               $this->debug("cwd();");
+               $cwd = $this->run_command($this->link, 'pwd');
+               if( $cwd )
+                       $cwd = trailingslashit($cwd);
+               return $cwd;
+       }
+
+       function chdir($dir) {
+               $this->debug("chdir();");
+               return $this->run_command($this->link, 'cd ' . $dir, true);
+       }
+
+       function chgrp($file, $group, $recursive = false ) {
+               $this->debug("chgrp();");
+               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);
+       }
+
+       function chmod($file, $mode = false, $recursive = false) {
+               $this->debug("chmod();");
+               if( ! $mode )
+                       $mode = $this->permission;
+               if( ! $mode )
+                       return false;
+               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);
+       }
+
+       function chown($file, $owner, $recursive = false ) {
+               $this->debug("chown();");
+               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);
+       }
+
+       function owner($file) {
+               $this->debug("owner();");
+               $dir = $this->dirlist($file);
+               return $dir[$file]['owner'];
+       }
+
+       function getchmod($file) {
+               $this->debug("getchmod();");
+               $dir = $this->dirlist($file);
+               return $dir[$file]['permsn'];
+       }
+
+       function group($file) {
+               $this->debug("group();");
+               $dir = $this->dirlist($file);
+               return $dir[$file]['group'];
+       }
+
+       function copy($source, $destination, $overwrite = false ) {
+               $this->debug("copy();");
+               if( ! $overwrite && $this->exists($destination) )
+                       return false;
+               $content = $this->get_contents($source);
+               if( false === $content)
+                       return false;
+               return $this->put_contents($destination, $content);
+       }
+
+       function move($source, $destination, $overwrite = false) {
+               $this->debug("move();");
+               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 )
+                        return ssh2_sftp_rmdir($this->sftp_link, $file);
+               $filelist = $this->dirlist($file);
+               if ( is_array($filelist) ) {
+                       foreach ( $filelist as $filename => $fileinfo) {
+                               $this->delete($file . '/' . $filename, $recursive);
+                       }
+               }
+               return ssh2_sftp_rmdir($this->sftp_link, $file);
+       }
+
+       function exists($file) {
+               $this->debug("exists();");
+               return $this->run_command($this->link, sprintf('ls -lad %s', $file), true);
+       }
+
+       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.
+       }
+
+       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'];
+       }
+
+       function is_readable($file) {
+               //Not implmented.
+       }
+
+       function is_writable($file) {
+               //Not implmented.
+       }
+
+       function atime($file) {
+               //Not implmented.
+       }
+
+       function mtime($file) {
+               //Not implmented.
+       }
+
+       function size($file) {
+               //Not implmented.
+       }
+
+       function touch($file, $time = 0, $atime = 0) {
+               //Not implmented.
+       }
+
+       function mkdir($path, $chmod = null, $chown = false, $chgrp = false) {
+               $this->debug("mkdir();");
+               $path = untrailingslashit($path);
+               if( ! ssh2_sftp_mkdir($this->sftp_link, $path, $chmod, true) )
+                       return false;
+               if( $chown )
+                       $this->chown($path, $chown);
+               if( $chgrp )
+                       $this->chgrp($path, $chgrp);
+               return true;
+       }
+
+       function rmdir($path, $recursive = false) {
+               $this->debug("rmdir();");
+               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) ) {
+                       $limitFile = basename($path);
+                       $path = trailingslashit(dirname($path));
+               } else {
+                       $limitFile = false;
+               }
+
+               $list = $this->run_command($this->link, sprintf('ls -la %s', $path));
+
+               if ( $list === false )
+                       return false;
+
+               $list = explode("\n", $list);
+
+               $dirlist = array();
+               foreach ( (array)$list as $k => $v ) {
+                       $entry = $this->parselisting($v);
+                       if ( empty($entry) )
+                               continue;
+
+                       if ( '.' == $entry['name'] || '..' == $entry['name'] )
+                               continue;
+
+                       $dirlist[ $entry['name'] ] = $entry;
+               }
+
+               if ( ! $dirlist )
+                       return false;
+
+               if ( empty($dirlist) )
+                       return array();
+
+               $ret = array();
+               foreach ( $dirlist as $struc ) {
+
+                       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);
+                               }
+                       }
+                       //File
+                       $ret[$struc['name']] = $struc;
+               }
+               return $ret;
+       }
+       function __destruct() {
+               $this->debug("__destruct();");
+               if ( $this->link )
+                       unset($this->link);
+               if ( $this->sftp_link )
+                       unset($this->sftp_link);
+       }
+}
+
+?>
index 8a47fe6d2f4356133ce616e79b847b002aebe9e4..0fd1533d2ba3e2669797050b9174bebd056a07e2 100644 (file)
@@ -1,5 +1,21 @@
 <?php
 <?php
-
+/**
+ * WordPress Comment Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ * @uses $wpdb
+ *
+ * @param string $comment_author
+ * @param string $comment_date
+ * @return mixed Comment ID on success.
+ */
 function comment_exists($comment_author, $comment_date) {
        global $wpdb;
 
 function comment_exists($comment_author, $comment_date) {
        global $wpdb;
 
@@ -7,6 +23,11 @@ function comment_exists($comment_author, $comment_date) {
                        WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
 }
 
                        WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function edit_comment() {
 
        $comment_post_ID = (int) $_POST['comment_post_ID'];
 function edit_comment() {
 
        $comment_post_ID = (int) $_POST['comment_post_ID'];
@@ -28,7 +49,6 @@ function edit_comment() {
                }
        }
 
                }
        }
 
-
        if (!empty ( $_POST['edit_date'] ) ) {
                $aa = $_POST['aa'];
                $mm = $_POST['mm'];
        if (!empty ( $_POST['edit_date'] ) ) {
                $aa = $_POST['aa'];
                $mm = $_POST['mm'];
@@ -46,6 +66,14 @@ function edit_comment() {
        wp_update_comment( $_POST);
 }
 
        wp_update_comment( $_POST);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @return unknown
+ */
 function get_comment_to_edit( $id ) {
        if ( !$comment = get_comment($id) )
                return false;
 function get_comment_to_edit( $id ) {
        if ( !$comment = get_comment($id) )
                return false;
@@ -64,6 +92,15 @@ function get_comment_to_edit( $id ) {
        return $comment;
 }
 
        return $comment;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ * @uses $wpdb
+ *
+ * @param int $post_id Post ID
+ * @return unknown
+ */
 function get_pending_comments_num( $post_id ) {
        global $wpdb;
 
 function get_pending_comments_num( $post_id ) {
        global $wpdb;
 
@@ -90,8 +127,15 @@ function get_pending_comments_num( $post_id ) {
        return $pending_keyed;
 }
 
        return $pending_keyed;
 }
 
-// Add avatars to relevant places in admin, or try to
-
+/**
+ * Add avatars to relevant places in admin, or try to.
+ *
+ * @since unknown
+ * @uses $comment
+ *
+ * @param string $name User name.
+ * @return string Avatar with Admin name.
+ */
 function floated_admin_avatar( $name ) {
        global $comment;
 
 function floated_admin_avatar( $name ) {
        global $comment;
 
@@ -107,6 +151,11 @@ function floated_admin_avatar( $name ) {
        return "$avatar $name";
 }
 
        return "$avatar $name";
 }
 
+function enqueue_comment_hotkeys_js() {
+       if ( 'true' == get_user_option( 'comment_shortcuts' ) )
+               wp_enqueue_script( 'jquery-table-hotkeys' );
+}
+
 if ( is_admin() && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
        if ( get_option('show_avatars') )
                add_filter( 'comment_author', 'floated_admin_avatar' );
 if ( is_admin() && ('edit-comments.php' == $pagenow || 'edit.php' == $pagenow) ) {
        if ( get_option('show_avatars') )
                add_filter( 'comment_author', 'floated_admin_avatar' );
index 27839fcfd3b1564976a27e8872dcf12a85f178ab..b08615f93d3768ea9c4fdb1b8225b37c28e4519a 100644 (file)
@@ -1,39 +1,35 @@
 <?php
 <?php
-
-// Registers dashboard widgets, handles POST data, sets up filters
+/**
+ * WordPress Dashboard Widget Administration Panel API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Registers dashboard widgets.
+ *
+ * handles POST data, sets up filters.
+ *
+ * @since unknown
+ */
 function wp_dashboard_setup() {
 function wp_dashboard_setup() {
-       global $wpdb, $wp_dashboard_sidebars;
+       global $wp_registered_widgets, $wp_registered_widget_controls, $wp_dashboard_control_callbacks;
+       $wp_dashboard_control_callbacks = array();
+
        $update = false;
        $widget_options = get_option( 'dashboard_widget_options' );
        if ( !$widget_options || !is_array($widget_options) )
                $widget_options = array();
 
        $update = false;
        $widget_options = get_option( 'dashboard_widget_options' );
        if ( !$widget_options || !is_array($widget_options) )
                $widget_options = array();
 
-
-       /* Register WP Dashboard Dynamic Sidebar */
-       register_sidebar( array(
-               'name' => 'WordPress Dashboard',
-               'id' => 'wp_dashboard',
-               'before_widget' => "\t<div class='dashboard-widget-holder %2\$s' id='%1\$s'>\n\n\t\t<div class='dashboard-widget'>\n\n",
-               'after_widget' => "\t\t</div>\n\n\t</div>\n\n",
-               'before_title' => "\t\t\t<h3 class='dashboard-widget-title'>",
-               'after_title' => "</h3>\n\n"
-       ) );
-
-
        /* Register Widgets and Controls */
 
        /* Register Widgets and Controls */
 
+       // Right Now
+       wp_add_dashboard_widget( 'dashboard_right_now', __( 'Right Now' ), 'wp_dashboard_right_now' );
+
        // Recent Comments Widget
        // Recent Comments Widget
-       $mod_comments = wp_count_comments();
-       $mod_comments = $mod_comments->moderated;
-       if ( current_user_can( 'moderate_comments' ) && $mod_comments ) {
-               $notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
-               $notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>";
-       } else {
-               $notice = '';
-       }
-       wp_register_sidebar_widget( 'dashboard_recent_comments', __( 'Recent Comments' ), 'wp_dashboard_recent_comments',
-               array( 'all_link' => 'edit-comments.php', 'notice' => $notice, 'width' => 'half' )
-       );
+       $recent_comments_title = __( 'Recent Comments' );
+       wp_add_dashboard_widget( 'dashboard_recent_comments', $recent_comments_title, 'wp_dashboard_recent_comments' );
 
        // Incoming Links Widget
        if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
 
        // Incoming Links Widget
        if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
@@ -42,25 +38,23 @@ function wp_dashboard_setup() {
                        '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') ) ),
                        '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') ) ),
-                       'items' => 5,
-                       'show_date' => 0
+                       '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
                );
        }
                );
        }
-       wp_register_sidebar_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_empty',
-               array( 'all_link' => $widget_options['dashboard_incoming_links']['link'], 'feed_link' => $widget_options['dashboard_incoming_links']['url'], 'width' => 'half' ),
-               'wp_dashboard_cached_rss_widget', 'wp_dashboard_incoming_links_output'
-       );
-       wp_register_widget_control( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_rss_control', array(),
-               array( 'widget_id' => 'dashboard_incoming_links', 'form_inputs' => array( 'title' => false, 'show_summary' => false, 'show_author' => false ) )
-       );
-
+       wp_add_dashboard_widget( 'dashboard_incoming_links', __( 'Incoming Links' ), 'wp_dashboard_incoming_links', 'wp_dashboard_incoming_links_control' );
 
        // WP Plugins Widget
 
        // WP Plugins Widget
-       wp_register_sidebar_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_empty',
-               array( 'all_link' => 'http://wordpress.org/extend/plugins/', 'feed_link' => 'http://wordpress.org/extend/plugins/rss/topics/', 'width' => 'half' ),
-               'wp_dashboard_cached_rss_widget', 'wp_dashboard_plugins_output',
-               array( 'http://wordpress.org/extend/plugins/rss/browse/popular/', 'http://wordpress.org/extend/plugins/rss/browse/new/', 'http://wordpress.org/extend/plugins/rss/browse/updated/' )
-       );
+       if ( current_user_can( 'activate_plugins' ) )
+               wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' );
+
+       // QuickPress Widget
+       if ( current_user_can('edit_posts') )
+               wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' );
+
+       // Recent Drafts
+       if ( current_user_can('edit_posts') )
+               wp_add_dashboard_widget( 'dashboard_recent_drafts', __('Recent Drafts'), 'wp_dashboard_recent_drafts' );
 
        // Primary feed (Dev Blog) Widget
        if ( !isset( $widget_options['dashboard_primary'] ) ) {
 
        // Primary feed (Dev Blog) Widget
        if ( !isset( $widget_options['dashboard_primary'] ) ) {
@@ -75,14 +69,7 @@ function wp_dashboard_setup() {
                        'show_date' => 1
                );
        }
                        'show_date' => 1
                );
        }
-       wp_register_sidebar_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_empty',
-               array( 'all_link' => $widget_options['dashboard_primary']['link'], 'feed_link' => $widget_options['dashboard_primary']['url'], 'width' => 'half', 'class' => 'widget_rss' ),
-               'wp_dashboard_cached_rss_widget', 'wp_dashboard_rss_output'
-       );
-       wp_register_widget_control( 'dashboard_primary', __( 'Primary Feed' ), 'wp_dashboard_rss_control', array(),
-               array( 'widget_id' => 'dashboard_primary' )
-       );
-
+       wp_add_dashboard_widget( 'dashboard_primary', $widget_options['dashboard_primary']['title'], 'wp_dashboard_primary', 'wp_dashboard_primary_control' );
 
        // Secondary Feed (Planet) Widget
        if ( !isset( $widget_options['dashboard_secondary'] ) ) {
 
        // Secondary Feed (Planet) Widget
        if ( !isset( $widget_options['dashboard_secondary'] ) ) {
@@ -91,60 +78,21 @@ function wp_dashboard_setup() {
                        'link' => apply_filters( 'dashboard_secondary_link',  __( 'http://planet.wordpress.org/' ) ),
                        'url' => apply_filters( 'dashboard_secondary_feed',  __( 'http://planet.wordpress.org/feed/' ) ),
                        'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
                        'link' => apply_filters( 'dashboard_secondary_link',  __( 'http://planet.wordpress.org/' ) ),
                        'url' => apply_filters( 'dashboard_secondary_feed',  __( 'http://planet.wordpress.org/feed/' ) ),
                        'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
-                       'items' => 15
+                       'items' => 5
                );
        }
                );
        }
-       wp_register_sidebar_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_empty',
-               array( 'all_link' => $widget_options['dashboard_secondary']['link'], 'feed_link' => $widget_options['dashboard_secondary']['url'], 'width' => 'full' ),
-               'wp_dashboard_cached_rss_widget', 'wp_dashboard_secondary_output'
-       );
-       wp_register_widget_control( 'dashboard_secondary', __( 'Secondary Feed' ), 'wp_dashboard_rss_control', array(),
-               array( 'widget_id' => 'dashboard_secondary', 'form_inputs' => array( 'show_summary' => false, 'show_author' => false, 'show_date' => false ) )
-       );
-
-
-               /* Dashboard Widget Template
-               wp_register_sidebar_widget( $widget_id (unique slug) , $widget_title, $output_callback,
-                       array(
-                               'all_link'  => full url for "See All" link,
-                               'feed_link' => full url for "RSS" link,
-                               'width'     => 'fourth', 'third', 'half', 'full' (defaults to 'half'),
-                               'height'    => 'single', 'double' (defaults to 'single'),
-                       ),
-                       $wp_dashboard_empty_callback (only needed if using 'wp_dashboard_empty' as your $output_callback),
-                       $arg, $arg, $arg... (further args passed to callbacks)
-               );
-
-               // optional: if you want users to be able to edit the settings of your widget, you need to register a widget_control
-               wp_register_widget_control( $widget_id, $widget_control_title, $control_output_callback,
-                       array(), // leave an empty array here: oddity in widget code
-                       array(
-                               'widget_id' => $widget_id, // Yes - again.  This is required: oddity in widget code
-                               'arg'       => an arg to pass to the $control_output_callback,
-                               'another'   => another arg to pass to the $control_output_callback,
-                               ...
-                       )
-               );
-               */
+       wp_add_dashboard_widget( 'dashboard_secondary', $widget_options['dashboard_secondary']['title'], 'wp_dashboard_secondary', 'wp_dashboard_secondary_control' );
 
        // Hook to register new widgets
        do_action( 'wp_dashboard_setup' );
 
 
        // Hook to register new widgets
        do_action( 'wp_dashboard_setup' );
 
-       // Hard code the sidebar's widgets and order
-       $dashboard_widgets = array();
-       $dashboard_widgets[] = 'dashboard_recent_comments';
-       $dashboard_widgets[] = 'dashboard_incoming_links';
-       $dashboard_widgets[] = 'dashboard_primary';
-       if ( current_user_can( 'activate_plugins' ) )
-               $dashboard_widgets[] = 'dashboard_plugins';
-       $dashboard_widgets[] = 'dashboard_secondary';
-
        // Filter widget order
        // Filter widget order
-       $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', $dashboard_widgets );
-
-       $wp_dashboard_sidebars = array( 'wp_dashboard' => $dashboard_widgets, 'array_version' => 3.5 );
+       $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
 
 
-       add_filter( 'dynamic_sidebar_params', 'wp_dashboard_dynamic_sidebar_params' );
+       foreach ( $dashboard_widgets as $widget_id ) {
+               $name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
+               wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
+       }
 
        if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
                ob_start(); // hack - but the same hack wp-admin/widgets.php uses
 
        if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
                ob_start(); // hack - but the same hack wp-admin/widgets.php uses
@@ -156,162 +104,469 @@ function wp_dashboard_setup() {
 
        if ( $update )
                update_option( 'dashboard_widget_options', $widget_options );
 
        if ( $update )
                update_option( 'dashboard_widget_options', $widget_options );
+
+       do_action('do_meta_boxes', 'dashboard', 'normal', '');
+       do_action('do_meta_boxes', 'dashboard', 'side', '');
 }
 
 }
 
-// Echoes out the dashboard
-function wp_dashboard() {
-       echo "<div id='dashboard-widgets'>\n\n";
+function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
+       global $wp_dashboard_control_callbacks;
+       if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
+               $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>';
+                       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>';
+       }
+       $side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
+       $location = 'normal';
+       if ( in_array($widget_id, $side_widgets) )
+               $location = 'side';
+       add_meta_box( $widget_id, $widget_name , $callback, 'dashboard', $location, 'core' );
+}
 
 
-       // We're already filtering dynamic_sidebar_params obove
-       add_filter( 'option_sidebars_widgets', 'wp_dashboard_sidebars_widgets' ); // here there be hackery
-       dynamic_sidebar( 'wp_dashboard' );
-       remove_filter( 'option_sidebars_widgets', 'wp_dashboard_sidebars_widgets' );
+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 "<br class='clear' />\n</div>\n\n\n";
+       echo '</form>';
 }
 
 }
 
-// Makes sidebar_widgets option reflect the dashboard settings
-function wp_dashboard_sidebars_widgets() { // hackery
-       return $GLOBALS['wp_dashboard_sidebars'];
+/**
+ * Displays the dashboard.
+ *
+ * @since unknown
+ */
+function wp_dashboard() {
+       echo "<div id='dashboard-widgets' class='metabox-holder'>\n\n";
+
+       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 "<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 "<form style='display: none' method='get' action=''>\n<p>\n";
+       wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
+       wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
+       echo "</p>\n</form>\n";
+
+       echo "</div>";
 }
 
 }
 
-// Modifies sidbar params on the fly to set up ids, class names, titles for each widget (called once per widget)
-// Switches widget to edit mode if $_GET['edit']
-function wp_dashboard_dynamic_sidebar_params( $params ) {
-       global $wp_registered_widgets, $wp_registered_widget_controls;
-
-       $sidebar_defaults = array('widget_id' => 0, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '');
-       extract( $sidebar_defaults, EXTR_PREFIX_ALL, 'sidebar' );
-       extract( $params[0], EXTR_PREFIX_ALL, 'sidebar' );
-
-       if ( !isset($wp_registered_widgets[$sidebar_widget_id]) || !is_array($wp_registered_widgets[$sidebar_widget_id]) ) {
-               return $params;
-       }
-       $widget_defaults = array('id' => '', 'width' => '', 'height' => '', 'class' => '', 'feed_link' => '', 'all_link' => '', 'notice' => false, 'error' => false);
-       extract( $widget_defaults, EXTR_PREFIX_ALL, 'widget' );
-       extract( $wp_registered_widgets[$sidebar_widget_id], EXTR_PREFIX_ALL, 'widget' );
-
-       $the_classes = array();
-       if ( in_array($widget_width, array( 'third', 'fourth', 'full' ) ) )
-               $the_classes[] = $widget_width;
-
-       if ( 'double' == $widget_height )
-               $the_classes[] = 'double';
-
-       if ( $widget_class )
-               $the_classes[] = $widget_class;
-
-       // Add classes to the widget holder
-       if ( $the_classes )
-               $sidebar_before_widget = str_replace( "<div class='dashboard-widget-holder ", "<div class='dashboard-widget-holder " . join( ' ', $the_classes ) . ' ', $sidebar_before_widget );
-
-       $links = array();
-       if ( $widget_all_link )
-               $links[] = '<a href="' . clean_url( $widget_all_link ) . '">' . __( 'See&nbsp;All' ) . '</a>';
-
-       $content_class = 'dashboard-widget-content';
-       if ( current_user_can( 'edit_dashboard' ) && isset($wp_registered_widget_controls[$widget_id]) && is_callable($wp_registered_widget_controls[$widget_id]['callback']) ) {
-               // Switch this widget to edit mode
-               if ( isset($_GET['edit']) && $_GET['edit'] == $widget_id ) {
-                       $content_class .= ' dashboard-widget-control';
-                       $wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty';
-                       $sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name'];
-                       $params[1] = 'wp_dashboard_trigger_widget_control';
-                       $sidebar_before_widget .= '<form action="' . clean_url(remove_query_arg( 'edit' ))  . '" method="post">';
-                       $sidebar_after_widget   = "<div class='dashboard-widget-submit'><input type='hidden' name='sidebar' value='wp_dashboard' /><input type='hidden' name='widget_id' value='$widget_id' /><input type='submit' value='" . __( 'Save' ) . "' /></div></form>$sidebar_after_widget";
-                       $links[] = '<a href="' . clean_url(remove_query_arg( 'edit' )) . '">' . __( 'Cancel' ) . '</a>';
-               } else {
-                       $links[] = '<a href="' . clean_url(add_query_arg( 'edit', $widget_id )) . "#$widget_id" . '">' . __( 'Edit' ) . '</a>';
-               }
-       }
+/* Dashboard Widgets */
 
 
-       if ( $widget_feed_link )
-               $links[] = '<img class="rss-icon" src="' . includes_url('images/rss.png') . '" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
+function wp_dashboard_right_now() {
+       $num_posts = wp_count_posts( 'post' );
+       $num_pages = wp_count_posts( 'page' );
 
 
-       $links = apply_filters( "wp_dashboard_widget_links_$widget_id", $links );
+       $num_cats  = wp_count_terms('category');
 
 
-       // Add links to widget's title bar
-       if ( $links ) {
-               $sidebar_before_title .= '<span>';
-               $sidebar_after_title   = '</span><small>' . join( '&nbsp;|&nbsp;', $links ) . "</small><br class='clear' />$sidebar_after_title";
-       }
+       $num_tags = wp_count_terms('post_tag');
 
 
-       // Could have put this in widget-content.  Doesn't really matter
-       if ( $widget_notice )
-               $sidebar_after_title .= "\t\t\t<div class='dashboard-widget-notice'>$widget_notice</div>\n\n";
+       $num_comm = wp_count_comments( );
 
 
-       if ( $widget_error )
-               $sidebar_after_title .= "\t\t\t<div class='dashboard-widget-error'>$widget_error</div>\n\n";
+       echo "\n\t".'<p class="sub">' . __('At a Glance') . '</p>';
+       echo "\n\t".'<div class="table">'."\n\t".'<table>';
+       echo "\n\t".'<tr class="first">';
 
 
-       $sidebar_after_title .= "\t\t\t<div class='$content_class'>\n\n";
+       // Posts
+       $num = number_format_i18n( $num_posts->publish );
+       $text = __ngettext( '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>";
+       }
+       echo '<td class="first b b-posts">' . $num . '</td>';
+       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>';
+       }
+       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>';
+       }
+       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>';
+       }
+       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 ) );
+       } else {
+               $pending_text = '';
+       }
+       */
+
+       // Total Comments
+       $num = number_format_i18n($num_comm->total_comments);
+       $text = __ngettext( '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>";
+       }
+       echo '<td class="b b-comments">' . $num . '</td>';
+       echo '<td class="last t comments">' . $text . '</td>';
 
 
-       $sidebar_after_widget .= "\t\t\t</div>\n\n";
+       echo '</tr><tr>';
 
 
-       foreach( array_keys( $params[0] ) as $key )
-               $$key = ${'sidebar_' . $key};
+       // Pages
+       $num = number_format_i18n( $num_pages->publish );
+       $text = __ngettext( '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>";
+       }
+       echo '<td class="first b b_pages">' . $num . '</td>';
+       echo '<td class="t pages">' . $text . '</td>';
+
+       // Approved Comments
+       $num = number_format_i18n($num_comm->approved);
+       $text = __ngettext( 'Approved', '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>";
+       }
+       echo '<td class="b b_approved">' . $num . '</td>';
+       echo '<td class="last t">' . $text . '</td>';
 
 
-       $params[0] = compact( array_keys( $params[0] ) );
+       echo "</tr>\n\t<tr>";
 
 
-       return $params;
-}
+       // Categories
+       $num = number_format_i18n( $num_cats );
+       $text = __ngettext( 'Category', 'Categories', $num_cats );
+       if ( current_user_can( 'manage_categories' ) ) {
+               $num = "<a href='categories.php'>$num</a>";
+               $text = "<a href='categories.php'>$text</a>";
+       }
+       echo '<td class="first b b-cats">' . $num . '</td>';
+       echo '<td class="t cats">' . $text . '</td>';
+
+       // Pending Comments
+       $num = number_format_i18n($num_comm->moderated);
+       $text = __ngettext( '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>";
+       }
+       echo '<td class="b b-waiting">' . $num . '</td>';
+       echo '<td class="last t">' . $text . '</td>';
 
 
+       echo "</tr>\n\t<tr>";
 
 
-/* Dashboard Widgets */
+       // Tags
+       $num = number_format_i18n( $num_tags );
+       $text = __ngettext( '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>";
+       }
+       echo '<td class="first b b-tags">' . $num . '</td>';
+       echo '<td class="t tags">' . $text . '</td>';
+
+       // Spam Comments
+       $num = number_format_i18n($num_comm->spam);
+       $text = __ngettext( '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>";
+       }
+       echo '<td class="b b-spam">' . $num . '</td>';
+       echo '<td class="last t">' . $text . '</td>';
+
+       echo "</tr>";
+       do_action('right_now_table_end');
+       echo "\n\t</table>\n\t</div>";
+
+       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>";
+       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);
+       } 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);
+       }
+
+       echo '</p>';
 
 
-function wp_dashboard_recent_comments( $sidebar_args ) {
-       global $comment;
-       extract( $sidebar_args, EXTR_SKIP );
+       update_right_now_message();
 
 
-       echo $before_widget;
+       echo "\n\t".'<br class="clear" /></div>';
+       do_action( 'rightnow_end' );
+       do_action( 'activity_box_end' );
+}
 
 
-       echo $before_title;
-       echo $widget_name;
-       echo $after_title;
+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'] );
+               $edit = clean_url( get_edit_post_link( $_POST['post_ID'] ) );
+               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 );
+                       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 );
+               } 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 );
+                       $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,
+                               'orderby' => 'modified',
+                               'order' => 'DESC'
+                       ) );
+
+                       if ( $drafts_query->posts )
+                               $drafts =& $drafts_query->posts;
+               }
+               printf('<p class="textright">' . __('You can also try %s, easy blogging from anywhere on the Web.') . '</p>', '<a href="tools.php">' . __('Press This') . '</a>' );
+               $_REQUEST = array(); // hack for get_default_post_to_edit()
+       }
 
 
-       $lambda = create_function( '', 'return 5;' );
-       add_filter( 'option_posts_per_rss', $lambda ); // hack - comments query doesn't accept per_page parameter
-       $comments_query = new WP_Query(array('feed' => 'rss2', 'withcomments' => 1));
-       remove_filter( 'option_posts_per_rss', $lambda );
+       $post = get_default_post_to_edit();
+?>
 
 
-       $is_first = true;
+       <form name="post" action="<?php echo clean_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">
+                       <input type="text" name="post_title" id="title" tabindex="1" autocomplete="off" value="<?php echo attribute_escape( $post->post_title ); ?>" />
+               </div>
+
+               <?php if ( current_user_can( 'upload_files' ) ) : ?>
+               <div id="media-buttons" class="hide-if-no-js">
+                       <?php do_action( 'media_buttons' ); ?>
+               </div>
+               <?php endif; ?>
+
+               <h4 id="content-label"><label for="content"><?php _e('Content') ?></label></h4>
+               <div class="textarea-wrap">
+                       <textarea name="content" id="content" class="mceEditor" rows="3" cols="15" tabindex="2"><?php echo $post->post_content; ?></textarea>
+               </div>
+
+               <script type="text/javascript">edCanvas = document.getElementById('content');edInsertContent = null;</script>
+
+               <h4><label for="tags-input"><?php _e('Tags') ?></label></h4>
+               <div class="input-text-wrap">
+                       <input type="text" name="tags_input" id="tags-input" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" />
+               </div>
+
+               <p class="submit">
+                       <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" />
+                       <?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'); ?>" />
+                       <?php } else { ?>
+                       <input type="submit" name="publish" id="publish" accesskey="p" tabindex="5" class="button-primary" value="<?php _e('Submit for Review'); ?>" />
+                       <?php } ?>
+                       <br class="clear" />
+               </p>
+
+       </form>
 
 
-       if ( $comments_query->have_comments() ) {
-               while ( $comments_query->have_comments() ) { $comments_query->the_comment();
+<?php
+       if ( $drafts )
+               wp_dashboard_recent_drafts( $drafts );
+}
 
 
-                       $comment_post_url = get_permalink( $comment->comment_post_ID );
-                       $comment_post_title = get_the_title( $comment->comment_post_ID );
-                       $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
-                       $comment_link = '<a class="comment-link" href="' . get_comment_link() . '">#</a>';
-                       $comment_meta = sprintf( __( 'From <strong>%1$s</strong> on %2$s %3$s' ), get_comment_author(), $comment_post_link, $comment_link );
+function wp_dashboard_recent_drafts( $drafts = false ) {
+       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,
+                       'orderby' => 'modified',
+                       'order' => 'DESC'
+               ) );
+               $drafts =& $drafts_query->posts;
+       }
 
 
-                       if ( $is_first ) : $is_first = false;
+       if ( $drafts && is_array( $drafts ) ) {
+               $list = array();
+               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>';
+                       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;
+               }
 ?>
 ?>
-                               <blockquote><p>&#8220;<?php comment_excerpt(); ?>&#8221;</p></blockquote>
-                               <p class='comment-meta'><?php echo $comment_meta; ?></p>
+       <ul>
+               <li><?php echo join( "</li>\n<li>", $list ); ?></li>
+       </ul>
+       <p class="textright"><a href="edit.php?post_status=draft" class="button"><?php _e('View all'); ?></a></p>
 <?php
 <?php
-                               if ( $comments_query->comment_count > 1 ) : ?>
-                               <ul id="dashboard-comments-list">
+       } else {
+               _e('There are no drafts at the moment');
+       }
+}
+
+/**
+ * Display recent comments dashboard widget content.
+ *
+ * @since unknown
+ */
+function wp_dashboard_recent_comments() {
+       global $wpdb;
+
+       if ( current_user_can('edit_posts') )
+               $allowed_states = array('0', '1');
+       else
+               $allowed_states = array('1');
+
+       // Select all comment types and filter out spam later for better query performance.
+       $comments = array();
+       $start = 0;
+
+       while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments ORDER BY comment_date_gmt DESC LIMIT $start, 50" ) ) {
+
+               foreach ( $possible as $comment ) {
+                       if ( count( $comments ) >= 5 )
+                               break;
+                       if ( in_array( $comment->comment_approved, $allowed_states ) )
+                               $comments[] = $comment;
+               }
+
+               $start = $start + 50;
+       }
+
+       if ( $comments ) :
+?>
+
+               <div id="the-comment-list" class="list:comment">
 <?php
 <?php
-                               endif; // comment_count
-                       else : // is_first
+               foreach ( $comments as $comment )
+                       _wp_dashboard_recent_comments_row( $comment );
 ?>
 
 ?>
 
-                                       <li class='comment-meta'><?php echo $comment_meta; ?></li>
+               </div>
+
 <?php
 <?php
-                       endif; // is_first
-               }
+               if ( current_user_can('edit_posts') ) { ?>
+                       <p class="textright"><a href="edit-comments.php" class="button"><?php _e('View all'); ?></a></p>
+<?php  }
+
+               wp_comment_reply( -1, false, 'dashboard', false );
+
+       else :
+?>
+
+       <p><?php _e( 'No comments yet.' ); ?></p>
 
 
-               if ( $comments_query->comment_count > 1 ) : ?>
-                               </ul>
 <?php
 <?php
-               endif; // comment_count;
+       endif; // $comments;
+}
+
+function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
+       $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_link = "<a href='$comment_post_url'>$comment_post_title</a>";
+       $comment_link = '<a class="comment-link" href="' . 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" ) );
+
+       $actions = array();
+
+       $actions_string = '';
+       if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
+               $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['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['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 );
+
+               $i = 0;
+               foreach ( $actions as $action => $link ) {
+                       ++$i;
+                       ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
 
 
+                       // Reply and quickedit need a hide-if-no-js span
+                       if ( 'reply' == $action || 'quickedit' == $action )
+                               $action .= ' hide-if-no-js';
+
+                       $actions_string .= "<span class='$action'>$sep$link</span>";
+               }
        }
 
        }
 
-       echo $after_widget;
+?>
+
+               <div id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status($comment->comment_ID) ) ); ?>>
+                       <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
+
+                       <?php echo get_avatar( $comment, 50 ); ?>
+                       <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
+                       else :
+                               switch ( $comment->comment_type ) :
+                               case 'pingback' :
+                                       $type = __( 'Pingback' );
+                                       break;
+                               case 'trackback' :
+                                       $type = __( 'Trackback' );
+                                       break;
+                               default :
+                                       $type = ucwords( $comment->comment_type );
+                               endswitch;
+                               $type = wp_specialchars( $type );
+                       ?>
+
+                       <h4 class="comment-meta"><?php printf( __( '%1$s on %2$s' ), "<strong>$type</strong>", $comment_post_link ); ?></h4>
+                       <p class="comment-author"><?php comment_author_link(); ?></p>
+
+                       <?php endif; // comment_type ?>
+                       <blockquote><p><?php comment_excerpt(); ?></p></blockquote>
+                       <p class="row-actions"><?php echo $actions_string; ?></p>
+
+                       <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="comment_status"><?php echo $comment->comment_approved; ?></div>
+                       </div>
+
+               </div>
+<?php
+}
+
+function wp_dashboard_incoming_links() {
+       wp_dashboard_cached_rss_widget( 'dashboard_incoming_links', 'wp_dashboard_incoming_links_output' );
 }
 
 }
 
-// $sidebar_args are handled by wp_dashboard_empty()
+/**
+ * Display incoming links dashboard widget content.
+ *
+ * @since unknown
+ */
 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 );
@@ -371,35 +626,83 @@ function wp_dashboard_incoming_links_output() {
        }
 }
 
        }
 }
 
-// $sidebar_args are handled by wp_dashboard_empty()
+function wp_dashboard_incoming_links_control() {
+       wp_dashboard_rss_control( 'dashboard_incoming_links', array( 'title' => false, 'show_summary' => false, 'show_author' => false ) );
+}
+
+function wp_dashboard_primary() {
+       wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_rss_output' );
+}
+
+function wp_dashboard_primary_control() {
+       wp_dashboard_rss_control( 'dashboard_primary' );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param int $widget_id
+ */
 function wp_dashboard_rss_output( $widget_id ) {
        $widgets = get_option( 'dashboard_widget_options' );
 function wp_dashboard_rss_output( $widget_id ) {
        $widgets = get_option( 'dashboard_widget_options' );
+       echo "<div class='rss-widget'>";
        wp_widget_rss_output( $widgets[$widget_id] );
        wp_widget_rss_output( $widgets[$widget_id] );
+       echo "</div>";
+}
+
+function wp_dashboard_secondary() {
+       wp_dashboard_cached_rss_widget( 'dashboard_secondary', 'wp_dashboard_secondary_output' );
+}
+
+function wp_dashboard_secondary_control() {
+       wp_dashboard_rss_control( 'dashboard_secondary' );
 }
 
 }
 
-// $sidebar_args are handled by wp_dashboard_empty()
+/**
+ * Display secondary dashboard RSS widget feed.
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function wp_dashboard_secondary_output() {
        $widgets = get_option( 'dashboard_widget_options' );
        @extract( @$widgets['dashboard_secondary'], EXTR_SKIP );
        $rss = @fetch_rss( $url );
 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;
 
        if ( !isset($rss->items) || 0 == count($rss->items) )
                return false;
 
-       echo "<ul id='planetnews'>\n";
-
        $rss->items = array_slice($rss->items, 0, $items);
        $rss->items = array_slice($rss->items, 0, $items);
-       foreach ($rss->items as $item ) {
-               $title = wp_specialchars($item['title']);
-               list($author,$post) = explode( ':', $title, 2 );
-               $link = clean_url($item['link']);
 
 
-               echo "\t<li><a href='$link'><span class='post'>$post</span><span class='hidden'> - </span><cite>$author</cite></a></li>\n";
+       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);
+               }
        }
 
        }
 
-       echo "</ul>\n<br class='clear' />\n";
+       echo "<div class='rss-widget'>";
+       wp_widget_rss_output( $rss, $widgets['dashboard_secondary'] );
+       echo "</div>";
 }
 
 }
 
-// $sidebar_args are handled by wp_dashboard_empty()
+function wp_dashboard_plugins() {
+       wp_dashboard_cached_rss_widget( 'dashboard_plugins', 'wp_dashboard_plugins_output', array(
+               'http://wordpress.org/extend/plugins/rss/browse/popular/',
+               'http://wordpress.org/extend/plugins/rss/browse/new/',
+               'http://wordpress.org/extend/plugins/rss/browse/updated/'
+       ) );
+}
+
+/**
+ * Display plugins most popular, newest plugins, and recently updated widget text.
+ *
+ * @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/' );
 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/' );
@@ -433,18 +736,35 @@ function wp_dashboard_plugins_output() {
                list($link, $frag) = explode( '#', $item['link'] );
 
                $link = clean_url($link);
                list($link, $frag) = explode( '#', $item['link'] );
 
                $link = clean_url($link);
-               $dlink = rtrim($link, '/') . '/download/';
+               if( preg_match('|/([^/]+?)/?$|', $link, $matches) )
+                       $slug = $matches[1];
+               else
+                       $slug = '';
+
+               $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';
 
                echo "<h4>$label</h4>\n";
 
                echo "<h4>$label</h4>\n";
-               echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$dlink'>" . __( 'Download' ) . "</a>)</span>\n";
+               echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n";
                echo "<p>$description</p>\n";
        }
 }
 
                echo "<p>$description</p>\n";
        }
 }
 
-// Checks to see if all of the feed url in $check_urls are cached.
-// If $check_urls is empty, look for the rss feed url found in the dashboard widget optios of $widget_id.
-// If cached, call $callback, a function that echoes out output for this widget.
-// If not cache, echo a "Loading..." stub which is later replaced by AJAX call (see top of /wp-admin/index.php)
+/**
+ * Checks to see if all of the feed url in $check_urls are cached.
+ *
+ * If $check_urls is empty, look for the rss feed url found in the dashboard
+ * widget optios of $widget_id. If cached, call $callback, a function that
+ * echoes out output for this widget. If not cache, echo a "Loading..." stub
+ * which is later replaced by AJAX call (see top of /wp-admin/index.php)
+ *
+ * @since unknown
+ *
+ * @param int $widget_id
+ * @param callback $callback
+ * @param array $check_urls RSS feeds
+ * @return bool False on failure. True on success.
+ */
 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
        $loading = '<p class="widget-loading">' . __( 'Loading&#8230;' ) . '</p>';
 
 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
        $loading = '<p class="widget-loading">' . __( 'Loading&#8230;' ) . '</p>';
 
@@ -480,42 +800,36 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar
        return true;
 }
 
        return true;
 }
 
-// Empty widget used for JS/AJAX created output.
-// Callback inserts content between before_widget and after_widget.  Used when widget is in edit mode.  Can also be used for custom widgets.
-function wp_dashboard_empty( $sidebar_args, $callback = false ) {
-       extract( $sidebar_args, EXTR_SKIP );
-
-       echo $before_widget;
-
-       echo $before_title;
-       echo $widget_name;
-       echo $after_title;
-
-       // When in edit mode, the callback passed to this function is the widget_control callback
-       if ( $callback && is_callable( $callback ) ) {
-               $args = array_slice( func_get_args(), 2 );
-               array_unshift( $args, $widget_id );
-               call_user_func_array( $callback, $args );
-       }
-
-       echo $after_widget;
-}
-
-/* Dashboard Widgets Controls. Ssee also wp_dashboard_empty() */
+/* Dashboard Widgets Controls */
 
 // Calls widget_control callback
 
 // Calls widget_control callback
+/**
+ * Calls widget control callback.
+ *
+ * @since unknown
+ *
+ * @param int $widget_control_id Registered Widget ID.
+ */
 function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
 function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
-       global $wp_registered_widget_controls;
-       if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_registered_widget_controls[$widget_control_id]) && is_callable($wp_registered_widget_controls[$widget_control_id]['callback']) )
-               call_user_func_array( $wp_registered_widget_controls[$widget_control_id]['callback'], $wp_registered_widget_controls[$widget_control_id]['params'] );
-}
+       global $wp_dashboard_control_callbacks;
 
 
-// Sets up $args to be used as input to wp_widget_rss_form(), handles POST data from RSS-type widgets
-function wp_dashboard_rss_control( $args ) {
-       extract( $args );
-       if ( !$widget_id )
-               return false;
+       if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) {
+               call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) );
+       }
+}
 
 
+/**
+ * The RSS dashboard widget control.
+ *
+ * Sets up $args to be used as input to wp_widget_rss_form(). Handles POST data
+ * from RSS-type widgets.
+ *
+ * @since unknown
+ *
+ * @param string widget_id
+ * @param array form_inputs
+ */
+function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
        if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
                $widget_options = array();
 
        if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
                $widget_options = array();
 
@@ -540,4 +854,9 @@ function wp_dashboard_rss_control( $args ) {
        wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
 }
 
        wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
 }
 
+/**
+ * Empty function usable by plugins to output empty dashboard widget (to be populated later by JS).
+ */
+function wp_dashboard_empty() {}
+
 ?>
 ?>
index 00201fab764d67b50829ade6e542a04598ba9a79..4905b975447f74eb7370a6866922d870ea82fc26 100644 (file)
@@ -1,8 +1,28 @@
 <?php
 <?php
-
-// version number for the export format.  bump this when something changes that might affect compatibility.
+/**
+ * WordPress Export Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Version number for the export format.
+ *
+ * Bump this when something changes that might affect compatibility.
+ *
+ * @since unknown
+ * @var string
+ */
 define('WXR_VERSION', '1.0');
 
 define('WXR_VERSION', '1.0');
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $author
+ */
 function export_wp($author='') {
 global $wpdb, $post_ids, $post;
 
 function export_wp($author='') {
 global $wpdb, $post_ids, $post;
 
@@ -26,6 +46,13 @@ $post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts $where ORDER BY post_dat
 $categories = (array) get_categories('get=all');
 $tags = (array) get_tags('get=all');
 
 $categories = (array) get_categories('get=all');
 $tags = (array) get_tags('get=all');
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $categories
+ */
 function wxr_missing_parents($categories) {
        if ( !is_array($categories) || empty($categories) )
                return array();
 function wxr_missing_parents($categories) {
        if ( !is_array($categories) || empty($categories) )
                return array();
@@ -61,6 +88,13 @@ while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) {
 }
 unset($categories);
 
 }
 unset($categories);
 
+/**
+ * Place string in CDATA tag.
+ *
+ * @since unknown
+ *
+ * @param string $str String to place in XML CDATA tag.
+ */
 function wxr_cdata($str) {
        if ( seems_utf8($str) == false )
                $str = utf8_encode($str);
 function wxr_cdata($str) {
        if ( seems_utf8($str) == false )
                $str = utf8_encode($str);
@@ -72,6 +106,13 @@ function wxr_cdata($str) {
        return $str;
 }
 
        return $str;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return string Site URL.
+ */
 function wxr_site_url() {
        global $current_site;
 
 function wxr_site_url() {
        global $current_site;
 
@@ -85,6 +126,13 @@ function wxr_site_url() {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param object $c Category Object
+ */
 function wxr_cat_name($c) {
        if ( empty($c->name) )
                return;
 function wxr_cat_name($c) {
        if ( empty($c->name) )
                return;
@@ -92,6 +140,13 @@ function wxr_cat_name($c) {
        echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
 }
 
        echo '<wp:cat_name>' . wxr_cdata($c->name) . '</wp:cat_name>';
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param object $c Category Object
+ */
 function wxr_category_description($c) {
        if ( empty($c->description) )
                return;
 function wxr_category_description($c) {
        if ( empty($c->description) )
                return;
@@ -99,6 +154,13 @@ function wxr_category_description($c) {
        echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
 }
 
        echo '<wp:category_description>' . wxr_cdata($c->description) . '</wp:category_description>';
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param object $t Tag Object
+ */
 function wxr_tag_name($t) {
        if ( empty($t->name) )
                return;
 function wxr_tag_name($t) {
        if ( empty($t->name) )
                return;
@@ -106,6 +168,13 @@ function wxr_tag_name($t) {
        echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
 }
 
        echo '<wp:tag_name>' . wxr_cdata($t->name) . '</wp:tag_name>';
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param object $t Tag Object
+ */
 function wxr_tag_description($t) {
        if ( empty($t->description) )
                return;
 function wxr_tag_description($t) {
        if ( empty($t->description) )
                return;
@@ -113,6 +182,11 @@ function wxr_tag_description($t) {
        echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
 }
 
        echo '<wp:tag_description>' . wxr_cdata($t->description) . '</wp:tag_description>';
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function wxr_post_taxonomy() {
        $categories = get_the_category();
        $tags = get_the_tags();
 function wxr_post_taxonomy() {
        $categories = get_the_category();
        $tags = get_the_tags();
@@ -148,7 +222,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
 
 <!-- To import this information into a WordPress blog follow these steps. -->
 <!-- 1. Log into that blog as an administrator. -->
 
 <!-- To import this information into a WordPress blog follow these steps. -->
 <!-- 1. Log into that blog as an administrator. -->
-<!-- 2. Go to Manage: Import in the blog's admin panels. -->
+<!-- 2. Go to Tools: Import in the blog's admin panels (or Manage: Import in older versions of WordPress). -->
 <!-- 3. Choose "WordPress" from the list. -->
 <!-- 4. Upload this file using the form provided on that page. -->
 <!-- 5. You will first be asked to map the authors in this export file to users -->
 <!-- 3. Choose "WordPress" from the list. -->
 <!-- 4. Upload this file using the form provided on that page. -->
 <!-- 5. You will first be asked to map the authors in this export file to users -->
@@ -159,6 +233,7 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
 
 <?php the_generator('export');?>
 <rss version="2.0"
 
 <?php the_generator('export');?>
 <rss version="2.0"
+       xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
@@ -190,6 +265,9 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
                        $where = "WHERE ID IN (".join(',', $next_posts).")";
                        $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
                                foreach ($posts as $post) {
                        $where = "WHERE ID IN (".join(',', $next_posts).")";
                        $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC");
                                foreach ($posts as $post) {
+                       // Don't export revisions.  They bloat the export.
+                       if ( 'revision' == $post->post_type )
+                               continue;
                        setup_postdata($post); ?>
 <item>
 <title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
                        setup_postdata($post); ?>
 <item>
 <title><?php echo apply_filters('the_title_rss', $post->post_title); ?></title>
index 349feb2e6af27402df71d6c41a3bb710a300dc72..cddfaa92f75759572f618933ee28eee07a90f569 100644 (file)
@@ -1,23 +1,70 @@
 <?php
 <?php
-
-$wp_file_descriptions = array ('index.php' => __( 'Main Index Template' ), 'style.css' => __( 'Stylesheet' ), 'rtl.css' => __( 'RTL Stylesheet' ), 'comments.php' => __( 'Comments' ), 'comments-popup.php' => __( 'Popup Comments' ), 'footer.php' => __( 'Footer' ), 'header.php' => __( 'Header' ), 'sidebar.php' => __( 'Sidebar' ), 'archive.php' => __( 'Archives' ), 'category.php' => __( 'Category Template' ), 'page.php' => __( 'Page Template' ), 'search.php' => __( 'Search Results' ), 'searchform.php' => __( 'Search Form' ), 'single.php' => __( 'Single Post' ), '404.php' => __( '404 Template' ), 'link.php' => __( 'Links Template' ), 'functions.php' => __( 'Theme Functions' ), 'attachment.php' => __( 'Attachment Template' ), 'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ), '.htaccess' => __( '.htaccess (for rewrite rules )' ),
+/**
+ * File contains all the administration image manipulation functions.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** The descriptions for theme files. */
+$wp_file_descriptions = array (
+       'index.php' => __( 'Main Index Template' ),
+       'style.css' => __( 'Stylesheet' ),
+       'rtl.css' => __( 'RTL Stylesheet' ),
+       'comments.php' => __( 'Comments' ),
+       'comments-popup.php' => __( 'Popup Comments' ),
+       'footer.php' => __( 'Footer' ),
+       'header.php' => __( 'Header' ),
+       'sidebar.php' => __( 'Sidebar' ),
+       'archive.php' => __( 'Archives' ),
+       'category.php' => __( 'Category Template' ),
+       'page.php' => __( 'Page Template' ),
+       'search.php' => __( 'Search Results' ),
+       'searchform.php' => __( 'Search Form' ),
+       'single.php' => __( 'Single Post' ),
+       '404.php' => __( '404 Template' ),
+       'link.php' => __( 'Links Template' ),
+       'functions.php' => __( 'Theme Functions' ),
+       'attachment.php' => __( 'Attachment Template' ),
+       'image.php' => __('Image Attachment Template'),
+       'video.php' => __('Video Attachment Template'),
+       'audio.php' => __('Audio Attachment Template'),
+       'application.php' => __('Application Attachment Template'),
+       'my-hacks.php' => __( 'my-hacks.php (legacy hacks support)' ),
+       '.htaccess' => __( '.htaccess (for rewrite rules )' ),
        // Deprecated files
        'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
        // Deprecated files
        'wp-layout.css' => __( 'Stylesheet' ), 'wp-comments.php' => __( 'Comments Template' ), 'wp-comments-popup.php' => __( 'Popup Comments Template' ));
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file
+ * @return unknown
+ */
 function get_file_description( $file ) {
        global $wp_file_descriptions;
 
        if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
                return $wp_file_descriptions[basename( $file )];
        }
 function get_file_description( $file ) {
        global $wp_file_descriptions;
 
        if ( isset( $wp_file_descriptions[basename( $file )] ) ) {
                return $wp_file_descriptions[basename( $file )];
        }
-       elseif ( file_exists( ABSPATH . $file ) && is_file( ABSPATH . $file ) ) {
-               $template_data = implode( '', file( ABSPATH . $file ) );
-               if ( preg_match( "|Template Name:(.*)|i", $template_data, $name ))
-                       return $name[1];
+       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 basename( $file );
 }
 
        }
 
        return basename( $file );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_home_path() {
        $home = get_option( 'home' );
        if ( $home != '' && $home != get_option( 'siteurl' ) ) {
 function get_home_path() {
        $home = get_option( 'home' );
        if ( $home != '' && $home != get_option( 'siteurl' ) ) {
@@ -32,6 +79,14 @@ function get_home_path() {
        return $home_path;
 }
 
        return $home_path;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file
+ * @return unknown
+ */
 function get_real_file_to_edit( $file ) {
        if ('index.php' == $file || '.htaccess' == $file ) {
                $real_file = get_home_path() . $file;
 function get_real_file_to_edit( $file ) {
        if ('index.php' == $file || '.htaccess' == $file ) {
                $real_file = get_home_path() . $file;
@@ -41,8 +96,16 @@ function get_real_file_to_edit( $file ) {
 
        return $real_file;
 }
 
        return $real_file;
 }
-//$folder = Full path to folder
-//$levels = Levels of folders to follow, Default: 100 (PHP Loop limit)
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param string $folder Optional. Full path to folder
+ * @param int $levels Optional. Levels of folders to follow, Default: 100 (PHP Loop limit).
+ * @return bool|array
+ */
 function list_files( $folder = '', $levels = 100 ) {
        if( empty($folder) )
                return false;
 function list_files( $folder = '', $levels = 100 ) {
        if( empty($folder) )
                return false;
@@ -70,6 +133,13 @@ function list_files( $folder = '', $levels = 100 ) {
        return $files;
 }
 
        return $files;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_temp_dir() {
        if ( defined('WP_TEMP_DIR') )
                return trailingslashit(WP_TEMP_DIR);
 function get_temp_dir() {
        if ( defined('WP_TEMP_DIR') )
                return trailingslashit(WP_TEMP_DIR);
@@ -84,6 +154,15 @@ function get_temp_dir() {
        return '/tmp/';
 }
 
        return '/tmp/';
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $filename
+ * @param unknown_type $dir
+ * @return unknown
+ */
 function wp_tempnam($filename = '', $dir = ''){
        if ( empty($dir) )
                $dir = get_temp_dir();
 function wp_tempnam($filename = '', $dir = ''){
        if ( empty($dir) )
                $dir = get_temp_dir();
@@ -96,6 +175,15 @@ function wp_tempnam($filename = '', $dir = ''){
        return $filename;
 }
 
        return $filename;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file
+ * @param unknown_type $allowed_files
+ * @return unknown
+ */
 function validate_file_to_edit( $file, $allowed_files = '' ) {
        $file = stripslashes( $file );
 
 function validate_file_to_edit( $file, $allowed_files = '' ) {
        $file = stripslashes( $file );
 
@@ -116,12 +204,16 @@ function validate_file_to_edit( $file, $allowed_files = '' ) {
        }
 }
 
        }
 }
 
-// array wp_handle_upload ( array &file [, array overrides] )
-// file: reference to a single element of $_FILES. Call the function once for each uploaded file.
-// overrides: an associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
-// On success, returns an associative array of file attributes.
-// On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
-function wp_handle_upload( &$file, $overrides = false ) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param array $file Reference to a single element of $_FILES. Call the function once for each uploaded file.
+ * @param array $overrides Optional. An associative array of names=>values to override default variables with extract( $overrides, EXTR_OVERWRITE ).
+ * @return array On success, returns an associative array of file attributes. On failure, returns $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
+ */
+function wp_handle_upload( &$file, $overrides = false, $time = null ) {
        // The default error handler.
        if (! function_exists( 'wp_handle_upload_error' ) ) {
                function wp_handle_upload_error( &$file, $message ) {
        // The default error handler.
        if (! function_exists( 'wp_handle_upload_error' ) ) {
                function wp_handle_upload_error( &$file, $message ) {
@@ -132,6 +224,9 @@ function wp_handle_upload( &$file, $overrides = false ) {
        // You may define your own function and pass the name in $overrides['upload_error_handler']
        $upload_error_handler = 'wp_handle_upload_error';
 
        // You may define your own function and pass the name in $overrides['upload_error_handler']
        $upload_error_handler = 'wp_handle_upload_error';
 
+       // You may define your own function and pass the name in $overrides['unique_filename_callback']
+       $unique_filename_callback = null;
+
        // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
        $action = 'wp_handle_upload';
 
        // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
        $action = 'wp_handle_upload';
 
@@ -141,6 +236,7 @@ function wp_handle_upload( &$file, $overrides = false ) {
                __( "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." ),
                __( "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." ),
                __( "Failed to write file to disk." ));
 
                __( "Missing a temporary folder." ),
                __( "Failed to write file to disk." ));
 
@@ -189,7 +285,7 @@ function wp_handle_upload( &$file, $overrides = false ) {
        }
 
        // 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.
-       if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
+       if ( ! ( ( $uploads = wp_upload_dir($time) ) && false === $uploads['error'] ) )
                return $upload_error_handler( $file, $uploads['error'] );
 
        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
                return $upload_error_handler( $file, $uploads['error'] );
 
        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
@@ -212,7 +308,18 @@ function wp_handle_upload( &$file, $overrides = false ) {
 
        return $return;
 }
 
        return $return;
 }
-// Pass this function an array similar to that of a $_FILES POST array.
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Pass this function an array similar to that of a $_FILES POST array.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file
+ * @param unknown_type $overrides
+ * @return unknown
+ */
 function wp_handle_sideload( &$file, $overrides = false ) {
        // The default error handler.
        if (! function_exists( 'wp_handle_upload_error' ) ) {
 function wp_handle_sideload( &$file, $overrides = false ) {
        // The default error handler.
        if (! function_exists( 'wp_handle_upload_error' ) ) {
@@ -224,6 +331,9 @@ function wp_handle_sideload( &$file, $overrides = false ) {
        // You may define your own function and pass the name in $overrides['upload_error_handler']
        $upload_error_handler = 'wp_handle_upload_error';
 
        // You may define your own function and pass the name in $overrides['upload_error_handler']
        $upload_error_handler = 'wp_handle_upload_error';
 
+       // You may define your own function and pass the name in $overrides['unique_filename_callback']
+       $unique_filename_callback = null;
+
        // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
        $action = 'wp_handle_sideload';
 
        // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
        $action = 'wp_handle_sideload';
 
@@ -285,11 +395,11 @@ function wp_handle_sideload( &$file, $overrides = false ) {
                return $upload_error_handler( $file, $uploads['error'] );
 
        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
                return $upload_error_handler( $file, $uploads['error'] );
 
        $filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
-       
+
        // Strip the query strings.
        $filename = str_replace('?','-', $filename);
        $filename = str_replace('&','-', $filename);
        // Strip the query strings.
        $filename = str_replace('?','-', $filename);
        $filename = str_replace('&','-', $filename);
-       
+
        // Move the file to the uploads dir
        $new_file = $uploads['path'] . "/$filename";
        if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
        // Move the file to the uploads dir
        $new_file = $uploads['path'] . "/$filename";
        if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
@@ -310,45 +420,65 @@ function wp_handle_sideload( &$file, $overrides = false ) {
 }
 
 /**
 }
 
 /**
-* Downloads a url to a local file using the Snoopy HTTP Class
-*
-* @param string $url the URL of the file to download
-* @return mixed WP_Error on failure, string Filename on success.
-*/
+ * Downloads a url to a local file using the Snoopy HTTP Class.
+ *
+ * @since unknown
+ * @todo Transition over to using the new HTTP Request API (jacob).
+ *
+ * @param string $url the URL of the file to download
+ * @return mixed WP_Error on failure, string Filename on success.
+ */
 function download_url( $url ) {
        //WARNING: The file is not automatically deleted, The script must unlink() the file.
 function download_url( $url ) {
        //WARNING: The file is not automatically deleted, The script must unlink() the file.
-       if( ! $url )
+       if ( ! $url )
                return new WP_Error('http_no_url', __('Invalid URL Provided'));
 
        $tmpfname = wp_tempnam($url);
                return new WP_Error('http_no_url', __('Invalid URL Provided'));
 
        $tmpfname = wp_tempnam($url);
-       if( ! $tmpfname )
+       if ( ! $tmpfname )
                return new WP_Error('http_no_file', __('Could not create Temporary file'));
 
                return new WP_Error('http_no_file', __('Could not create Temporary file'));
 
-       $handle = @fopen($tmpfname, 'w');
-       if( ! $handle )
+       $handle = @fopen($tmpfname, 'wb');
+       if ( ! $handle )
                return new WP_Error('http_no_file', __('Could not create Temporary file'));
 
                return new WP_Error('http_no_file', __('Could not create Temporary file'));
 
-       require_once( ABSPATH . 'wp-includes/class-snoopy.php' );
-       $snoopy = new Snoopy();
-       $snoopy->fetch($url);
+       $response = wp_remote_get($url, array('timeout' => 30));
+
+       if ( is_wp_error($response) ) {
+               fclose($handle);
+               unlink($tmpfname);
+               return $response;
+       }
 
 
-       if( $snoopy->status != '200' ){
+       if ( $response['response']['code'] != '200' ){
                fclose($handle);
                unlink($tmpfname);
                fclose($handle);
                unlink($tmpfname);
-               return new WP_Error('http_404', trim($snoopy->response_code));
+               return new WP_Error('http_404', trim($response['response']['message']));
        }
        }
-       fwrite($handle, $snoopy->results);
+
+       fwrite($handle, $response['body']);
        fclose($handle);
 
        return $tmpfname;
 }
 
        fclose($handle);
 
        return $tmpfname;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file
+ * @param unknown_type $to
+ * @return unknown
+ */
 function unzip_file($file, $to) {
        global $wp_filesystem;
 
        if ( ! $wp_filesystem || !is_object($wp_filesystem) )
                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
 function unzip_file($file, $to) {
        global $wp_filesystem;
 
        if ( ! $wp_filesystem || !is_object($wp_filesystem) )
                return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
 
+       // Unzip uses a lot of memory
+       @ini_set('memory_limit', '256M');
+
        $fs =& $wp_filesystem;
 
        require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
        $fs =& $wp_filesystem;
 
        require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
@@ -362,37 +492,56 @@ function unzip_file($file, $to) {
        if ( 0 == count($archive_files) )
                return new WP_Error('empty_archive', __('Empty archive'));
 
        if ( 0 == count($archive_files) )
                return new WP_Error('empty_archive', __('Empty archive'));
 
-       $to = trailingslashit($to);
-       $path = explode('/', $to);
-       $tmppath = '';
-       for ( $j = 0; $j < count($path) - 1; $j++ ) {
-               $tmppath .= $path[$j] . '/';
-               if ( ! $fs->is_dir($tmppath) )
-                       $fs->mkdir($tmppath, 0755);
+       $path = explode('/', untrailingslashit($to));
+       for ( $i = count($path); $i > 0; $i-- ) { //>0 = first element is empty allways for paths starting with '/'
+               $tmppath = implode('/', array_slice($path, 0, $i) );
+               if ( $fs->is_dir($tmppath) ) { //Found the highest folder that exists, Create from here(ie +1)
+                       for ( $i = $i + 1; $i <= count($path); $i++ ) {
+                               $tmppath = implode('/', array_slice($path, 0, $i) );
+                               if ( ! $fs->mkdir($tmppath, FS_CHMOD_DIR) )
+                                       return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath);
+                       }
+                       break; //Exit main for loop
+               }
        }
 
        }
 
+       $to = trailingslashit($to);
        foreach ($archive_files as $file) {
        foreach ($archive_files as $file) {
-               $path = explode('/', $file['filename']);
-               $tmppath = '';
-
-               // Loop through each of the items and check that the folder exists.
-               for ( $j = 0; $j < count($path) - 1; $j++ ) {
-                       $tmppath .= $path[$j] . '/';
-                       if ( ! $fs->is_dir($to . $tmppath) )
-                               if ( !$fs->mkdir($to . $tmppath, 0755) )
-                                       return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $tmppath);
+               $path = $file['folder'] ? $file['filename'] : dirname($file['filename']);
+               $path = explode('/', $path);
+               for ( $i = count($path); $i >= 0; $i-- ) { //>=0 as the first element contains data
+                       if ( empty($path[$i]) )
+                               continue;
+                       $tmppath = $to . implode('/', array_slice($path, 0, $i) );
+                       if ( $fs->is_dir($tmppath) ) {//Found the highest folder that exists, Create from here
+                               for ( $i = $i + 1; $i <= count($path); $i++ ) { //< count() no file component please.
+                                       $tmppath = $to . implode('/', array_slice($path, 0, $i) );
+                                       if ( ! $fs->is_dir($tmppath) && ! $fs->mkdir($tmppath, FS_CHMOD_DIR) )
+                                               return new WP_Error('mkdir_failed', __('Could not create directory'), $tmppath);
+                               }
+                               break; //Exit main for loop
+                       }
                }
 
                // We've made sure the folders are there, so let's extract the file now:
                }
 
                // We've made sure the folders are there, so let's extract the file now:
-               if ( ! $file['folder'] )
+               if ( ! $file['folder'] ) {
                        if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
                                return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
                        if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
                                return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
-                       $fs->chmod($to . $file['filename'], 0644);
+                       $fs->chmod($to . $file['filename'], FS_CHMOD_FILE);
+               }
        }
        }
-
        return true;
 }
 
        return true;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $from
+ * @param unknown_type $to
+ * @return unknown
+ */
 function copy_dir($from, $to) {
        global $wp_filesystem;
 
 function copy_dir($from, $to) {
        global $wp_filesystem;
 
@@ -403,12 +552,18 @@ function copy_dir($from, $to) {
 
        foreach ( (array) $dirlist as $filename => $fileinfo ) {
                if ( 'f' == $fileinfo['type'] ) {
 
        foreach ( (array) $dirlist as $filename => $fileinfo ) {
                if ( 'f' == $fileinfo['type'] ) {
-                       if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
-                               return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
-                       $wp_filesystem->chmod($to . $filename, 0644);
+                       if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) ) {
+                               // If copy failed, chmod file to 0644 and try again.
+                               $wp_filesystem->chmod($to . $filename, 0644);
+                               if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
+                                       return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
+                       }
+                       $wp_filesystem->chmod($to . $filename, FS_CHMOD_FILE);
                } elseif ( 'd' == $fileinfo['type'] ) {
                } elseif ( 'd' == $fileinfo['type'] ) {
-                       if ( !$wp_filesystem->mkdir($to . $filename, 0755) )
-                               return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
+                       if ( !$wp_filesystem->is_dir($to . $filename) ) {
+                               if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
+                                       return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
+                       }
                        $result = copy_dir($from . $filename, $to . $filename);
                        if ( is_wp_error($result) )
                                return $result;
                        $result = copy_dir($from . $filename, $to . $filename);
                        if ( is_wp_error($result) )
                                return $result;
@@ -416,17 +571,25 @@ function copy_dir($from, $to) {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $args
+ * @return unknown
+ */
 function WP_Filesystem( $args = false ) {
        global $wp_filesystem;
 
        require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
 
 function WP_Filesystem( $args = false ) {
        global $wp_filesystem;
 
        require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
 
-       $method = get_filesystem_method();
+       $method = get_filesystem_method($args);
 
        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);
+       $abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method);
        if( ! file_exists($abstraction_file) )
                return;
 
        if( ! file_exists($abstraction_file) )
                return;
 
@@ -441,10 +604,24 @@ function WP_Filesystem( $args = false ) {
        if ( !$wp_filesystem->connect() )
                return false; //There was an erorr connecting to the server.
 
        if ( !$wp_filesystem->connect() )
                return false; //There was an erorr connecting to the server.
 
+       // Set the permission constants if not already set.
+       if ( ! defined('FS_CHMOD_DIR') )
+               define('FS_CHMOD_DIR', 0755 );
+       if ( ! defined('FS_CHMOD_FILE') )
+               define('FS_CHMOD_FILE', 0644 );
+
        return true;
 }
 
        return true;
 }
 
-function get_filesystem_method() {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $args
+ * @return unknown
+ */
+function get_filesystem_method($args = array()) {
        $method = false;
        if( function_exists('getmyuid') && function_exists('fileowner') ){
                $temp_file = wp_tempnam();
        $method = false;
        if( function_exists('getmyuid') && function_exists('fileowner') ){
                $temp_file = wp_tempnam();
@@ -453,9 +630,148 @@ function get_filesystem_method() {
                unlink($temp_file);
        }
 
                unlink($temp_file);
        }
 
+       if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') ) $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
        return apply_filters('filesystem_method', $method);
 }
 
        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);
 }
 
-?>
\ No newline at end of file
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $form_post
+ * @param unknown_type $type
+ * @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);
+       if ( '' !== $req_cred )
+               return $req_cred;
+
+       if ( empty($type) )
+               $type = get_filesystem_method();
+
+       if ( 'direct' == $type )
+               return true;
+
+       $credentials = get_option('ftp_credentials', array());
+       // 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']);
+
+       // 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']);
+
+       //sanitize the hostname, Some people might pass in odd-data:
+       $credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
+
+       if ( strpos($credentials['hostname'], ':') )
+               list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2);
+       else
+               unset($credentials['port']);
+
+       if ( defined('FTP_SSH') || (isset($_POST['connection_type']) && 'ssh' == $_POST['connection_type']) )
+               $credentials['connection_type'] = 'ssh';
+       else if ( defined('FTP_SSL') || (isset($_POST['connection_type']) && 'ftps' == $_POST['connection_type']) )
+               $credentials['connection_type'] = 'ftps';
+       else if ( !isset($credentials['connection_type']) || (isset($_POST['connection_type']) && 'ftp' == $_POST['connection_type']) )
+               $credentials['connection_type'] = 'ftp';
+
+       if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {
+               $stored_credentials = $credentials;
+               if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code.
+                       $stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
+
+               unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']);
+               update_option('ftp_credentials', $stored_credentials);
+               return $credentials;
+       }
+       $hostname = '';
+       $username = '';
+       $password = '';
+       $connection_type = '';
+       if ( !empty($credentials) )
+               extract($credentials, EXTR_OVERWRITE);
+       if ( $error ) {
+               $error_string = __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.');
+               if ( is_wp_error($error) )
+                       $error_string = $error->get_error_message();
+               echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
+       }
+?>
+<script type="text/javascript">
+<!--
+jQuery(function($){
+       jQuery("#ssh").click(function () {
+               jQuery("#ssh_keys").show();
+       });
+       jQuery("#ftp, #ftps").click(function () {
+               jQuery("#ssh_keys").hide();
+       });
+});
+-->
+</script>
+<form action="<?php echo $form_post ?>" method="post">
+<div class="wrap">
+<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>
+</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>
+</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>
+</tr>
+
+<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" />
+<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>
+
+<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>
+</td>
+</tr>
+</table>
+
+<?php if ( isset( $_POST['version'] ) ) : ?>
+<input type="hidden" name="version" value="<?php echo attribute_escape($_POST['version']) ?>" />
+<?php endif; ?>
+<?php if ( isset( $_POST['locale'] ) ) : ?>
+<input type="hidden" name="locale" value="<?php echo attribute_escape($_POST['locale']) ?>" />
+<?php endif; ?>
+<p class="submit">
+<input id="upgrade" name="upgrade" type="submit" class="button" value="<?php _e('Proceed'); ?>" />
+</p>
+</div>
+</form>
+<?php
+       return false;
+}
+
+?>
index 8de2907994ed1613f36a3068ec96aab306ec439d..8069b97784a578aa0f536f73b4585bb11ac0eb49 100644 (file)
@@ -3,41 +3,42 @@
  * File contains all the administration image manipulation functions.
  *
  * @package WordPress
  * File contains all the administration image manipulation functions.
  *
  * @package WordPress
+ * @subpackage Administration
  */
 
 /**
  */
 
 /**
- * wp_create_thumbnail() - Create a thumbnail from an Image given a maximum side size.
+ * Create a thumbnail from an Image given a maximum side size.
  *
  *
- * @package WordPress
- * @param      mixed   $file   Filename of the original image, Or attachment id
- * @param      int             $max_side       Maximum length of a single side for the thumbnail
- * @return     string                  Thumbnail path on success, Error string on failure
+ * This function can handle most image file formats which PHP supports. If PHP
+ * does not have the functionality to save in a file of the same format, the
+ * thumbnail will be created as a jpeg.
+ *
+ * @since 1.2.0
  *
  *
- * This function can handle most image file formats which PHP supports.
- * If PHP does not have the functionality to save in a file of the same format, the thumbnail will be created as a jpeg.
+ * @param mixed $file Filename of the original image, Or attachment id.
+ * @param int $max_side Maximum length of a single side for the thumbnail.
+ * @return string Thumbnail path on success, Error string on failure.
  */
 function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
  */
 function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
-       
        $thumbpath = image_resize( $file, $max_side, $max_side );
        return apply_filters( 'wp_create_thumbnail', $thumbpath );
 }
 
 /**
        $thumbpath = image_resize( $file, $max_side, $max_side );
        return apply_filters( 'wp_create_thumbnail', $thumbpath );
 }
 
 /**
- * wp_crop_image() - Crop an Image to a given size.
+ * Crop an Image to a given size.
  *
  *
- * @package WordPress
- * @internal Missing Long Description
- * @param      int     $src_file       The source file
- * @param      int     $src_x          The start x position to crop from
- * @param      int     $src_y          The start y position to crop from
- * @param      int     $src_w          The width to crop
- * @param      int     $src_h          The height to crop
- * @param      int     $dst_w          The destination width
- * @param      int     $dst_h          The destination height
- * @param      int     $src_abs        If the source crop points are absolute
- * @param      int     $dst_file       The destination file to write to
- * @return     string                  New filepath on success, String error message on failure
+ * @since 2.1.0
  *
  *
+ * @param string|int $src_file The source file or Attachment ID.
+ * @param int $src_x The start x position to crop from.
+ * @param int $src_y The start y position to crop from.
+ * @param int $src_w The width to crop.
+ * @param int $src_h The height to crop.
+ * @param int $dst_w The destination width.
+ * @param int $dst_h The destination height.
+ * @param int $src_abs Optional. If the source crop points are absolute.
+ * @param string $dst_file Optional. The destination file to write to.
+ * @return string New filepath on success, String error message on failure.
  */
 function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
        if ( is_numeric( $src_file ) ) // Handle int as attachment ID
  */
 function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
        if ( is_numeric( $src_file ) ) // Handle int as attachment ID
@@ -74,54 +75,62 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_
 }
 
 /**
 }
 
 /**
- * wp_generate_attachment_metadata() - Generate post Image attachment Metadata
+ * Generate post image attachment meta data.
  *
  *
- * @package WordPress
- * @internal Missing Long Description
- * @param      int             $attachment_id  Attachment Id to process
- * @param      string  $file   Filepath of the Attached image
- * @return     mixed                   Metadata for attachment
+ * @since 2.1.0
  *
  *
+ * @param int $attachment_id Attachment Id to process.
+ * @param string $file Filepath of the Attached image.
+ * @return mixed Metadata for attachment.
  */
 function wp_generate_attachment_metadata( $attachment_id, $file ) {
        $attachment = get_post( $attachment_id );
 
        $metadata = array();
        if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
  */
 function wp_generate_attachment_metadata( $attachment_id, $file ) {
        $attachment = get_post( $attachment_id );
 
        $metadata = array();
        if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
-               $imagesize = getimagesize( $file );
+               $full_path_file = $file;
+               $imagesize = getimagesize( $full_path_file );
                $metadata['width'] = $imagesize[0];
                $metadata['height'] = $imagesize[1];
                list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']);
                $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
                $metadata['width'] = $imagesize[0];
                $metadata['height'] = $imagesize[1];
                list($uwidth, $uheight) = wp_shrink_dimensions($metadata['width'], $metadata['height']);
                $metadata['hwstring_small'] = "height='$uheight' width='$uwidth'";
+
+               // Make the file path relative to the upload dir
+               if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { // Get upload directory
+                       if ( 0 === strpos($file, $uploads['basedir']) ) {// Check that the upload base exists in the file path
+                               $file = str_replace($uploads['basedir'], '', $file); // Remove upload dir from the file path
+                               $file = ltrim($file, '/');
+                       }
+               }
                $metadata['file'] = $file;
 
                // make thumbnails and other intermediate sizes
                $metadata['file'] = $file;
 
                // make thumbnails and other intermediate sizes
-               $sizes = array('thumbnail', 'medium');
+               $sizes = array('thumbnail', 'medium', 'large');
                $sizes = apply_filters('intermediate_image_sizes', $sizes);
                $sizes = apply_filters('intermediate_image_sizes', $sizes);
-               
+
                foreach ($sizes as $size) {
                foreach ($sizes as $size) {
-                       $resized = image_make_intermediate_size( $file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") );
+                       $resized = image_make_intermediate_size( $full_path_file, get_option("{$size}_size_w"), get_option("{$size}_size_h"), get_option("{$size}_crop") );
                        if ( $resized )
                                $metadata['sizes'][$size] = $resized;
                }
                        if ( $resized )
                                $metadata['sizes'][$size] = $resized;
                }
-                       
+
                // fetch additional metadata from exif/iptc
                // fetch additional metadata from exif/iptc
-               $image_meta = wp_read_image_metadata( $file );
+               $image_meta = wp_read_image_metadata( $full_path_file );
                if ($image_meta)
                        $metadata['image_meta'] = $image_meta;
 
        }
                if ($image_meta)
                        $metadata['image_meta'] = $image_meta;
 
        }
+
        return apply_filters( 'wp_generate_attachment_metadata', $metadata );
 }
 
 /**
        return apply_filters( 'wp_generate_attachment_metadata', $metadata );
 }
 
 /**
- * wp_load_image() - Load an image which PHP Supports.
+ * Load an image from a string, if PHP supports it.
  *
  *
- * @package WordPress
- * @internal Missing Long Description
- * @param      string  $file   Filename of the image to load
- * @return     resource                The resulting image resource on success, Error string on failure.
+ * @since 2.1.0
  *
  *
+ * @param string $file Filename of the image to load.
+ * @return resource The resulting image resource on success, Error string on failure.
  */
 function wp_load_image( $file ) {
        if ( is_numeric( $file ) )
  */
 function wp_load_image( $file ) {
        if ( is_numeric( $file ) )
@@ -144,36 +153,43 @@ function wp_load_image( $file ) {
 }
 
 /**
 }
 
 /**
- * get_udims() - Calculated the new dimentions for downsampled images
+ * Calculated the new dimentions for a downsampled image.
  *
  *
- * @package WordPress
- * @internal Missing Description
+ * @since 2.0.0
  * @see wp_shrink_dimensions()
  * @see wp_shrink_dimensions()
- * @param      int             $width  Current width of the image
- * @param      int     $height Current height of the image
- * @return     mixed                   Array(height,width) of shrunk dimensions.
  *
  *
+ * @param int $width Current width of the image
+ * @param int $height Current height of the image
+ * @return mixed Array(height,width) of shrunk dimensions.
  */
 function get_udims( $width, $height) {
        return wp_shrink_dimensions( $width, $height );
 }
  */
 function get_udims( $width, $height) {
        return wp_shrink_dimensions( $width, $height );
 }
+
 /**
 /**
- * wp_shrink_dimensions() - Calculates the new dimentions for a downsampled image.
+ * Calculates the new dimentions for a downsampled image.
  *
  *
- * @package WordPress
- * @internal Missing Long Description
- * @param      int             $width  Current width of the image
- * @param      int     $height Current height of the image
- * @param      int             $wmax   Maximum wanted width
- * @param      int             $hmax   Maximum wanted height
- * @return     mixed                   Array(height,width) of shrunk dimensions.
+ * @since 2.0.0
+ * @see wp_constrain_dimensions()
  *
  *
+ * @param int $width Current width of the image
+ * @param int $height Current height of the image
+ * @param int $wmax Maximum wanted width
+ * @param int $hmax Maximum wanted height
+ * @return mixed Array(height,width) of shrunk dimensions.
  */
 function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
        return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
 }
 
  */
 function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
        return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
 }
 
-// convert a fraction string to a decimal
+/**
+ * Convert a fraction string to a decimal.
+ *
+ * @since 2.5.0
+ *
+ * @param string $str
+ * @return int|float
+ */
 function wp_exif_frac2dec($str) {
        @list( $n, $d ) = explode( '/', $str );
        if ( !empty($d) )
 function wp_exif_frac2dec($str) {
        @list( $n, $d ) = explode( '/', $str );
        if ( !empty($d) )
@@ -181,25 +197,47 @@ function wp_exif_frac2dec($str) {
        return $str;
 }
 
        return $str;
 }
 
-// convert the exif date format to a unix timestamp
+/**
+ * Convert the exif date format to a unix timestamp.
+ *
+ * @since 2.5.0
+ *
+ * @param string $str
+ * @return int
+ */
 function wp_exif_date2ts($str) {
 function wp_exif_date2ts($str) {
-       // seriously, who formats a date like 'YYYY:MM:DD hh:mm:ss'?
        @list( $date, $time ) = explode( ' ', trim($str) );
        @list( $y, $m, $d ) = explode( ':', $date );
 
        return strtotime( "{$y}-{$m}-{$d} {$time}" );
 }
 
        @list( $date, $time ) = explode( ' ', trim($str) );
        @list( $y, $m, $d ) = explode( ':', $date );
 
        return strtotime( "{$y}-{$m}-{$d} {$time}" );
 }
 
-// get extended image metadata, exif or iptc as available
+/**
+ * Get extended image metadata, exif or iptc as available.
+ *
+ * Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso
+ * created_timestamp, focal_length, shutter_speed, and title.
+ *
+ * The IPTC metadata that is retrieved is APP13, credit, byline, created date
+ * and time, caption, copyright, and title. Also includes FNumber, Model,
+ * DateTimeDigitized, FocalLength, ISOSpeedRatings, and ExposureTime.
+ *
+ * @todo Try other exif libraries if available.
+ * @since 2.5.0
+ *
+ * @param string $file
+ * @return bool|array False on failure. Image metadata array on success.
+ */
 function wp_read_image_metadata( $file ) {
        if ( !file_exists( $file ) )
                return false;
 
        list(,,$sourceImageType) = getimagesize( $file );
 
 function wp_read_image_metadata( $file ) {
        if ( !file_exists( $file ) )
                return false;
 
        list(,,$sourceImageType) = getimagesize( $file );
 
-       // exif contains a bunch of data we'll probably never need formatted in ways that are difficult to use.
-       // We'll normalize it and just extract the fields that are likely to be useful.  Fractions and numbers
-       // are converted to floats, dates to unix timestamps, and everything else to strings.
+       // exif contains a bunch of data we'll probably never need formatted in ways
+       // that are difficult to use. We'll normalize it and just extract the fields
+       // that are likely to be useful.  Fractions and numbers are converted to
+       // floats, dates to unix timestamps, and everything else to strings.
        $meta = array(
                'aperture' => 0,
                'credit' => '',
        $meta = array(
                'aperture' => 0,
                'credit' => '',
@@ -213,7 +251,8 @@ function wp_read_image_metadata( $file ) {
                'title' => '',
        );
 
                'title' => '',
        );
 
-       // read iptc first, since it might contain data not available in exif such as caption, description etc
+       // read iptc first, since it might contain data not available in exif such
+       // as caption, description etc
        if ( is_callable('iptcparse') ) {
                getimagesize($file, $info);
                if ( !empty($info['APP13']) ) {
        if ( is_callable('iptcparse') ) {
                getimagesize($file, $info);
                if ( !empty($info['APP13']) ) {
@@ -222,7 +261,7 @@ function wp_read_image_metadata( $file ) {
                                $meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
                        elseif ( !empty($iptc['2#080'][0]) ) // byline
                                $meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
                                $meta['credit'] = utf8_encode(trim($iptc['2#110'][0]));
                        elseif ( !empty($iptc['2#080'][0]) ) // byline
                                $meta['credit'] = utf8_encode(trim($iptc['2#080'][0]));
-                       if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created datee and time
+                       if ( !empty($iptc['2#055'][0]) and !empty($iptc['2#060'][0]) ) // created date and time
                                $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
                        if ( !empty($iptc['2#120'][0]) ) // caption
                                $meta['caption'] = utf8_encode(trim($iptc['2#120'][0]));
                                $meta['created_timestamp'] = strtotime($iptc['2#055'][0] . ' ' . $iptc['2#060'][0]);
                        if ( !empty($iptc['2#120'][0]) ) // caption
                                $meta['caption'] = utf8_encode(trim($iptc['2#120'][0]));
@@ -249,33 +288,42 @@ function wp_read_image_metadata( $file ) {
                if (!empty($exif['ExposureTime']))
                        $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] );
        }
                if (!empty($exif['ExposureTime']))
                        $meta['shutter_speed'] = wp_exif_frac2dec( $exif['ExposureTime'] );
        }
-       // FIXME: try other exif libraries if available
 
        return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
 
 }
 
 
        return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType );
 
 }
 
-// is the file a real image file?
+/**
+ * Validate that file is an image.
+ *
+ * @since 2.5.0
+ *
+ * @param string $path File path to test if valid image.
+ * @return bool True if valid image, false if not valid image.
+ */
 function file_is_valid_image($path) {
        $size = @getimagesize($path);
        return !empty($size);
 }
 
 function file_is_valid_image($path) {
        $size = @getimagesize($path);
        return !empty($size);
 }
 
-// is the file an image suitable for displaying within a web page?
+/**
+ * Validate that file is suitable for displaying within a web page.
+ *
+ * @since 2.5.0
+ * @uses apply_filters() Calls 'file_is_displayable_image' on $result and $path.
+ *
+ * @param string $path File path to test.
+ * @return bool True if suitable, false if not suitable.
+ */
 function file_is_displayable_image($path) {
        $info = @getimagesize($path);
        if ( empty($info) )
                $result = false;
 function file_is_displayable_image($path) {
        $info = @getimagesize($path);
        if ( empty($info) )
                $result = false;
-       elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) )
-               // only gif, jpeg and png images can reliably be displayed
-               $result = false;
-       elseif ( $info['channels'] > 0 && $info['channels'] != 3 ) {
-               // some web browsers can't display cmyk or grayscale jpegs
+       elseif ( !in_array($info[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)) )     // only gif, jpeg and png images can reliably be displayed
                $result = false;
                $result = false;
-       }
        else
                $result = true;
        else
                $result = true;
-               
+
        return apply_filters('file_is_displayable_image', $result, $path);
 }
 
        return apply_filters('file_is_displayable_image', $result, $path);
 }
 
index 35fd141b17d9d6b431e98bae1163c2ddc75e4b5e..c9cd71cb580920b44d9ad39bd14a529125ada973 100644 (file)
@@ -1,5 +1,18 @@
 <?php
 <?php
+/**
+ * WordPress Administration Importer API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
+/**
+ * Retrieve list of importers.
+ *
+ * @since 2.0.0
+ *
+ * @return array
+ */
 function get_importers() {
        global $wp_importers;
        if ( is_array($wp_importers) )
 function get_importers() {
        global $wp_importers;
        if ( is_array($wp_importers) )
@@ -7,6 +20,17 @@ function get_importers() {
        return $wp_importers;
 }
 
        return $wp_importers;
 }
 
+/**
+ * Register importer for WordPress.
+ *
+ * @since 2.0.0
+ *
+ * @param string $id Importer tag. Used to uniquely identify importer.
+ * @param string $name Importer name and title.
+ * @param string $description Importer description.
+ * @param callback $callback Callback to run.
+ * @return WP_Error Returns WP_Error when $callback is WP_Error.
+ */
 function register_importer( $id, $name, $description, $callback ) {
        global $wp_importers;
        if ( is_wp_error( $callback ) )
 function register_importer( $id, $name, $description, $callback ) {
        global $wp_importers;
        if ( is_wp_error( $callback ) )
@@ -14,10 +38,26 @@ function register_importer( $id, $name, $description, $callback ) {
        $wp_importers[$id] = array ( $name, $description, $callback );
 }
 
        $wp_importers[$id] = array ( $name, $description, $callback );
 }
 
+/**
+ * Cleanup importer.
+ *
+ * Removes attachment based on ID.
+ *
+ * @since 2.0.0
+ *
+ * @param string $id Importer ID.
+ */
 function wp_import_cleanup( $id ) {
        wp_delete_attachment( $id );
 }
 
 function wp_import_cleanup( $id ) {
        wp_delete_attachment( $id );
 }
 
+/**
+ * Handle importer uploading and add attachment.
+ *
+ * @since 2.0.0
+ *
+ * @return array
+ */
 function wp_import_handle_upload() {
        $overrides = array( 'test_form' => false, 'test_type' => false );
        $_FILES['import']['name'] .= '.import';
 function wp_import_handle_upload() {
        $overrides = array( 'test_form' => false, 'test_type' => false );
        $_FILES['import']['name'] .= '.import';
index d91ffc2398827107eb75a45a6fec907e31724e89..57e032ea9c1555f5b7fb40d0089f96c3be1df82d 100644 (file)
@@ -1,30 +1,64 @@
 <?php
 <?php
-
+/**
+ * WordPress Administration Media API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_tabs() {
        $_default_tabs = array(
 function media_upload_tabs() {
        $_default_tabs = array(
-               'type' => __('Choose File'), // handler action suffix => tab text
+               'type' => __('From Computer'), // handler action suffix => tab text
+               'type_url' => __('From URL'),
                'gallery' => __('Gallery'),
                'gallery' => __('Gallery'),
-               'library' => __('Media Library'),
+               'library' => __('Media Library')
        );
 
        return apply_filters('media_upload_tabs', $_default_tabs);
 }
 
        );
 
        return apply_filters('media_upload_tabs', $_default_tabs);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $tabs
+ * @return unknown
+ */
 function update_gallery_tab($tabs) {
        global $wpdb;
 function update_gallery_tab($tabs) {
        global $wpdb;
+
        if ( !isset($_REQUEST['post_id']) ) {
                unset($tabs['gallery']);
                return $tabs;
        }
        if ( !isset($_REQUEST['post_id']) ) {
                unset($tabs['gallery']);
                return $tabs;
        }
+
        if ( intval($_REQUEST['post_id']) )
                $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])));
 
        if ( intval($_REQUEST['post_id']) )
                $attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = %d", $_REQUEST['post_id'])));
 
+       if ( empty($attachments) ) {
+               unset($tabs['gallery']);
+               return $tabs;
+       }
+
        $tabs['gallery'] = sprintf(__('Gallery (%s)'), "<span id='attachments-count'>$attachments</span>");
 
        return $tabs;
 }
 add_filter('media_upload_tabs', 'update_gallery_tab');
 
        $tabs['gallery'] = sprintf(__('Gallery (%s)'), "<span id='attachments-count'>$attachments</span>");
 
        return $tabs;
 }
 add_filter('media_upload_tabs', 'update_gallery_tab');
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function the_media_upload_tabs() {
        global $redir_tab;
        $tabs = media_upload_tabs();
 function the_media_upload_tabs() {
        global $redir_tab;
        $tabs = media_upload_tabs();
@@ -51,9 +85,25 @@ function the_media_upload_tabs() {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @param unknown_type $alt
+ * @param unknown_type $title
+ * @param unknown_type $align
+ * @param unknown_type $url
+ * @param unknown_type $rel
+ * @param unknown_type $size
+ * @return unknown
+ */
 function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {
 
 function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = false, $size='medium') {
 
-       $html = get_image_tag($id, $alt, $title, $align, $size);
+       $htmlalt = ( empty($alt) ) ? $title : $alt;
+
+       $html = get_image_tag($id, $htmlalt, $title, $align, $size);
 
        $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
 
 
        $rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
 
@@ -65,6 +115,20 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
        return $html;
 }
 
        return $html;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $html
+ * @param unknown_type $id
+ * @param unknown_type $alt
+ * @param unknown_type $title
+ * @param unknown_type $align
+ * @param unknown_type $url
+ * @param unknown_type $size
+ * @return unknown
+ */
 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
 
        if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
 
        if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
@@ -77,6 +141,8 @@ function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
        $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html );
        if ( empty($align) ) $align = 'none';
 
        $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html );
        if ( empty($align) ) $align = 'none';
 
+       $alt = ! empty($alt) ? addslashes($alt) : '';
+
        $shcode = '[caption id="' . $id . '" align="align' . $align
        . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]';
 
        $shcode = '[caption id="' . $id . '" align="align' . $align
        . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]';
 
@@ -84,8 +150,15 @@ function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
 }
 add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );
 
 }
 add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $html
+ */
 function media_send_to_editor($html) {
 function media_send_to_editor($html) {
-       ?>
+?>
 <script type="text/javascript">
 /* <![CDATA[ */
 var win = window.dialogArguments || opener || parent || top;
 <script type="text/javascript">
 /* <![CDATA[ */
 var win = window.dialogArguments || opener || parent || top;
@@ -96,10 +169,28 @@ win.send_to_editor('<?php echo addslashes($html); ?>');
        exit;
 }
 
        exit;
 }
 
-// this handles the file upload POST itself, creating the attachment post
+/**
+ * {@internal Missing Short Description}}
+ *
+ * This handles the file upload POST itself, creating the attachment post.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file_id
+ * @param unknown_type $post_id
+ * @param unknown_type $post_data
+ * @return unknown
+ */
 function media_handle_upload($file_id, $post_id, $post_data = array()) {
        $overrides = array('test_form'=>false);
 function media_handle_upload($file_id, $post_id, $post_data = array()) {
        $overrides = array('test_form'=>false);
-       $file = wp_handle_upload($_FILES[$file_id], $overrides);
+
+       $time = current_time('mysql');
+       if ( $post = get_post($post_id) ) {
+               if ( substr( $post->post_date, 0, 4 ) > 0 )
+                       $time = $post->post_date;
+       }
+
+       $file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
 
        if ( isset($file['error']) )
                return new WP_Error( 'upload_error', $file['error'] );
 
        if ( isset($file['error']) )
                return new WP_Error( 'upload_error', $file['error'] );
@@ -128,7 +219,7 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
        ), $post_data );
 
        // Save the data
        ), $post_data );
 
        // Save the data
-       $id = wp_insert_attachment($attachment, $file, $post_parent);
+       $id = wp_insert_attachment($attachment, $file, $post_id);
        if ( !is_wp_error($id) ) {
                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
        }
        if ( !is_wp_error($id) ) {
                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
        }
@@ -137,6 +228,17 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
 
 }
 
 
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file_array
+ * @param unknown_type $post_id
+ * @param unknown_type $desc
+ * @param unknown_type $post_data
+ * @return unknown
+ */
 function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
        $overrides = array('test_form'=>false);
        $file = wp_handle_sideload($file_array, $overrides);
 function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
        $overrides = array('test_form'=>false);
        $file = wp_handle_sideload($file_array, $overrides);
@@ -170,7 +272,7 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
        ), $post_data );
 
        // Save the data
        ), $post_data );
 
        // Save the data
-       $id = wp_insert_attachment($attachment, $file, $post_parent);
+       $id = wp_insert_attachment($attachment, $file, $post_id);
        if ( !is_wp_error($id) ) {
                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
                return $url;
        if ( !is_wp_error($id) ) {
                wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
                return $url;
@@ -178,9 +280,16 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data =
        return $id;
 }
 
        return $id;
 }
 
-
-// wrap iframe content (produced by $content_func) in a doctype, html head/body etc
-// any additional function args will be passed to content_func
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Wrap iframe content (produced by $content_func) in a doctype, html head/body
+ * etc any additional function args will be passed to content_func.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $content_func
+ */
 function wp_iframe($content_func /* ... */) {
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 function wp_iframe($content_func /* ... */) {
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -220,10 +329,15 @@ if ( is_string($content_func) )
 <?php
 }
 
 <?php
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function media_buttons() {
        global $post_ID, $temp_ID;
        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
 function media_buttons() {
        global $post_ID, $temp_ID;
        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID);
-       $context = apply_filters('media_buttons_context', __('Add media: %s'));
+       $context = apply_filters('media_buttons_context', __('Upload/Insert %s'));
        $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
        $media_title = __('Add Media');
        $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
        $media_upload_iframe_src = "media-upload.php?post_id=$uploading_iframe_ID";
        $media_title = __('Add Media');
        $image_upload_iframe_src = apply_filters('image_upload_iframe_src', "$media_upload_iframe_src&amp;type=image");
@@ -245,9 +359,21 @@ EOF;
 add_action( 'media_buttons', 'media_buttons' );
 add_action('media_upload_media', 'media_upload_handler');
 
 add_action( 'media_buttons', 'media_buttons' );
 add_action('media_upload_media', 'media_upload_handler');
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_form_handler() {
        check_admin_referer('media-form');
 
 function media_upload_form_handler() {
        check_admin_referer('media-form');
 
+       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']) )
@@ -258,6 +384,10 @@ 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'];
+               }
 
                $post = apply_filters('attachment_fields_to_save', $post, $attachment);
 
 
                $post = apply_filters('attachment_fields_to_save', $post, $attachment);
 
@@ -274,12 +404,18 @@ function media_upload_form_handler() {
                                wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
        }
 
                                wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
        }
 
-       if ( isset($_POST['insert-gallery']) )
-               return media_send_to_editor('[gallery]');
+       if ( isset($_POST['insert-gallery']) || isset($_POST['update-gallery']) ) { ?>
+               <script type="text/javascript">
+               /* <![CDATA[ */
+               var win = window.dialogArguments || opener || parent || top;
+               win.tb_remove();
+               /* ]]> */
+               </script>
+               <?php
+               exit;
+       }
 
 
-       if ( isset($_POST['send']) ) {
-               $keys = array_keys($_POST['send']);
-               $send_id = (int) array_shift($keys);
+       if ( isset($send_id) ) {
                $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
                $html = $attachment['post_title'];
                if ( !empty($attachment['url']) ) {
                $attachment = stripslashes_deep( $_POST['attachments'][$send_id] );
                $html = $attachment['post_title'];
                if ( !empty($attachment['url']) ) {
@@ -294,7 +430,17 @@ function media_upload_form_handler() {
        return $errors;
 }
 
        return $errors;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_image() {
 function media_upload_image() {
+       $errors = array();
+       $id = 0;
+
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
@@ -333,15 +479,34 @@ function media_upload_image() {
                return media_upload_gallery();
        }
 
                return media_upload_gallery();
        }
 
+       if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
+               return wp_iframe( 'media_upload_type_url_form', 'image', $errors, $id );
+
        return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
 }
 
        return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file
+ * @param unknown_type $post_id
+ * @param unknown_type $desc
+ * @return unknown
+ */
 function media_sideload_image($file, $post_id, $desc = null) {
        if (!empty($file) ) {
                $file_array['name'] = basename($file);
 function media_sideload_image($file, $post_id, $desc = null) {
        if (!empty($file) ) {
                $file_array['name'] = basename($file);
-               $file_array['tmp_name'] = download_url($file);
+               $tmp = download_url($file);
+               $file_array['tmp_name'] = $tmp;
                $desc = @$desc;
 
                $desc = @$desc;
 
+               if ( is_wp_error($tmp) ) {
+                       @unlink($file_array['tmp_name']);
+                       $file_array['tmp_name'] = '';
+               }
+
                $id = media_handle_sideload($file_array, $post_id, $desc);
                $src = $id;
 
                $id = media_handle_sideload($file_array, $post_id, $desc);
                $src = $id;
 
@@ -358,7 +523,17 @@ function media_sideload_image($file, $post_id, $desc = null) {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_audio() {
 function media_upload_audio() {
+       $errors = array();
+       $id = 0;
+
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
@@ -395,10 +570,23 @@ function media_upload_audio() {
                return media_upload_gallery();
        }
 
                return media_upload_gallery();
        }
 
+       if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
+               return wp_iframe( 'media_upload_type_url_form', 'audio', $errors, $id );
+
        return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
 }
 
        return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_video() {
 function media_upload_video() {
+       $errors = array();
+       $id = 0;
+
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
@@ -435,10 +623,23 @@ function media_upload_video() {
                return media_upload_gallery();
        }
 
                return media_upload_gallery();
        }
 
+       if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
+               return wp_iframe( 'media_upload_type_url_form', 'video', $errors, $id );
+
        return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
 }
 
        return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_file() {
 function media_upload_file() {
+       $errors = array();
+       $id = 0;
+
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
        if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
                // Upload File button was clicked
                $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
@@ -475,10 +676,22 @@ function media_upload_file() {
                return media_upload_gallery();
        }
 
                return media_upload_gallery();
        }
 
+       if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' )
+               return wp_iframe( 'media_upload_type_url_form', 'file', $errors, $id );
+
        return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
 }
 
        return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_gallery() {
 function media_upload_gallery() {
+       $errors = array();
+
        if ( !empty($_POST) ) {
                $return = media_upload_form_handler();
 
        if ( !empty($_POST) ) {
                $return = media_upload_form_handler();
 
@@ -492,7 +705,15 @@ function media_upload_gallery() {
        return wp_iframe( 'media_upload_gallery_form', $errors );
 }
 
        return wp_iframe( 'media_upload_gallery_form', $errors );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function media_upload_library() {
 function media_upload_library() {
+       $errors = array();
        if ( !empty($_POST) ) {
                $return = media_upload_form_handler();
 
        if ( !empty($_POST) ) {
                $return = media_upload_form_handler();
 
@@ -505,6 +726,113 @@ function media_upload_library() {
        return wp_iframe( 'media_upload_library_form', $errors );
 }
 
        return wp_iframe( 'media_upload_library_form', $errors );
 }
 
+/**
+ * Retrieve HTML for the image alignment radio buttons with the specified one checked.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $checked
+ * @return unknown
+ */
+function image_align_input_fields($post, $checked='') {
+
+       $alignments = array('none' => 'None', 'left' => 'Left', 'center' => 'Center', 'right' => 'Right');
+       if ( !array_key_exists($checked, $alignments) )
+               $checked = 'none';
+
+       $out = array();
+       foreach ($alignments as $name => $label) {
+
+               $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>";
+       }
+       return join("\n", $out);
+}
+
+/**
+ * Retrieve HTML for the size radio buttons with the specified one checked.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $checked
+ * @return unknown
+ */
+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'));
+
+               foreach ( $size_names as $size => $name) {
+                       $downsize = image_downsize($post->ID, $size);
+
+                       // is this size selectable?
+                       $enabled = ( $downsize[3] || 'full' == $size );
+                       $css_id = "image-size-{$size}-{$post->ID}";
+                       // if this size is the default but that's not available, don't select it
+                       if ( $checked && !$enabled )
+                               $checked = '';
+                       // if $checked was not specified, default to the first available size that's bigger than a thumbnail
+                       if ( !$checked && $enabled && 'thumbnail' != $size )
+                               $checked = $size;
+
+                       $html = "<div class='image-size-item'><input type='radio' ".( $enabled ? '' : "disabled='disabled'")."name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'".( $checked == $size ? " checked='checked'" : '') ." />";
+
+                       $html .= "<label for='{$css_id}'>" . __($name). "</label>";
+                       // only show the dimensions if that choice is available
+                       if ( $enabled )
+                               $html .= " <label for='{$css_id}' class='help'>" . sprintf( __("(%d&nbsp;&times;&nbsp;%d)"), $downsize[1], $downsize[2] ). "</label>";
+
+                       $html .= '</div>';
+
+                       $out[] = $html;
+               }
+
+               return array(
+                       'label' => __('Size'),
+                       'input' => 'html',
+                       'html'  => join("\n", $out),
+               );
+}
+
+/**
+ * Retrieve HTML for the Link URL buttons with the default link type as specified.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $url_type
+ * @return unknown
+ */
+function image_link_input_fields($post, $url_type='') {
+
+       $file = wp_get_attachment_url($post->ID);
+       $link = get_attachment_link($post->ID);
+
+       $url = '';
+       if ( $url_type == 'file' )
+               $url = $file;
+       elseif ( $url_type == 'post' )
+               $url = $link;
+
+       return "<input type='text' class='urlfield' name='attachments[$post->ID][url]' value='" . attribute_escape($url) . "' /><br />
+                               <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>
+";
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $form_fields
+ * @param unknown_type $post
+ * @return unknown
+ */
 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;
@@ -514,43 +842,42 @@ function image_attachment_fields_to_edit($form_fields, $post) {
 
                $form_fields['post_content']['label'] = __('Description');
 
 
                $form_fields['post_content']['label'] = __('Description');
 
-               $thumb = wp_get_attachment_thumb_url($post->ID);
-
                $form_fields['align'] = array(
                        'label' => __('Alignment'),
                        'input' => 'html',
                $form_fields['align'] = array(
                        'label' => __('Alignment'),
                        'input' => 'html',
-                       'html'  => "
-                               <input type='radio' name='attachments[$post->ID][align]' id='image-align-none-$post->ID' value='none' checked='checked' />
-                               <label for='image-align-none-$post->ID' class='align image-align-none-label'>" . __('None') . "</label>
-                               <input type='radio' name='attachments[$post->ID][align]' id='image-align-left-$post->ID' value='left' />
-                               <label for='image-align-left-$post->ID' class='align image-align-left-label'>" . __('Left') . "</label>
-                               <input type='radio' name='attachments[$post->ID][align]' id='image-align-center-$post->ID' value='center' />
-                               <label for='image-align-center-$post->ID' class='align image-align-center-label'>" . __('Center') . "</label>
-                               <input type='radio' name='attachments[$post->ID][align]' id='image-align-right-$post->ID' value='right' />
-                               <label for='image-align-right-$post->ID' class='align image-align-right-label'>" . __('Right') . "</label>\n",
-               );
-               $form_fields['image-size'] = array(
-                       'label' => __('Size'),
-                       'input' => 'html',
-                       'html'  => "
-                               " . ( $thumb ? "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-thumb-$post->ID' value='thumbnail' />
-                               <label for='image-size-thumb-$post->ID'>" . __('Thumbnail') . "</label>
-                               " : '' ) . "<input type='radio' name='attachments[$post->ID][image-size]' id='image-size-medium-$post->ID' value='medium' checked='checked' />
-                               <label for='image-size-medium-$post->ID'>" . __('Medium') . "</label>
-                               <input type='radio' name='attachments[$post->ID][image-size]' id='image-size-full-$post->ID' value='full' />
-                               <label for='image-size-full-$post->ID'>" . __('Full size') . "</label>",
+                       'html'  => image_align_input_fields($post, get_option('image_default_align')),
                );
                );
+
+               $form_fields['image-size'] = image_size_input_fields($post, get_option('image_default_size'));
        }
        return $form_fields;
 }
 
 add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2);
 
        }
        return $form_fields;
 }
 
 add_filter('attachment_fields_to_edit', 'image_attachment_fields_to_edit', 10, 2);
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $form_fields
+ * @param unknown_type $post
+ * @return unknown
+ */
 function media_single_attachment_fields_to_edit( $form_fields, $post ) {
        unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']);
        return $form_fields;
 }
 
 function media_single_attachment_fields_to_edit( $form_fields, $post ) {
        unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']);
        return $form_fields;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $attachment
+ * @return unknown
+ */
 function image_attachment_fields_to_save($post, $attachment) {
        if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
                if ( strlen(trim($post['post_title'])) == 0 ) {
 function image_attachment_fields_to_save($post, $attachment) {
        if ( substr($post['post_mime_type'], 0, 5) == 'image' ) {
                if ( strlen(trim($post['post_title'])) == 0 ) {
@@ -564,6 +891,16 @@ function image_attachment_fields_to_save($post, $attachment) {
 
 add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);
 
 
 add_filter('attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2);
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $html
+ * @param unknown_type $attachment_id
+ * @param unknown_type $attachment
+ * @return unknown
+ */
 function image_media_send_to_editor($html, $attachment_id, $attachment) {
        $post =& get_post($attachment_id);
        if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
 function image_media_send_to_editor($html, $attachment_id, $attachment) {
        $post =& get_post($attachment_id);
        if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
@@ -589,6 +926,15 @@ function image_media_send_to_editor($html, $attachment_id, $attachment) {
 
 add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
 
 
 add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ * @param unknown_type $errors
+ * @return unknown
+ */
 function get_attachment_fields_to_edit($post, $errors = null) {
        if ( is_int($post) )
                $post =& get_post($post);
 function get_attachment_fields_to_edit($post, $errors = null) {
        if ( is_int($post) )
                $post =& get_post($post);
@@ -596,8 +942,6 @@ function get_attachment_fields_to_edit($post, $errors = null) {
                $post = (object) $post;
 
        $edit_post = sanitize_post($post, 'edit');
                $post = (object) $post;
 
        $edit_post = sanitize_post($post, 'edit');
-       $file = wp_get_attachment_url($post->ID);
-       $link = get_attachment_link($post->ID);
 
        $form_fields = array(
                'post_title'   => array(
 
        $form_fields = array(
                'post_title'   => array(
@@ -616,17 +960,10 @@ function get_attachment_fields_to_edit($post, $errors = null) {
                'url'          => array(
                        'label'      => __('Link URL'),
                        'input'      => 'html',
                'url'          => array(
                        'label'      => __('Link URL'),
                        'input'      => 'html',
-                       'html'       => "
-                               <input type='text' name='attachments[$post->ID][url]' value='" . attribute_escape($file) . "' /><br />
-                               <button type='button' class='button url-$post->ID' value=''>" . __('None') . "</button>
-                               <button type='button' class='button url-$post->ID' value='" . attribute_escape($file) . "'>" . __('File URL') . "</button>
-                               <button type='button' class='button url-$post->ID' value='" . attribute_escape($link) . "'>" . __('Post URL') . "</button>
-                               <script type='text/javascript'>
-                               jQuery('button.url-$post->ID').bind('click', function(){jQuery(this).siblings('input').val(this.value);});
-                               </script>\n",
+                       'html'       => image_link_input_fields($post, get_option('image_default_link_type')),
                        'helps'      => __('Enter a link URL or click above for presets.'),
                ),
                        'helps'      => __('Enter a link URL or click above for presets.'),
                ),
-       'menu_order'   => array(
+               'menu_order'   => array(
                        'label'      => __('Order'),
                        'value'      => $edit_post->menu_order
                ),
                        'label'      => __('Order'),
                        'value'      => $edit_post->menu_order
                ),
@@ -661,6 +998,19 @@ function get_attachment_fields_to_edit($post, $errors = null) {
        return $form_fields;
 }
 
        return $form_fields;
 }
 
+/**
+ * Retrieve HTML for media items of post gallery.
+ *
+ * The HTML markup retrieved will be created for the progress of SWF Upload
+ * component. Will also create link for showing and hiding the form to modify
+ * the image attachment.
+ *
+ * @since unknown
+ *
+ * @param int $post_id Optional. Post ID.
+ * @param array $errors Errors for attachment, if any.
+ * @return string
+ */
 function get_media_items( $post_id, $errors ) {
        if ( $post_id ) {
                $post = get_post($post_id);
 function get_media_items( $post_id, $errors ) {
        if ( $post_id ) {
                $post = get_post($post_id);
@@ -674,20 +1024,27 @@ function get_media_items( $post_id, $errors ) {
                                $attachments[$attachment->ID] = $attachment;
        }
 
                                $attachments[$attachment->ID] = $attachment;
        }
 
-       if ( empty($attachments) )
-               return '';
-
-       foreach ( $attachments as $id => $attachment )
+       $output = '';
+       foreach ( (array) $attachments as $id => $attachment )
                if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
                        $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>";
 
        return $output;
 }
 
                if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
                        $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress'><div class='bar'></div></div><div id='media-upload-error-$id'></div><div class='filename'></div>$item\n</div>";
 
        return $output;
 }
 
+/**
+ * Retrieve HTML form for modifying the image attachment.
+ *
+ * @since unknown
+ *
+ * @param int $attachment_id Attachment ID for modification.
+ * @param string|array $args Optional. Override defaults.
+ * @return string HTML form for attachment.
+ */
 function get_media_item( $attachment_id, $args = null ) {
        global $redir_tab;
 
 function get_media_item( $attachment_id, $args = null ) {
        global $redir_tab;
 
-       $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true );
+       $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true, 'show_title' => true );
        $args = wp_parse_args( $args, $default_args );
        extract( $args, EXTR_SKIP );
 
        $args = wp_parse_args( $args, $default_args );
        extract( $args, EXTR_SKIP );
 
@@ -697,10 +1054,6 @@ function get_media_item( $attachment_id, $args = null ) {
        else
                return false;
 
        else
                return false;
 
-       $title_label = __('Title');
-       $description_label = __('Description');
-       $tags_label = __('Tags');
-
        $toggle_on = __('Show');
        $toggle_off = __('Hide');
 
        $toggle_on = __('Show');
        $toggle_off = __('Hide');
 
@@ -708,13 +1061,14 @@ function get_media_item( $attachment_id, $args = null ) {
 
        $filename = basename($post->guid);
        $title = attribute_escape($post->post_title);
 
        $filename = basename($post->guid);
        $title = attribute_escape($post->post_title);
-       $description = attribute_escape($post->post_content);
+
        if ( $_tags = get_the_tags($attachment_id) ) {
                foreach ( $_tags as $tag )
                        $tags[] = $tag->name;
                $tags = attribute_escape(join(', ', $tags));
        }
 
        if ( $_tags = get_the_tags($attachment_id) ) {
                foreach ( $_tags as $tag )
                        $tags[] = $tag->name;
                $tags = attribute_escape(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);
        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);
@@ -734,7 +1088,7 @@ function get_media_item( $attachment_id, $args = null ) {
        }
 
        $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
        }
 
        $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
-       $display_title = wp_html_excerpt($display_title, 60);
+       $display_title = $show_title ? "<div class='filename new'>" . wp_html_excerpt($display_title, 60) . "</div>" : '';
 
        $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
        $order = '';
 
        $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
        $order = '';
@@ -755,7 +1109,7 @@ function get_media_item( $attachment_id, $args = null ) {
        $type
        $toggle_links
        $order
        $type
        $toggle_links
        $order
-       <div class='filename new'>$display_title</div>
+       $display_title
        <table class='slidetoggle describe $class'>
                <thead class='media-item-info'>
                <tr>
        <table class='slidetoggle describe $class'>
                <thead class='media-item-info'>
                <tr>
@@ -813,7 +1167,7 @@ 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'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>";
+                       $item .= "<textarea type='text' id='$name' name='$name'" . $aria_required . ">" . htmlspecialchars( $field['value'] ) . "</textarea>";
                } else {
                        $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
                }
                } else {
                        $item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
                }
@@ -845,9 +1199,21 @@ function get_media_item( $attachment_id, $args = null ) {
        foreach ( $hidden_fields as $name => $value )
                $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n";
 
        foreach ( $hidden_fields as $name => $value )
                $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n";
 
+       if ( $post->post_parent < 1 && (int) $_REQUEST['post_id'] ) {
+               $parent = (int) $_REQUEST['post_id'];
+               $parent_name = "attachments[$attachment_id][post_parent]";
+
+               $item .= "\t<input type='hidden' name='$parent_name' id='$parent_name' value='" . $parent . "' />\n";
+       }
+
        return $item;
 }
 
        return $item;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function media_upload_header() {
        ?>
        <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script>
 function media_upload_header() {
        ?>
        <script type="text/javascript">post_id = <?php echo intval($_REQUEST['post_id']); ?>;</script>
@@ -857,6 +1223,13 @@ function media_upload_header() {
        <?php
 }
 
        <?php
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $errors
+ */
 function media_upload_form( $errors = null ) {
        global $type, $tab;
 
 function media_upload_form( $errors = null ) {
        global $type, $tab;
 
@@ -868,7 +1241,7 @@ function media_upload_form( $errors = null ) {
                $flash = false;
 
        $flash = apply_filters('flash_uploader', $flash);
                $flash = false;
 
        $flash = apply_filters('flash_uploader', $flash);
-       $post_id = intval($_REQUEST['post_id']);
+       $post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
 
 ?>
 <div id="media-upload-notice">
 
 ?>
 <div id="media-upload-notice">
@@ -887,10 +1260,16 @@ function media_upload_form( $errors = null ) {
 <?php if ( $flash ) : ?>
 <script type="text/javascript">
 <!--
 <?php if ( $flash ) : ?>
 <script type="text/javascript">
 <!--
-jQuery(function($){
+SWFUpload.onload = function() {
        swfu = new SWFUpload({
        swfu = new SWFUpload({
+                       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_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 attribute_escape( $flash_action_url ); ?>",
-                       flash_url : "<?php echo includes_url('js/swfupload/swfupload_f9.swf'); ?>",
+                       flash_url : "<?php echo includes_url('js/swfupload/swfupload.swf'); ?>",
                        file_post_name: "async-upload",
                        file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
                        post_params : {
                        file_post_name: "async-upload",
                        file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
                        post_params : {
@@ -902,8 +1281,6 @@ jQuery(function($){
                                "short" : "1"
                        },
                        file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
                                "short" : "1"
                        },
                        file_size_limit : "<?php echo wp_max_upload_size(); ?>b",
-                       swfupload_element_id : "flash-upload-ui", // id of the element displayed when swfupload is available
-                       degraded_element_id : "html-upload-ui",   // when swfupload is unavailable
                        file_dialog_start_handler : fileDialogStart,
                        file_queued_handler : fileQueued,
                        upload_start_handler : uploadStart,
                        file_dialog_start_handler : fileDialogStart,
                        file_queued_handler : fileQueued,
                        upload_start_handler : uploadStart,
@@ -913,17 +1290,22 @@ jQuery(function($){
                        upload_complete_handler : uploadComplete,
                        file_queue_error_handler : fileQueueError,
                        file_dialog_complete_handler : fileDialogComplete,
                        upload_complete_handler : uploadComplete,
                        file_queue_error_handler : fileQueueError,
                        file_dialog_complete_handler : fileDialogComplete,
-
+                       swfupload_pre_load_handler: swfuploadPreLoad,
+                       swfupload_load_failed_handler: swfuploadLoadFailed,
+                       custom_settings : {
+                               degraded_element_id : "html-upload-ui", // id of the element displayed when swfupload is unavailable
+                               swfupload_element_id : "flash-upload-ui" // id of the element displayed when swfupload is available
+                       },
                        debug: false
                });
                        debug: false
                });
-       $("#flash-browse-button").bind( "click", function(){swfu.selectFiles();});
-});
+};
 //-->
 </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'); ?>
-       <p><input id="flash-browse-button" type="button" value="<?php echo attribute_escape( __( 'Choose files to upload' ) ); ?>" class="button" /></p>
+
+       <div><?php _e( 'Choose files to upload' ); ?> <div id="flash-browse-button"></div></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>
@@ -932,9 +1314,10 @@ jQuery(function($){
 
 <div id="html-upload-ui">
 <?php do_action('pre-html-upload-ui'); ?>
 
 <div id="html-upload-ui">
 <?php do_action('pre-html-upload-ui'); ?>
-       <p>
+       <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>
        </p>
        <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>
        </p>
+
        <br class="clear" />
        <?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>
        <br class="clear" />
        <?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>
@@ -945,6 +1328,15 @@ jQuery(function($){
 <?php
 }
 
 <?php
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $type
+ * @param unknown_type $errors
+ * @param unknown_type $id
+ */
 function media_upload_type_form($type = 'file', $errors = null, $id = null) {
        media_upload_header();
 
 function media_upload_type_form($type = 'file', $errors = null, $id = null) {
        media_upload_header();
 
@@ -952,14 +1344,14 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
 
        $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
        $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
 
        $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
        $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
-
-       $callback = "type_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">
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <?php wp_nonce_field('media-form'); ?>
 ?>
 
 <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">
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
 <?php wp_nonce_field('media-form'); ?>
-<h3><?php _e('From Computer'); ?></h3>
+
+<h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3>
+
 <?php media_upload_form( $errors ); ?>
 
 <script type="text/javascript">
 <?php media_upload_form( $errors ); ?>
 
 <script type="text/javascript">
@@ -973,18 +1365,49 @@ jQuery(function($){
 });
 -->
 </script>
 });
 -->
 </script>
-<?php if ( $id && !is_wp_error($id) ) : ?>
 <div id="media-items">
 <div id="media-items">
-<?php echo get_media_items( $id, $errors ); ?>
+<?php
+if ( $id ) {
+       if ( !is_wp_error($id) ) {
+               echo get_media_items( $id, $errors );
+       } else {
+               echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
+               exit;
+       }
+}
+?>
 </div>
 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
 </div>
 <input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
+<?php
+}
 
 
-<?php elseif ( is_callable($callback) ) : ?>
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $type
+ * @param unknown_type $errors
+ * @param unknown_type $id
+ */
+function media_upload_type_url_form($type = 'file', $errors = null, $id = null) {
+       media_upload_header();
 
 
-<div class="media-blank">
-<p style="text-align:center"><?php _e('&mdash; OR &mdash;'); ?></p>
-<h3><?php _e('From URL'); ?></h3>
-</div>
+       $post_id = intval($_REQUEST['post_id']);
+
+       $form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
+       $form_action_url = apply_filters('media_upload_form_url', $form_action_url, $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">
+<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
+<?php wp_nonce_field('media-form'); ?>
+
+<?php if ( is_callable($callback) ) { ?>
+
+<h3 class="media-title"><?php _e('Add media file from URL'); ?></h3>
 
 <script type="text/javascript">
 //<![CDATA[
 
 <script type="text/javascript">
 //<![CDATA[
@@ -1066,12 +1489,20 @@ var addExtImage = {
 <?php echo call_user_func($callback); ?>
 </div>
 </div>
 <?php echo call_user_func($callback); ?>
 </div>
 </div>
-<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
 </form>
 <?php
 </form>
 <?php
-       endif;
+       } else {
+               wp_die( __('Unknown action.') );
+       }
 }
 
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $errors
+ */
 function media_upload_gallery_form($errors) {
        global $redir_tab;
 
 function media_upload_gallery_form($errors) {
        global $redir_tab;
 
@@ -1097,7 +1528,7 @@ jQuery(function($){
 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
 <?php wp_nonce_field('media-form'); ?>
 <?php //media_upload_form( $errors ); ?>
 <form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($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">
+<table class="widefat" cellspacing="0">
 <thead><tr>
 <th><?php _e('Media'); ?></th>
 <th class="order-head"><?php _e('Order'); ?></th>
 <thead><tr>
 <th><?php _e('Media'); ?></th>
 <th class="order-head"><?php _e('Order'); ?></th>
@@ -1106,17 +1537,99 @@ jQuery(function($){
 <div id="media-items">
 <?php echo get_media_items($post_id, $errors); ?>
 </div>
 <div id="media-items">
 <?php echo get_media_items($post_id, $errors); ?>
 </div>
+
 <p class="ml-submit">
 <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 insert-gallery" name="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery into post' ) ); ?>" />
+<input type="submit" class="button savebutton" style="display:none;" name="save" id="save-all" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
 <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'] ); ?>" />
 </p>
 <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'] ); ?>" />
 </p>
+
+<div id="gallery-settings" style="display:none;">
+<div class="title"><?php _e('Gallery Settings'); ?></div>
+<table id="basic" class="describe"><tbody>
+       <tr>
+       <th scope="row" class="label">
+               <label>
+               <span class="alignleft"><?php _e('Link thumbnails to:'); ?></span>
+               </label>
+       </th>
+       <td class="field">
+               <input type="radio" name="linkto" id="linkto-file" value="file" />
+               <label for="linkto-file" class="radio"><?php _e('Image File'); ?></label>
+
+               <input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" />
+               <label for="linkto-post" class="radio"><?php _e('Attachment Page'); ?></label>
+       </td>
+       </tr>
+
+       <tr>
+       <th scope="row" class="label">
+               <label>
+               <span class="alignleft"><?php _e('Order images by:'); ?></span>
+               </label>
+       </th>
+       <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="ID"><?php _e('Date/Time'); ?></option>
+               </select>
+       </td>
+       </tr>
+
+       <tr>
+       <th scope="row" class="label">
+               <label>
+               <span class="alignleft"><?php _e('Order:'); ?></span>
+               </label>
+       </th>
+       <td class="field">
+               <input type="radio" checked="checked" name="order" id="order-asc" value="asc" />
+               <label for="order-asc" class="radio"><?php _e('Ascending'); ?></label>
+
+               <input type="radio" name="order" id="order-desc" value="desc" />
+               <label for="order-desc" class="radio"><?php _e('Descending'); ?></label>
+       </td>
+       </tr>
+
+       <tr>
+       <th scope="row" class="label">
+               <label>
+               <span class="alignleft"><?php _e('Gallery columns:'); ?></span>
+               </label>
+       </th>
+       <td class="field">
+               <select id="columns" name="columns">
+                       <option value="2"><?php _e('2'); ?></option>
+                       <option value="3" selected="selected"><?php _e('3'); ?></option>
+                       <option value="4"><?php _e('4'); ?></option>
+                       <option value="5"><?php _e('5'); ?></option>
+                       <option value="6"><?php _e('6'); ?></option>
+                       <option value="7"><?php _e('7'); ?></option>
+                       <option value="8"><?php _e('8'); ?></option>
+                       <option value="9"><?php _e('9'); ?></option>
+               </select>
+       </td>
+       </tr>
+</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' ) ); ?>" />
+</p>
+</div>
 </form>
 <?php
 }
 
 </form>
 <?php
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $errors
+ */
 function media_upload_library_form($errors) {
        global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
 
 function media_upload_library_form($errors) {
        global $wpdb, $wp_query, $wp_locale, $type, $tab, $post_mime_types;
 
@@ -1126,7 +1639,7 @@ function media_upload_library_form($errors) {
 
        $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id");
 
 
        $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id");
 
-       $_GET['paged'] = intval($_GET['paged']);
+       $_GET['paged'] = isset( $_GET['paged'] ) ? intval($_GET['paged']) : 0;
        if ( $_GET['paged'] < 1 )
                $_GET['paged'] = 1;
        $start = ( $_GET['paged'] - 1 ) * 10;
        if ( $_GET['paged'] < 1 )
                $_GET['paged'] = 1;
        $start = ( $_GET['paged'] - 1 ) * 10;
@@ -1144,11 +1657,11 @@ function media_upload_library_form($errors) {
 <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_id" value="<?php echo (int) $post_id; ?>" />
 <input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />
 
-<div id="search-filter">
-       <label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
+<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" />
        <input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
-</div>
+</p>
 
 <ul class="subsubsub">
 <?php
 
 <ul class="subsubsub">
 <?php
@@ -1188,6 +1701,8 @@ unset($type_links);
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'paged', '%#%' ),
        'format' => '',
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'paged', '%#%' ),
        'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
        'total' => ceil($wp_query->found_posts / 10),
        'current' => $_GET['paged']
 ));
        'total' => ceil($wp_query->found_posts / 10),
        'current' => $_GET['paged']
 ));
@@ -1196,7 +1711,7 @@ if ( $page_links )
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
        echo "<div class='tablenav-pages'>$page_links</div>";
 ?>
 
-<div class="alignleft">
+<div class="alignleft actions">
 <?php
 
 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
 <?php
 
 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
@@ -1263,7 +1778,14 @@ jQuery(function($){
 <?php
 }
 
 <?php
 }
 
-function type_form_image() {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
+function type_url_form_image() {
 
        if ( apply_filters( 'disable_captions', '' ) ) {
                $alt = __('Alternate Text');
 
        if ( apply_filters( 'disable_captions', '' ) ) {
                $alt = __('Alternate Text');
@@ -1273,11 +1795,15 @@ function type_form_image() {
                $alt_help = __('Also used as alternate text for the image');
        }
 
                $alt_help = __('Also used as alternate text for the image');
        }
 
+       $default_align = get_option('image_default_align');
+       if ( empty($default_align) )
+               $default_align = 'none';
+
        return '
        <table class="describe"><tbody>
                <tr>
                        <th valign="top" scope="row" class="label" style="width:120px;">
        return '
        <table class="describe"><tbody>
                <tr>
                        <th valign="top" scope="row" class="label" style="width:120px;">
-                               <span class="alignleft"><label for="src">' . __('Source') . '</label></span>
+                               <span class="alignleft"><label for="src">' . __('Image URL') . '</label></span>
                                <span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
                        </th>
                        <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
                                <span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
                        </th>
                        <td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()" /></td>
@@ -1302,20 +1828,20 @@ function type_form_image() {
                <tr class="align">
                        <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
                        <td class="field">
                <tr class="align">
                        <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
                        <td class="field">
-                               <input name="align" id="align-none" value="alignnone" onclick="addExtImage.align=this.value" type="radio" checked="checked" />
+                               <input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' />
                                <label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
                                <label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
-                               <input name="align" id="align-left" value="alignleft" onclick="addExtImage.align=this.value" type="radio" />
+                               <input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'left' ? ' checked="checked"' : '').' />
                                <label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
                                <label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
-                               <input name="align" id="align-center" value="aligncenter" onclick="addExtImage.align=this.value" type="radio" />
+                               <input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'center' ? ' checked="checked"' : '').' />
                                <label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
                                <label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
-                               <input name="align" id="align-right" value="alignright" onclick="addExtImage.align=this.value" type="radio" />
+                               <input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'right' ? ' checked="checked"' : '').' />
                                <label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
                        </td>
                </tr>
 
                <tr>
                        <th valign="top" scope="row" class="label">
                                <label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
                        </td>
                </tr>
 
                <tr>
                        <th valign="top" scope="row" class="label">
-                               <span class="alignleft"><label for="url">' . __('Link URL') . '</label></span>
+                               <span class="alignleft"><label for="url">' . __('Link Image To:') . '</label></span>
                        </th>
                        <td class="field"><input id="url" name="url" value="" type="text" /><br />
 
                        </th>
                        <td class="field"><input id="url" name="url" value="" type="text" /><br />
 
@@ -1335,7 +1861,14 @@ function type_form_image() {
 
 }
 
 
 }
 
-function type_form_audio() {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
+function type_url_form_audio() {
        return '
        <table class="describe"><tbody>
                <tr>
        return '
        <table class="describe"><tbody>
                <tr>
@@ -1363,7 +1896,14 @@ function type_form_audio() {
 ';
 }
 
 ';
 }
 
-function type_form_video() {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
+function type_url_form_video() {
        return '
        <table class="describe"><tbody>
                <tr>
        return '
        <table class="describe"><tbody>
                <tr>
@@ -1391,7 +1931,14 @@ function type_form_video() {
 ';
 }
 
 ';
 }
 
-function type_form_file() {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
+function type_url_form_file() {
        return '
        <table class="describe"><tbody>
                <tr>
        return '
        <table class="describe"><tbody>
                <tr>
@@ -1419,43 +1966,69 @@ function type_form_file() {
 ';
 }
 
 ';
 }
 
-// support a GET parameter for disabling the flash uploader
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Support a GET parameter for disabling the flash uploader.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $flash
+ * @return unknown
+ */
 function media_upload_use_flash($flash) {
 function media_upload_use_flash($flash) {
-        if ( array_key_exists('flash', $_REQUEST) )
-                $flash = !empty($_REQUEST['flash']);
-        return $flash;
+       if ( array_key_exists('flash', $_REQUEST) )
+               $flash = !empty($_REQUEST['flash']);
+       return $flash;
 }
 
 add_filter('flash_uploader', 'media_upload_use_flash');
 
 }
 
 add_filter('flash_uploader', 'media_upload_use_flash');
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function media_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)) );
-        echo '</p>';
+       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)) );
+       echo '</p>';
 }
 
 }
 
-add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
-
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function media_upload_html_bypass() {
 function media_upload_html_bypass() {
-        echo '<p class="upload-html-bypass">';
-        if ( array_key_exists('flash', $_REQUEST) )
-                // 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 '<p class="upload-html-bypass">';
+       if ( array_key_exists('flash', $_REQUEST) )
+               // 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>';
 }
 
 add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
 add_action('post-html-upload-ui', 'media_upload_html_bypass');
 
 }
 
 add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
 add_action('post-html-upload-ui', 'media_upload_html_bypass');
 
-// make sure the GET parameter sticks when we submit a form
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Make sure the GET parameter sticks when we submit a form.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $url
+ * @return unknown
+ */
 function media_upload_bypass_url($url) {
 function media_upload_bypass_url($url) {
-        if ( array_key_exists('flash', $_REQUEST) )
-                $url = add_query_arg('flash', intval($_REQUEST['flash']));
-        return $url;
+       if ( array_key_exists('flash', $_REQUEST) )
+               $url = add_query_arg('flash', intval($_REQUEST['flash']));
+       return $url;
 }
 
 add_filter('media_upload_form_url', 'media_upload_bypass_url');
 }
 
 add_filter('media_upload_form_url', 'media_upload_bypass_url');
index 4ee545639fff8ed8779a57a7eb8ec9d6051a278e..ffb849704d7bbeaa94e5bf88a8e0984f8f2ca6e0 100644 (file)
@@ -1,12 +1,32 @@
 <?php
 <?php
+/**
+ * Misc WordPress Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function got_mod_rewrite() {
        $got_rewrite = apache_mod_loaded('mod_rewrite', true);
        return apply_filters('got_rewrite', $got_rewrite);
 }
 
 function got_mod_rewrite() {
        $got_rewrite = apache_mod_loaded('mod_rewrite', true);
        return apply_filters('got_rewrite', $got_rewrite);
 }
 
-// Returns an array of strings from a file (.htaccess ) from between BEGIN
-// and END markers.
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $filename
+ * @param unknown_type $marker
+ * @return array An array of strings from a file (.htaccess ) from between BEGIN and END markers.
+ */
 function extract_from_markers( $filename, $marker ) {
        $result = array ();
 
 function extract_from_markers( $filename, $marker ) {
        $result = array ();
 
@@ -30,10 +50,20 @@ function extract_from_markers( $filename, $marker ) {
        return $result;
 }
 
        return $result;
 }
 
-// Inserts an array of strings into a file (.htaccess ), placing it between
-// BEGIN and END markers.  Replaces existing marked info.  Retains surrounding
-// data.  Creates file if none exists.
-// Returns true on write success, false on failure.
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Inserts an array of strings into a file (.htaccess ), placing it between
+ * BEGIN and END markers. Replaces existing marked info. Retains surrounding
+ * data. Creates file if none exists.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $filename
+ * @param unknown_type $marker
+ * @param unknown_type $insertion
+ * @return bool True on write success, false on failure.
+ */
 function insert_with_markers( $filename, $marker, $insertion ) {
        if (!file_exists( $filename ) || is_writeable( $filename ) ) {
                if (!file_exists( $filename ) ) {
 function insert_with_markers( $filename, $marker, $insertion ) {
        if (!file_exists( $filename ) || is_writeable( $filename ) ) {
                if (!file_exists( $filename ) ) {
@@ -82,9 +112,11 @@ function insert_with_markers( $filename, $marker, $insertion ) {
 /**
  * Updates the htaccess file with the current rules if it is writable.
  *
 /**
  * Updates the htaccess file with the current rules if it is writable.
  *
- * Always writes to the file if it exists and is writable to ensure that we blank out old rules.
+ * Always writes to the file if it exists and is writable to ensure that we
+ * blank out old rules.
+ *
+ * @since unknown
  */
  */
-
 function save_mod_rewrite_rules() {
        global $wp_rewrite;
 
 function save_mod_rewrite_rules() {
        global $wp_rewrite;
 
@@ -103,6 +135,13 @@ function save_mod_rewrite_rules() {
        return false;
 }
 
        return false;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $file
+ */
 function update_recently_edited( $file ) {
        $oldfiles = (array ) get_option( 'recently_edited' );
        if ( $oldfiles ) {
 function update_recently_edited( $file ) {
        $oldfiles = (array ) get_option( 'recently_edited' );
        if ( $oldfiles ) {
@@ -118,7 +157,14 @@ function update_recently_edited( $file ) {
        update_option( 'recently_edited', $oldfiles );
 }
 
        update_option( 'recently_edited', $oldfiles );
 }
 
-// If siteurl or home changed, flush rewrite rules.
+/**
+ * If siteurl or home changed, flush rewrite rules.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $old_value
+ * @param unknown_type $value
+ */
 function update_home_siteurl( $old_value, $value ) {
        global $wp_rewrite;
 
 function update_home_siteurl( $old_value, $value ) {
        global $wp_rewrite;
 
@@ -132,6 +178,14 @@ function update_home_siteurl( $old_value, $value ) {
 add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
 add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
 
 add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
 add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $url
+ * @return unknown
+ */
 function url_shorten( $url ) {
        $short_url = str_replace( 'http://', '', stripslashes( $url ));
        $short_url = str_replace( 'www.', '', $short_url );
 function url_shorten( $url ) {
        $short_url = str_replace( 'http://', '', stripslashes( $url ));
        $short_url = str_replace( 'www.', '', $short_url );
@@ -142,6 +196,13 @@ function url_shorten( $url ) {
        return $short_url;
 }
 
        return $short_url;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $vars
+ */
 function wp_reset_vars( $vars ) {
        for ( $i=0; $i<count( $vars ); $i += 1 ) {
                $var = $vars[$i];
 function wp_reset_vars( $vars ) {
        for ( $i=0; $i<count( $vars ); $i += 1 ) {
                $var = $vars[$i];
@@ -160,4 +221,21 @@ function wp_reset_vars( $vars ) {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $message
+ */
+function show_message($message) {
+       if( is_wp_error($message) ){
+               if( $message->get_error_data() )
+                       $message = $message->get_error_message() . ': ' . $message->get_error_data();
+               else
+                       $message = $message->get_error_message();
+       }
+       echo "<p>$message</p>\n";
+}
+
 ?>
 ?>
diff --git a/wp-admin/includes/plugin-install.php b/wp-admin/includes/plugin-install.php
new file mode 100644 (file)
index 0000000..57e24bd
--- /dev/null
@@ -0,0 +1,894 @@
+<?php
+/**
+ * WordPress Plugin Install Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Retrieve plugin installer pages from WordPress Plugins API.
+ *
+ * It is possible for a plugin to override the Plugin API result with three
+ * filters. Assume this is for plugins, which can extend on the Plugin Info to
+ * offer more choices. This is very powerful and must be used with care, when
+ * overridding the filters.
+ *
+ * The first filter, 'plugins_api_args', is for the args and gives the action as
+ * the second parameter. The hook for 'plugins_api_args' must ensure that an
+ * object is returned.
+ *
+ * The second filter, 'plugins_api', is the result that would be returned.
+ *
+ * @since 2.7.0
+ *
+ * @param string $action
+ * @param array|object $args Optional. Arguments to serialize for the Plugin Info API.
+ * @return mixed
+ */
+function plugins_api($action, $args = null) {
+
+       if( is_array($args) )
+               $args = (object)$args;
+
+       if ( !isset($args->per_page) )
+               $args->per_page = 24;
+
+       $args = apply_filters('plugins_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
+       $res = apply_filters('plugins_api', false, $action, $args); //NOTE: Allows a plugin to completely override the builtin WordPress.org API.
+
+       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() );
+               } else {
+                       $res = unserialize($request['body']);
+                       if ( ! $res )
+                               $res = new WP_Error('plugins_api_failed', __('An unknown error occured'), $request['body']);
+               }
+       }
+
+       return apply_filters('plugins_api_result', $res, $action, $args);
+}
+
+/**
+ * Retrieve popular WordPress plugin tags.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args
+ * @return array
+ */
+function install_popular_tags( $args = array() ) {
+       if ( ! ($cache = wp_cache_get('popular_tags', 'api')) && ! ($cache = get_option('wporg_popular_tags')) )
+               add_option('wporg_popular_tags', array(), '', 'no'); ///No autoload.
+
+       if ( $cache && $cache->timeout + 3 * 60 * 60 > time() )
+               return $cache->cached;
+
+       $tags = plugins_api('hot_tags', $args);
+
+       if ( is_wp_error($tags) )
+               return $tags;
+
+       $cache = (object) array('timeout' => time(), 'cached' => $tags);
+
+       update_option('wporg_popular_tags', $cache);
+       wp_cache_set('popular_tags', $cache, 'api');
+
+       return $tags;
+}
+add_action('install_plugins_search', 'install_search', 10, 1);
+
+/**
+ * Display search results and display as tag cloud.
+ *
+ * @since 2.7.0
+ *
+ * @param string $page
+ */
+function install_search($page) {
+       $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
+       $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
+
+       $args = array();
+
+       switch( $type ){
+               case 'tag':
+                       $args['tag'] = sanitize_title_with_dashes($term);
+                       break;
+               case 'term':
+                       $args['search'] = $term;
+                       break;
+               case 'author':
+                       $args['author'] = $term;
+                       break;
+       }
+
+       $args['page'] = $page;
+
+       $api = plugins_api('query_plugins', $args);
+
+       if ( is_wp_error($api) )
+               wp_die($api);
+
+       add_action('install_plugins_table_header', 'install_search_form');
+
+       display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
+
+       return;
+}
+
+add_action('install_plugins_dashboard', 'install_dashboard');
+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>
+       <?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>
+
+       <h4><?php _e('Popular tags') ?></h4>
+       <p><?php _e('You may also browse based on the most popular tags in the Plugin Directory:') ?></p>
+       <?php
+
+       $api_tags = install_popular_tags();
+
+       //Set up the tags in a way which can be interprated by wp_generate_tag_cloud()
+       $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'])) ),
+                                                               'name' => $tag['name'],
+                                                               'id' => sanitize_title_with_dashes($tag['name']),
+                                                               'count' => $tag['count'] );
+       echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) );
+}
+
+/**
+ * Display search form for searching plugins.
+ *
+ * @since 2.7.0
+ */
+function install_search_form(){
+       $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') ?>">
+               <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>
+               </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" />
+       </form><?php
+}
+
+add_action('install_plugins_featured', 'install_featured', 10, 1);
+/**
+ * Display featured plugins.
+ *
+ * @since 2.7.0
+ *
+ * @param string $page
+ */
+function install_featured($page = 1) {
+       $args = array('browse' => 'featured', 'page' => $page);
+       $api = plugins_api('query_plugins', $args);
+       if ( is_wp_error($api) )
+               wp_die($api);
+       display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
+}
+
+add_action('install_plugins_popular', 'install_popular', 10, 1);
+/**
+ * Display popular plugins.
+ *
+ * @since 2.7.0
+ *
+ * @param string $page
+ */
+function install_popular($page = 1) {
+       $args = array('browse' => 'popular', 'page' => $page);
+       $api = plugins_api('query_plugins', $args);
+       display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
+}
+
+add_action('install_plugins_new', 'install_new', 10, 1);
+/**
+ * Display new plugins.
+ *
+ * @since 2.7.0
+ *
+ * @param string $page
+ */
+function install_new($page = 1) {
+       $args = array('browse' => 'new', 'page' => $page);
+       $api = plugins_api('query_plugins', $args);
+       if ( is_wp_error($api) )
+               wp_die($api);
+       display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
+}
+add_action('install_plugins_updated', 'install_updated', 10, 1);
+
+
+/**
+ * Display recently updated plugins.
+ *
+ * @since 2.7.0
+ *
+ * @param string $page
+ */
+function install_updated($page = 1) {
+       $args = array('browse' => 'updated', 'page' => $page);
+       $api = plugins_api('query_plugins', $args);
+       display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']);
+}
+
+/**
+ * Display plugin content based on plugin list.
+ *
+ * @since 2.7.0
+ *
+ * @param array $plugins List of plugins.
+ * @param string $page
+ * @param int $totalpages Number of pages.
+ */
+function display_plugins_table($plugins, $page = 1, $totalpages = 1){
+       $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
+       $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
+
+       $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());
+
+?>
+       <div class="tablenav">
+               <div class="alignleft actions">
+               <?php do_action('install_plugins_table_header'); ?>
+               </div>
+               <?php
+                       $url = clean_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>";
+?>
+               <br class="clear" />
+       </div>
+       <table class="widefat" id="install-plugins" cellspacing="0">
+               <thead>
+                       <tr>
+                               <th scope="col" class="name"><?php _e('Name'); ?></th>
+                               <th scope="col" class="num"><?php _e('Version'); ?></th>
+                               <th scope="col" class="num"><?php _e('Rating'); ?></th>
+                               <th scope="col" class="desc"><?php _e('Description'); ?></th>
+                               <th scope="col" class="action-links"><?php _e('Actions'); ?></th>
+                       </tr>
+               </thead>
+
+               <tfoot>
+                       <tr>
+                               <th scope="col" class="name"><?php _e('Name'); ?></th>
+                               <th scope="col" class="num"><?php _e('Version'); ?></th>
+                               <th scope="col" class="num"><?php _e('Rating'); ?></th>
+                               <th scope="col" class="desc"><?php _e('Description'); ?></th>
+                               <th scope="col" class="action-links"><?php _e('Actions'); ?></th>
+                       </tr>
+               </tfoot>
+
+               <tbody class="plugins">
+               <?php
+                       if( empty($plugins) )
+                               echo '<tr><td colspan="5">', __('No plugins match your request.'), '</td></tr>';
+
+                       foreach( (array) $plugins as $plugin ){
+                               if ( is_object($plugin) )
+                                       $plugin = (array) $plugin;
+
+                               $title = wp_kses($plugin['name'], $plugins_allowedtags);
+                               $description = wp_kses($plugin['description'], $plugins_allowedtags);
+                               $version = wp_kses($plugin['version'], $plugins_allowedtags);
+
+                               $name = strip_tags($title . ' ' . $version);
+
+                               $author = $plugin['author'];
+                               if( ! empty($plugin['author']) )
+                                       $author = ' <cite>' . sprintf( __('By %s'), $author ) . '.</cite>';
+
+                               $author = wp_kses($author, $plugins_allowedtags);
+
+                               if( isset($plugin['homepage']) )
+                                       $title = '<a target="_blank" href="' . attribute_escape($plugin['homepage']) . '">' . $title . '</a>';
+
+                               $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>';
+
+                               $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
+                       ?>
+                       <tr>
+                               <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 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>
+                               </td>
+                               <td class="desc"><p><?php echo $description, $author; ?></p></td>
+                               <td class="action-links"><?php if ( !empty($action_links) )     echo implode(' | ', $action_links); ?></td>
+                       </tr>
+                       <?php
+                       }
+                       ?>
+               </tbody>
+       </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_plugins_pre_plugin-information', 'install_plugin_information');
+
+/**
+ * Display plugin information in dialog box form.
+ *
+ * @since 2.7.0
+ */
+function install_plugin_information() {
+       global $tab;
+
+       $api = plugins_api('plugin_information', array('slug' => stripslashes( $_REQUEST['plugin'] ) ));
+
+       if ( is_wp_error($api) )
+               wp_die($api);
+
+       $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(),
+                                                               '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()));
+       //Sanitize HTML
+       foreach ( (array)$api->sections as $section_name => $content )
+               $api->sections[$section_name] = wp_kses($content, $plugins_allowedtags);
+       foreach ( array('version', 'author', 'requires', 'tested', 'homepage', 'downloaded', 'slug') as $key )
+               $api->$key = wp_kses($api->$key, $plugins_allowedtags);
+
+       $section = isset($_REQUEST['section']) ? stripslashes( $_REQUEST['section'] ) : 'description'; //Default to the Description tab, Do not translate, API returns English.
+       if( empty($section) || ! isset($api->sections[ $section ]) )
+               $section = array_shift( $section_titles = array_keys((array)$api->sections) );
+
+       iframe_header( __('Plugin Install') );
+       echo "<div id='$tab-header'>\n";
+       echo "<ul id='sidemenu'>\n";
+       foreach ( (array)$api->sections as $section_name => $content ) {
+
+               $title = $section_name;
+               $title = ucwords(str_replace('_', ' ', $title));
+
+               $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));
+               echo "\t<li><a name='$san_title' target='' href='$href'$class>$title</a></li>\n";
+       }
+       echo "</ul>\n";
+       echo "</div>\n";
+       ?>
+       <div class="alignright fyi">
+               <?php if ( ! empty($api->download_link) ) : ?>
+               <p class="action-button">
+               <?php
+                       //Default to a "new" plugin
+                       $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 ( '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'], '>') ){
+                                               $type = 'latest_installed';
+                                       } elseif ( version_compare($api->version, $installed_plugin[ $key ]['Version'], '<') ) {
+                                               $type = 'newer_installed';
+                                               $newer_version = $installed_plugin[ $key ]['Version'];
+                                       } else {
+                                               //If the above update check failed, Then that probably means that the update checker has out-of-date information, force a refresh
+                                               delete_option('update_plugins');
+                                               $update_file = $api->slug . '/' . $key; //This code branch only deals with a plugin which is in a folder the same name as its slug, Doesnt support plugins which have 'non-standard' names
+                                               $type = 'update_available';
+                                       }
+                               }
+                       }
+
+                       switch ( $type ) :
+                               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
+                                       endif;
+                               break;
+                               case 'update_available':
+                                       if ( current_user_can('update_plugins') ) :
+                                               ?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file) ?>" target="_parent"><?php _e('Install Update Now') ?></a><?php
+                                       endif;
+                               break;
+                               case 'newer_installed':
+                                       if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
+                                       ?><a><?php printf(__('Newer Version (%s) Installed'), $newer_version) ?></a><?php
+                                       endif;
+                               break;
+                               case 'latest_installed':
+                                       if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) :
+                                       ?><a><?php _e('Latest Version Installed') ?></a><?php
+                                       endif;
+                               break;
+                       endswitch; ?>
+               </p>
+               <?php endif; ?>
+               <h2 class="mainheader"><?php _e('FYI') ?></h2>
+               <ul>
+<?php if ( ! empty($api->version) ) : ?>
+                       <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li>
+<?php endif; if ( ! empty($api->author) ) : ?>
+                       <li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li>
+<?php endif; if ( ! empty($api->last_updated) ) : ?>
+                       <li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php
+                                                       printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li>
+<?php endif; if ( ! empty($api->requires) ) : ?>
+                       <li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li>
+<?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>
+<?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) ) : ?>
+                       <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage  &#187;') ?></a></li>
+<?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 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>
+       </div>
+       <div id="section-holder" class="wrap">
+       <?php
+               if ( version_compare($GLOBALS['wp_version'], $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>';
+               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>';
+               foreach ( (array)$api->sections as $section_name => $content ) {
+                       $title = $section_name;
+                       $title[0] = strtoupper($title[0]);
+                       $title = str_replace('_', ' ', $title);
+
+                       $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));
+
+                       $display = ( $section_name == $section ) ? 'block' : 'none';
+
+                       echo "\t<div id='section-{$san_title}' class='section' style='display: {$display};'>\n";
+                       echo "\t\t<h2 class='long-header'>$title</h2>";
+                       echo $content;
+                       echo "\t</div>\n";
+               }
+       echo "</div>\n";
+
+       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 aca5242003d5f5011fb204a52753820c57154bd1..0210c5efea1a39722407927f5d6f7166bac705ac 100644 (file)
 <?php
 <?php
-
-function get_plugin_data( $plugin_file ) {
-       $plugin_data = implode( '', file( $plugin_file ));
-       preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name );
-       preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri );
+/**
+ * WordPress Plugin Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Parse the plugin contents to retrieve plugin's metadata.
+ *
+ * The metadata of the plugin's data searches for the following in the plugin's
+ * header. All plugin data must be on its own line. For plugin description, it
+ * must not have any newlines or only parts of the description will be displayed
+ * and the same goes for the plugin data. The below is formatted for printing.
+ *
+ * <code>
+ * /*
+ * Plugin Name: Name of Plugin
+ * Plugin URI: Link to plugin information
+ * Description: Plugin Description
+ * Author: Plugin author's name
+ * Author URI: Link to the author's web site
+ * Version: Must be set in the plugin for WordPress 2.3+
+ * Text Domain: Optional. Unique identifier, should be same as the one used in
+ *             plugin_text_domain()
+ * Domain Path: Optional. Only useful if the translations are located in a
+ *             folder above the plugin's base path. For example, if .mo files are
+ *             located in the locale folder then Domain Path will be "/locale/" and
+ *             must have the first slash. Defaults to the base folder the plugin is
+ *             located in.
+ *  * / # Remove the space to close comment
+ * </code>
+ *
+ * Plugin data returned array contains the following:
+ *             'Name' - Name of the plugin, must be unique.
+ *             'Title' - Title of the plugin and the link to the plugin's web site.
+ *             'Description' - Description of what the plugin does and/or notes
+ *             from the author.
+ *             'Author' - The author's name
+ *             'AuthorURI' - The authors web site address.
+ *             'Version' - The plugin version number.
+ *             'PluginURI' - Plugin web site address.
+ *             'TextDomain' - Plugin's text domain for localization.
+ *             'DomainPath' - Plugin's relative directory path to .mo files.
+ *
+ * Some users have issues with opening large files and manipulating the contents
+ * for want is usually the first 1kiB or 2kiB. This function stops pulling in
+ * the plugin contents when it has all of the required plugin data.
+ *
+ * The first 8kiB of the file will be pulled in and if the plugin data is not
+ * within that first 8kiB, then the plugin author should correct their plugin
+ * and move the plugin data headers to the top.
+ *
+ * The plugin file is assumed to have permissions to allow for scripts to read
+ * the file. This is not checked however and the file is only opened for
+ * reading.
+ *
+ * @link http://trac.wordpress.org/ticket/5651 Previous Optimizations.
+ * @link http://trac.wordpress.org/ticket/7372 Further and better Optimizations.
+ * @since 1.5.0
+ *
+ * @param string $plugin_file Path to the plugin file
+ * @param bool $markup If the returned data should have HTML markup applied
+ * @param bool $translate If the returned data should be translated
+ * @return array See above for description.
+ */
+function get_plugin_data( $plugin_file, $markup = true, $translate = true ) {
+       // We don't need to write to the file, so just open for reading.
+       $fp = fopen($plugin_file, 'r');
+
+       // Pull only the first 8kiB of the file in.
+       $plugin_data = fread( $fp, 8192 );
+
+       // PHP will close file handle, but we are good citizens.
+       fclose($fp);
+
+       preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name );
+       preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri );
+       preg_match( '|Version:(.*)|i', $plugin_data, $version );
        preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
        preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
        preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
        preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
        preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name );
        preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri );
+       preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain );
+       preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path );
 
 
-       if ( preg_match( "|Version:(.*)|i", $plugin_data, $version ))
-               $version = trim( $version[1] );
-       else
-               $version = '';
+       foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) {
+               if ( !empty( ${$field} ) )
+                       ${$field} = trim(${$field}[1]);
+               else
+                       ${$field} = '';
+       }
 
 
-       $description = wptexturize( trim( $description[1] ));
+       $plugin_data = array(
+                               'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description,
+                               'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version,
+                               'TextDomain' => $text_domain, 'DomainPath' => $domain_path
+                               );
+       if ( $markup || $translate )
+               $plugin_data = _get_plugin_data_markup_translate($plugin_data, $markup, $translate);
+       return $plugin_data;
+}
+
+function _get_plugin_data_markup_translate($plugin_data, $markup = true, $translate = true) {
+
+       //Translate fields
+       if( $translate && ! empty($plugin_data['TextDomain']) ) {
+               if( ! empty( $plugin_data['DomainPath'] ) )
+                       load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file). $plugin_data['DomainPath']);
+               else
+                       load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file));
 
 
-       $name = $plugin_name[1];
-       $name = trim( $name );
-       $plugin = $name;
-       if ('' != trim($plugin_uri[1]) && '' != $name ) {
-               $plugin = '<a href="' . trim( $plugin_uri[1] ) . '" title="'.__( 'Visit plugin homepage' ).'">'.$plugin.'</a>';
+               foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field )
+                       $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']);
        }
 
        }
 
-       if ('' == $author_uri[1] ) {
-               $author = trim( $author_name[1] );
-       } else {
-               $author = '<a href="' . trim( $author_uri[1] ) . '" title="'.__( 'Visit author homepage' ).'">' . trim( $author_name[1] ) . '</a>';
+       //Apply Markup
+       if ( $markup ) {
+               if ( ! empty($plugin_data['PluginURI']) && ! empty($plugin_data['Name']) )
+                       $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin homepage' ) . '">' . $plugin_data['Name'] . '</a>';
+               else
+                       $plugin_data['Title'] = $plugin_data['Name'];
+
+               if ( ! empty($plugin_data['AuthorURI']) && ! empty($plugin_data['Author']) )
+                       $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $plugin_data['Author'] . '</a>';
+
+               $plugin_data['Description'] = wptexturize( $plugin_data['Description'] );
+               if( ! empty($plugin_data['Author']) )
+                       $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
        }
 
        }
 
-       return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version);
+       $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+
+       // Sanitize all displayed data
+       $plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
+       $plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
+       $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
+       $plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
+
+       return $plugin_data;
 }
 
 }
 
+/**
+ * Check the plugins directory and retrieve all plugin files with plugin data.
+ *
+ * WordPress only supports plugin files in the base plugins directory
+ * (wp-content/plugins) and in one directory above the plugins directory
+ * (wp-content/plugins/my-plugin). The file it looks for has the plugin data and
+ * must be found in those two locations. It is recommended that do keep your
+ * plugin files in directories.
+ *
+ * The file with the plugin data is the file that will be included and therefore
+ * needs to have the main execution for the plugin. This does not mean
+ * everything must be contained in the file and it is recommended that the file
+ * be split for maintainability. Keep everything in one file for extreme
+ * optimization purposes.
+ *
+ * @since unknown
+ *
+ * @param string $plugin_folder Optional. Relative path to single plugin folder.
+ * @return array Key is the plugin file path and the value is an array of the plugin data.
+ */
 function get_plugins($plugin_folder = '') {
 function get_plugins($plugin_folder = '') {
-       
+
        if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
                $cache_plugins = array();
        if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
                $cache_plugins = array();
-       
+
        if ( isset($cache_plugins[ $plugin_folder ]) )
                return $cache_plugins[ $plugin_folder ];
        if ( isset($cache_plugins[ $plugin_folder ]) )
                return $cache_plugins[ $plugin_folder ];
-       
+
        $wp_plugins = array ();
        $plugin_root = WP_PLUGIN_DIR;
        if( !empty($plugin_folder) )
        $wp_plugins = array ();
        $plugin_root = WP_PLUGIN_DIR;
        if( !empty($plugin_folder) )
@@ -76,7 +205,7 @@ function get_plugins($plugin_folder = '') {
                if ( !is_readable( "$plugin_root/$plugin_file" ) )
                        continue;
 
                if ( !is_readable( "$plugin_root/$plugin_file" ) )
                        continue;
 
-               $plugin_data = get_plugin_data( "$plugin_root/$plugin_file" );
+               $plugin_data = get_plugin_data( "$plugin_root/$plugin_file", false, false ); //Do not apply markup/translate as it'll be cached.
 
                if ( empty ( $plugin_data['Name'] ) )
                        continue;
 
                if ( empty ( $plugin_data['Name'] ) )
                        continue;
@@ -86,39 +215,82 @@ function get_plugins($plugin_folder = '') {
 
        uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
 
 
        uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
 
-       $cache_plugins[ $plugin_folder ] = $wp_plugins; 
-       wp_cache_set('plugins', $cache_plugins, 'plugins'); 
+       $cache_plugins[ $plugin_folder ] = $wp_plugins;
+       wp_cache_set('plugins', $cache_plugins, 'plugins');
 
        return $wp_plugins;
 }
 
 
        return $wp_plugins;
 }
 
-function is_plugin_active($plugin){
+/**
+ * Check whether the plugin is active by checking the active_plugins list.
+ *
+ * @since 2.5.0
+ *
+ * @param string $plugin Base plugin path from plugins directory.
+ * @return bool True, if in the active plugins list. False, not in the list.
+ */
+function is_plugin_active($plugin) {
        return in_array($plugin, get_option('active_plugins'));
 }
 
        return in_array($plugin, get_option('active_plugins'));
 }
 
+/**
+ * Attempts activation of plugin in a "sandbox" and redirects on success.
+ *
+ * A plugin that is already activated will not attempt to be activated again.
+ *
+ * The way it works is by setting the redirection to the error before trying to
+ * include the plugin file. If the plugin fails, then the redirection will not
+ * be overwritten with the success message. Also, the options will not be
+ * updated and the activation hook will not be called on plugin error.
+ *
+ * It should be noted that in no way the below code will actually prevent errors
+ * within the file. The code should not be used elsewhere to replicate the
+ * "sandbox", which uses redirection to work.
+ * {@source 13 1}
+ *
+ * If any errors are found or text is outputted, then it will be captured to
+ * ensure that the success redirection will update the error redirection.
+ *
+ * @since unknown
+ *
+ * @param string $plugin Plugin path to main plugin file with plugin data.
+ * @param string $redirect Optional. URL to redirect to.
+ * @return WP_Error|null WP_Error on invalid file or null on success.
+ */
 function activate_plugin($plugin, $redirect = '') {
 function activate_plugin($plugin, $redirect = '') {
-               $current = get_option('active_plugins');
-               $plugin = trim($plugin);
-
-               $valid = validate_plugin($plugin);
-               if ( is_wp_error($valid) )
-                       return $valid;
-
-               if ( !in_array($plugin, $current) ) {
-                       if ( !empty($redirect) )
-                               wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
-                       ob_start();
-                       @include(WP_PLUGIN_DIR . '/' . $plugin);
-                       $current[] = $plugin;
-                       sort($current);
-                       update_option('active_plugins', $current);
-                       do_action('activate_' . $plugin);
-                       ob_end_clean();
-               }
+       $current = get_option('active_plugins');
+       $plugin = plugin_basename(trim($plugin));
 
 
-               return null;
+       $valid = validate_plugin($plugin);
+       if ( is_wp_error($valid) )
+               return $valid;
+
+       if ( !in_array($plugin, $current) ) {
+               if ( !empty($redirect) )
+                       wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
+               ob_start();
+               @include(WP_PLUGIN_DIR . '/' . $plugin);
+               $current[] = $plugin;
+               sort($current);
+               update_option('active_plugins', $current);
+               do_action('activate_' . $plugin);
+               ob_end_clean();
+       }
+
+       return null;
 }
 
 }
 
+/**
+ * Deactivate a single plugin or multiple plugins.
+ *
+ * The deactivation hook is disabled by the plugin upgrader by using the $silent
+ * parameter.
+ *
+ * @since unknown
+ *
+ * @param string|array $plugins Single plugin or list of plugins to deactivate.
+ * @param bool $silent Optional, default is false. Prevent calling deactivate hook.
+ */
 function deactivate_plugins($plugins, $silent= false) {
        $current = get_option('active_plugins');
 
 function deactivate_plugins($plugins, $silent= false) {
        $current = get_option('active_plugins');
 
@@ -126,6 +298,7 @@ function deactivate_plugins($plugins, $silent= false) {
                $plugins = array($plugins);
 
        foreach ( $plugins as $plugin ) {
                $plugins = array($plugins);
 
        foreach ( $plugins as $plugin ) {
+               $plugin = plugin_basename($plugin);
                if( ! is_plugin_active($plugin) )
                        continue;
                array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
                if( ! is_plugin_active($plugin) )
                        continue;
                array_splice($current, array_search( $plugin, $current), 1 ); // Fixed Array-fu!
@@ -136,6 +309,20 @@ function deactivate_plugins($plugins, $silent= false) {
        update_option('active_plugins', $current);
 }
 
        update_option('active_plugins', $current);
 }
 
+/**
+ * Activate multiple plugins.
+ *
+ * When WP_Error is returned, it does not mean that one of the plugins had
+ * errors. It means that one or more of the plugins file path was invalid.
+ *
+ * The execution will be halted as soon as one of the plugins has an error.
+ *
+ * @since unknown
+ *
+ * @param string|array $plugins
+ * @param string $redirect Redirect to page after successful activation.
+ * @return bool|WP_Error True when finished or WP_Error if there were errors during a plugin activation.
+ */
 function activate_plugins($plugins, $redirect = '') {
        if ( !is_array($plugins) )
                $plugins = array($plugins);
 function activate_plugins($plugins, $redirect = '') {
        if ( !is_array($plugins) )
                $plugins = array($plugins);
@@ -155,6 +342,18 @@ function activate_plugins($plugins, $redirect = '') {
        return true;
 }
 
        return true;
 }
 
+/**
+ * Remove directory and files of a plugin for a single or list of plugin(s).
+ *
+ * If the plugins parameter list is empty, false will be returned. True when
+ * completed.
+ *
+ * @since unknown
+ *
+ * @param array $plugins List of plugin
+ * @param string $redirect Redirect to page when complete.
+ * @return mixed
+ */
 function delete_plugins($plugins, $redirect = '' ) {
        global $wp_filesystem;
 
 function delete_plugins($plugins, $redirect = '' ) {
        global $wp_filesystem;
 
@@ -206,26 +405,33 @@ function delete_plugins($plugins, $redirect = '' ) {
        $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.'));
        $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.'));
-       
+
        $plugins_dir = trailingslashit( $plugins_dir );
 
        $errors = array();
 
        foreach( $plugins as $plugin_file ) {
        $plugins_dir = trailingslashit( $plugins_dir );
 
        $errors = array();
 
        foreach( $plugins as $plugin_file ) {
+               // Run Uninstall hook
+               if ( is_uninstallable_plugin( $plugin_file ) )
+                       uninstall_plugin($plugin_file);
+
                $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
                // If plugin is in its own directory, recursively delete the directory.
                if ( strpos($plugin_file, '/') && $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_file);
                $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
                // If plugin is in its own directory, recursively delete the directory.
                if ( strpos($plugin_file, '/') && $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_file);
-       
+
                if ( ! $deleted )
                        $errors[] = $plugin_file;
        }
                if ( ! $deleted )
                        $errors[] = $plugin_file;
        }
-       
-       if( ! empty($errors) )
+
+       if ( ! empty($errors) )
                return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
                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');
+
        return true;
 }
 
        return true;
 }
 
@@ -240,7 +446,7 @@ function validate_active_plugins() {
        }
 
        //Invalid is any plugin that is deactivated due to error.
        }
 
        //Invalid is any plugin that is deactivated due to error.
-       $invalid = array(); 
+       $invalid = array();
 
        // If a plugin file does not exist, remove it from the list of active
        // plugins.
 
        // If a plugin file does not exist, remove it from the list of active
        // plugins.
@@ -254,25 +460,109 @@ function validate_active_plugins() {
        return $invalid;
 }
 
        return $invalid;
 }
 
+/**
+ * Validate the plugin path.
+ *
+ * Checks that the file exists and {@link validate_file() is valid file}.
+ *
+ * @since unknown
+ *
+ * @param string $plugin Plugin Path
+ * @return WP_Error|int 0 on success, WP_Error on failure.
+ */
 function validate_plugin($plugin) {
        if ( validate_file($plugin) )
 function validate_plugin($plugin) {
        if ( validate_file($plugin) )
-               return new WP_Error('plugin_invalid', __('Invalid plugin.'));
+               return new WP_Error('plugin_invalid', __('Invalid plugin path.'));
        if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
                return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
 
        return 0;
 }
 
        if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
                return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
 
        return 0;
 }
 
+/**
+ * Whether the plugin can be uninstalled.
+ *
+ * @since 2.7.0
+ *
+ * @param string $plugin Plugin path to check.
+ * @return bool Whether plugin can be uninstalled.
+ */
+function is_uninstallable_plugin($plugin) {
+       $file = plugin_basename($plugin);
+
+       $uninstallable_plugins = (array) get_option('uninstall_plugins');
+       if ( isset( $uninstallable_plugins[$file] ) || file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) )
+               return true;
+
+       return false;
+}
+
+/**
+ * Uninstall a single plugin.
+ *
+ * Calls the uninstall hook, if it is available.
+ *
+ * @since 2.7.0
+ *
+ * @param string $plugin Relative plugin path from Plugin Directory.
+ */
+function uninstall_plugin($plugin) {
+       $file = plugin_basename($plugin);
+
+       $uninstallable_plugins = (array) get_option('uninstall_plugins');
+       if ( file_exists( WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php' ) ) {
+               if ( isset( $uninstallable_plugins[$file] ) ) {
+                       unset($uninstallable_plugins[$file]);
+                       update_option('uninstall_plugins', $uninstallable_plugins);
+               }
+               unset($uninstallable_plugins);
+
+               define('WP_UNINSTALL_PLUGIN', $file);
+               include WP_PLUGIN_DIR . '/' . dirname($file) . '/uninstall.php';
+
+               return true;
+       }
+
+       if ( isset( $uninstallable_plugins[$file] ) ) {
+               $callable = $uninstallable_plugins[$file];
+               unset($uninstallable_plugins[$file]);
+               update_option('uninstall_plugins', $uninstallable_plugins);
+               unset($uninstallable_plugins);
+
+               include WP_PLUGIN_DIR . '/' . $file;
+
+               add_action( 'uninstall_' . $file, $callable );
+               do_action( 'uninstall_' . $file );
+       }
+}
+
 //
 // Menu
 //
 
 //
 // Menu
 //
 
-function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+function add_menu_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '' ) {
        global $menu, $admin_page_hooks;
 
        $file = plugin_basename( $file );
 
        global $menu, $admin_page_hooks;
 
        $file = plugin_basename( $file );
 
-       $menu[] = array ( $menu_title, $access_level, $file, $page_title );
+       $admin_page_hooks[$file] = sanitize_title( $menu_title );
+
+       $hookname = get_plugin_page_hookname( $file, '' );
+       if (!empty ( $function ) && !empty ( $hookname ))
+               add_action( $hookname, $function );
+
+       if ( empty($icon_url) )
+               $icon_url = 'images/generic.png';
+
+       $menu[] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
+
+       return $hookname;
+}
+
+function add_object_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
+       global $menu, $admin_page_hooks, $_wp_last_object_menu;
+
+       $file = plugin_basename( $file );
 
        $admin_page_hooks[$file] = sanitize_title( $menu_title );
 
 
        $admin_page_hooks[$file] = sanitize_title( $menu_title );
 
@@ -280,6 +570,34 @@ function add_menu_page( $page_title, $menu_title, $access_level, $file, $functio
        if (!empty ( $function ) && !empty ( $hookname ))
                add_action( $hookname, $function );
 
        if (!empty ( $function ) && !empty ( $hookname ))
                add_action( $hookname, $function );
 
+       if ( empty($icon_url) )
+               $icon_url = 'images/generic.png';
+
+       $_wp_last_object_menu++;
+
+       $menu[$_wp_last_object_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
+
+       return $hookname;
+}
+
+function add_utility_page( $page_title, $menu_title, $access_level, $file, $function = '', $icon_url = '') {
+       global $menu, $admin_page_hooks, $_wp_last_utility_menu;
+
+       $file = plugin_basename( $file );
+
+       $admin_page_hooks[$file] = sanitize_title( $menu_title );
+
+       $hookname = get_plugin_page_hookname( $file, '' );
+       if (!empty ( $function ) && !empty ( $hookname ))
+               add_action( $hookname, $function );
+
+       if ( empty($icon_url) )
+               $icon_url = 'images/generic.png';
+
+       $_wp_last_utility_menu++;
+
+       $menu[$_wp_last_utility_menu] = array ( $menu_title, $access_level, $file, $page_title, 'menu-top ' . $hookname, $hookname, $icon_url );
+
        return $hookname;
 }
 
        return $hookname;
 }
 
@@ -320,8 +638,18 @@ function add_submenu_page( $parent, $page_title, $menu_title, $access_level, $fi
        return $hookname;
 }
 
        return $hookname;
 }
 
+/**
+ * Add sub menu page to the tools main menu.
+ *
+ * @param string $page_title
+ * @param unknown_type $menu_title
+ * @param unknown_type $access_level
+ * @param unknown_type $file
+ * @param unknown_type $function
+ * @return unknown
+ */
 function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
 function add_management_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
-       return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function );
+       return add_submenu_page( 'tools.php', $page_title, $menu_title, $access_level, $file, $function );
 }
 
 function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
 }
 
 function add_options_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
@@ -340,11 +668,35 @@ function add_users_page( $page_title, $menu_title, $access_level, $file, $functi
        return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function );
 }
 
        return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function );
 }
 
+function add_dashboard_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+       return add_submenu_page( 'index.php', $page_title, $menu_title, $access_level, $file, $function );
+}
+
+function add_posts_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+       return add_submenu_page( 'edit.php', $page_title, $menu_title, $access_level, $file, $function );
+}
+
+function add_media_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+       return add_submenu_page( 'upload.php', $page_title, $menu_title, $access_level, $file, $function );
+}
+
+function add_links_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+       return add_submenu_page( 'link-manager.php', $page_title, $menu_title, $access_level, $file, $function );
+}
+
+function add_pages_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+       return add_submenu_page( 'edit-pages.php', $page_title, $menu_title, $access_level, $file, $function );
+}
+
+function add_comments_page( $page_title, $menu_title, $access_level, $file, $function = '' ) {
+       return add_submenu_page( 'edit-comments.php', $page_title, $menu_title, $access_level, $file, $function );
+}
+
 //
 // Pluggable Menu Support -- Private
 //
 
 //
 // Pluggable Menu Support -- Private
 //
 
-function get_admin_page_parent() {
+function get_admin_page_parent( $parent = '' ) {
        global $parent_file;
        global $menu;
        global $submenu;
        global $parent_file;
        global $menu;
        global $submenu;
@@ -354,12 +706,19 @@ function get_admin_page_parent() {
        global $_wp_menu_nopriv;
        global $_wp_submenu_nopriv;
 
        global $_wp_menu_nopriv;
        global $_wp_submenu_nopriv;
 
+       if ( !empty ( $parent ) && 'admin.php' != $parent ) {
+               if ( isset( $_wp_real_parent_file[$parent] ) )
+                       $parent = $_wp_real_parent_file[$parent];
+               return $parent;
+       }
+/*
        if ( !empty ( $parent_file ) ) {
                if ( isset( $_wp_real_parent_file[$parent_file] ) )
                        $parent_file = $_wp_real_parent_file[$parent_file];
 
                return $parent_file;
        }
        if ( !empty ( $parent_file ) ) {
                if ( isset( $_wp_real_parent_file[$parent_file] ) )
                        $parent_file = $_wp_real_parent_file[$parent_file];
 
                return $parent_file;
        }
+*/
 
        if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
                foreach ( $menu as $parent_menu ) {
 
        if ( $pagenow == 'admin.php' && isset( $plugin_page ) ) {
                foreach ( $menu as $parent_menu ) {
@@ -400,7 +759,8 @@ function get_admin_page_parent() {
                }
        }
 
                }
        }
 
-       $parent_file = '';
+       if ( empty($parent_file) )
+               $parent_file = '';
        return '';
 }
 
        return '';
 }
 
@@ -418,6 +778,7 @@ function get_admin_page_title() {
        $hook = get_plugin_page_hook( $plugin_page, $pagenow );
 
        $parent = $parent1 = get_admin_page_parent();
        $hook = get_plugin_page_hook( $plugin_page, $pagenow );
 
        $parent = $parent1 = get_admin_page_parent();
+
        if ( empty ( $parent) ) {
                foreach ( $menu as $menu_array ) {
                        if ( isset( $menu_array[3] ) ) {
        if ( empty ( $parent) ) {
                foreach ( $menu as $menu_array ) {
                        if ( isset( $menu_array[3] ) ) {
@@ -473,17 +834,17 @@ function get_plugin_page_hook( $plugin_page, $parent_page ) {
 function get_plugin_page_hookname( $plugin_page, $parent_page ) {
        global $admin_page_hooks;
 
 function get_plugin_page_hookname( $plugin_page, $parent_page ) {
        global $admin_page_hooks;
 
-       $parent = get_admin_page_parent();
+       $parent = get_admin_page_parent( $parent_page );
 
        $page_type = 'admin';
 
        $page_type = 'admin';
-       if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
-               if ( isset( $admin_page_hooks[$plugin_page] ))
+       if ( empty ( $parent_page ) || 'admin.php' == $parent_page || isset( $admin_page_hooks[$plugin_page] ) ) {
+               if ( isset( $admin_page_hooks[$plugin_page] ) )
                        $page_type = 'toplevel';
                else
                        if ( isset( $admin_page_hooks[$parent] ))
                                $page_type = $admin_page_hooks[$parent];
                        $page_type = 'toplevel';
                else
                        if ( isset( $admin_page_hooks[$parent] ))
                                $page_type = $admin_page_hooks[$parent];
-       } else if ( isset( $admin_page_hooks[$parent_page] ) ) {
-               $page_type = $admin_page_hooks[$parent_page];
+       } else if ( isset( $admin_page_hooks[$parent] ) ) {
+               $page_type = $admin_page_hooks[$parent];
        }
 
        $plugin_name = preg_replace( '!\.php!', '', $plugin_page );
        }
 
        $plugin_name = preg_replace( '!\.php!', '', $plugin_page );
@@ -501,7 +862,7 @@ function user_can_access_admin_page() {
 
        $parent = get_admin_page_parent();
 
 
        $parent = get_admin_page_parent();
 
-       if ( isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
+       if ( !isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$pagenow] ) )
                return false;
 
        if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
                return false;
 
        if ( isset( $plugin_page ) && isset( $_wp_submenu_nopriv[$parent][$plugin_page] ) )
@@ -551,4 +912,154 @@ function user_can_access_admin_page() {
        return true;
 }
 
        return true;
 }
 
+/* Whitelist functions */
+
+/**
+ * Register a setting and its sanitization callback
+ *
+ * @since 2.7.0
+ *
+ * @param string $option_group A settings group name.  Can be anything.
+ * @param string $option_name The name of an option to sanitize and save.
+ * @param unknown_type $sanitize_callback A callback function that sanitizes the option's value.
+ * @return unknown
+ */
+function register_setting($option_group, $option_name, $sanitize_callback = '') {
+       return add_option_update_handler($option_group, $option_name, $sanitize_callback);
+}
+
+/**
+ * Unregister a setting
+ *
+ * @since 2.7.0
+ *
+ * @param unknown_type $option_group
+ * @param unknown_type $option_name
+ * @param unknown_type $sanitize_callback
+ * @return unknown
+ */
+function unregister_setting($option_group, $option_name, $sanitize_callback = '') {
+       return remove_option_update_handler($option_group, $option_name, $sanitize_callback);
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $option_group
+ * @param unknown_type $option_name
+ * @param unknown_type $sanitize_callback
+ */
+function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
+       global $new_whitelist_options;
+       $new_whitelist_options[ $option_group ][] = $option_name;
+       if ( $sanitize_callback != '' )
+               add_filter( "sanitize_option_{$option_name}", $sanitize_callback );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $option_group
+ * @param unknown_type $option_name
+ * @param unknown_type $sanitize_callback
+ */
+function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') {
+       global $new_whitelist_options;
+       $pos = array_search( $option_name, $new_whitelist_options );
+       if ( $pos !== false )
+               unset( $new_whitelist_options[ $option_group ][ $pos ] );
+       if ( $sanitize_callback != '' )
+               remove_filter( "sanitize_option_{$option_name}", $sanitize_callback );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $options
+ * @return unknown
+ */
+function option_update_filter( $options ) {
+       global $new_whitelist_options;
+
+       if ( is_array( $new_whitelist_options ) )
+               $options = add_option_whitelist( $new_whitelist_options, $options );
+
+       return $options;
+}
+add_filter( 'whitelist_options', 'option_update_filter' );
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $new_options
+ * @param unknown_type $options
+ * @return unknown
+ */
+function add_option_whitelist( $new_options, $options = '' ) {
+       if( $options == '' ) {
+               global $whitelist_options;
+       } else {
+               $whitelist_options = $options;
+       }
+       foreach( $new_options as $page => $keys ) {
+               foreach( $keys as $key ) {
+                       if ( !isset($whitelist_options[ $page ]) || !is_array($whitelist_options[ $page ]) ) {
+                               $whitelist_options[ $page ] = array();
+                               $whitelist_options[ $page ][] = $key;
+                       } else {
+                               $pos = array_search( $key, $whitelist_options[ $page ] );
+                               if ( $pos === false )
+                                       $whitelist_options[ $page ][] = $key;
+                       }
+               }
+       }
+       return $whitelist_options;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $del_options
+ * @param unknown_type $options
+ * @return unknown
+ */
+function remove_option_whitelist( $del_options, $options = '' ) {
+       if( $options == '' ) {
+               global $whitelist_options;
+       } else {
+               $whitelist_options = $options;
+       }
+       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 ] );
+               }
+       }
+       return $whitelist_options;
+}
+
+/**
+ * Output nonce, action, and option_page fields for a settings page.
+ *
+ * @since 2.7.0
+ *
+ * @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="action" value="update" />';
+       wp_nonce_field("$option_group-options");
+}
+
 ?>
 ?>
index 49ede25aa4f53a122fdcf6921c20d70d5d22207c..178162165a019b036ae1209e2722d0d8ed75997e 100644 (file)
@@ -1,36 +1,48 @@
 <?php
 <?php
+/**
+ * WordPress Post Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 /**
 
 /**
- * _wp_translate_postdata() - Rename $_POST data from form names to DB post columns.
+ * Rename $_POST data from form names to DB post columns.
  *
  * Manipulates $_POST directly.
  *
  * @package WordPress
  *
  * Manipulates $_POST directly.
  *
  * @package WordPress
- * @since 2.6
+ * @since 2.6.0
  *
  * @param bool $update Are we updating a pre-existing post?
  *
  * @param bool $update Are we updating a pre-existing post?
+ * @param post_data array Array of post data. Defaults to the contents of $_POST.
  * @return object|bool WP_Error on failure, true on success.
  */
  * @return object|bool WP_Error on failure, true on success.
  */
-function _wp_translate_postdata( $update = false ) {
+function _wp_translate_postdata( $update = false, $post_data = null ) {
+
+       if ( empty($post_data) )
+               $post_data = &$_POST;
+
        if ( $update )
        if ( $update )
-               $_POST['ID'] = (int) $_POST['post_ID'];
-       $_POST['post_content'] = $_POST['content'];
-       $_POST['post_excerpt'] = $_POST['excerpt'];
-       $_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
-       $_POST['to_ping'] = $_POST['trackback_url'];
-
-       if (!empty ( $_POST['post_author_override'] ) ) {
-               $_POST['post_author'] = (int) $_POST['post_author_override'];
+               $post_data['ID'] = (int) $post_data['post_ID'];
+       $post_data['post_content'] = isset($post_data['content']) ? $post_data['content'] : '';
+       $post_data['post_excerpt'] = isset($post_data['excerpt']) ? $post_data['excerpt'] : '';
+       $post_data['post_parent'] = isset($post_data['parent_id'])? $post_data['parent_id'] : '';
+       if ( isset($post_data['trackback_url']) )
+               $post_data['to_ping'] = $post_data['trackback_url'];
+
+       if (!empty ( $post_data['post_author_override'] ) ) {
+               $post_data['post_author'] = (int) $post_data['post_author_override'];
        } else {
        } else {
-               if (!empty ( $_POST['post_author'] ) ) {
-                       $_POST['post_author'] = (int) $_POST['post_author'];
+               if (!empty ( $post_data['post_author'] ) ) {
+                       $post_data['post_author'] = (int) $post_data['post_author'];
                } else {
                } else {
-                       $_POST['post_author'] = (int) $_POST['user_ID'];
+                       $post_data['post_author'] = (int) $post_data['user_ID'];
                }
        }
 
                }
        }
 
-       if ( $_POST['post_author'] != $_POST['user_ID'] ) {
-               if ( 'page' == $_POST['post_type'] ) {
+       if ( isset($post_data['user_ID']) && ($post_data['post_author'] != $post_data['user_ID']) ) {
+               if ( 'page' == $post_data['post_type'] ) {
                        if ( !current_user_can( 'edit_others_pages' ) ) {
                                return new WP_Error( 'edit_others_pages', $update ?
                                        __( 'You are not allowed to edit pages as this user.' ) :
                        if ( !current_user_can( 'edit_others_pages' ) ) {
                                return new WP_Error( 'edit_others_pages', $update ?
                                        __( 'You are not allowed to edit pages as this user.' ) :
@@ -48,51 +60,55 @@ function _wp_translate_postdata( $update = false ) {
        }
 
        // What to do based on which button they pressed
        }
 
        // What to do based on which button they pressed
-       if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
-               $_POST['post_status'] = 'draft';
-       if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
-               $_POST['post_status'] = 'private';
-       if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
-               $_POST['post_status'] = 'publish';
-       if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
-               $_POST['post_status'] = 'draft';
-
-       $previous_status = get_post_field('post_status',  $_POST['ID']);
-
-       // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published. 
+       if ( isset($post_data['saveasdraft']) && '' != $post_data['saveasdraft'] )
+               $post_data['post_status'] = 'draft';
+       if ( isset($post_data['saveasprivate']) && '' != $post_data['saveasprivate'] )
+               $post_data['post_status'] = 'private';
+       if ( isset($post_data['publish']) && ( '' != $post_data['publish'] ) && ( $post_data['post_status'] != 'private' ) )
+               $post_data['post_status'] = 'publish';
+       if ( isset($post_data['advanced']) && '' != $post_data['advanced'] )
+               $post_data['post_status'] = 'draft';
+       if ( isset($post_data['pending']) && '' != $post_data['pending'] )
+               $post_data['post_status'] = 'pending';
+
+       $previous_status = get_post_field('post_status',  isset($post_data['ID']) ? $post_data['ID'] : $post_data['temp_ID']);
+
+       // Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published.
        // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
        // Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
-       if ( 'page' == $_POST['post_type'] ) {
-               if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
-                       if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
-                               $_POST['post_status'] = 'pending';
+       if ( 'page' == $post_data['post_type'] ) {
+               $publish_cap = 'publish_pages';
+               $edit_cap = 'edit_published_pages';
        } else {
        } else {
-               if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) :
-                       // Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
-                       if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
-                               $_POST['post_status'] = 'pending';
-               endif;
+               $publish_cap = 'publish_posts';
+               $edit_cap = 'edit_published_posts';
        }
        }
+       if ( isset($post_data['post_status']) && ('publish' == $post_data['post_status'] && !current_user_can( $publish_cap )) )
+               if ( $previous_status != 'publish' || !current_user_can( $edit_cap ) )
+                       $post_data['post_status'] = 'pending';
+
+       if ( ! isset($post_data['post_status']) )
+               $post_data['post_status'] = $previous_status;
 
 
-       if (!isset( $_POST['comment_status'] ))
-               $_POST['comment_status'] = 'closed';
+       if (!isset( $post_data['comment_status'] ))
+               $post_data['comment_status'] = 'closed';
 
 
-       if (!isset( $_POST['ping_status'] ))
-               $_POST['ping_status'] = 'closed';
+       if (!isset( $post_data['ping_status'] ))
+               $post_data['ping_status'] = 'closed';
 
        foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
 
        foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
-               if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
-                       $_POST['edit_date'] = '1';
+               if ( !empty( $post_data['hidden_' . $timeunit] ) && $post_data['hidden_' . $timeunit] != $post_data[$timeunit] ) {
+                       $post_data['edit_date'] = '1';
                        break;
                }
        }
 
                        break;
                }
        }
 
-       if ( !empty( $_POST['edit_date'] ) ) {
-               $aa = $_POST['aa'];
-               $mm = $_POST['mm'];
-               $jj = $_POST['jj'];
-               $hh = $_POST['hh'];
-               $mn = $_POST['mn'];
-               $ss = $_POST['ss'];
+       if ( !empty( $post_data['edit_date'] ) ) {
+               $aa = $post_data['aa'];
+               $mm = $post_data['mm'];
+               $jj = $post_data['jj'];
+               $hh = $post_data['hh'];
+               $mn = $post_data['mn'];
+               $ss = $post_data['ss'];
                $aa = ($aa <= 0 ) ? date('Y') : $aa;
                $mm = ($mm <= 0 ) ? date('n') : $mm;
                $jj = ($jj > 31 ) ? 31 : $jj;
                $aa = ($aa <= 0 ) ? date('Y') : $aa;
                $mm = ($mm <= 0 ) ? date('n') : $mm;
                $jj = ($jj > 31 ) ? 31 : $jj;
@@ -100,20 +116,29 @@ function _wp_translate_postdata( $update = false ) {
                $hh = ($hh > 23 ) ? $hh -24 : $hh;
                $mn = ($mn > 59 ) ? $mn -60 : $mn;
                $ss = ($ss > 59 ) ? $ss -60 : $ss;
                $hh = ($hh > 23 ) ? $hh -24 : $hh;
                $mn = ($mn > 59 ) ? $mn -60 : $mn;
                $ss = ($ss > 59 ) ? $ss -60 : $ss;
-               $_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
-               $_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
+               $post_data['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
+               $post_data['post_date_gmt'] = get_gmt_from_date( $post_data['post_date'] );
        }
 
        }
 
-       return true;
+       return $post_data;
 }
 
 }
 
+/**
+ * Update an existing post with values provided in $_POST.
+ *
+ * @since unknown
+ *
+ * @param array $post_data Optional.
+ * @return int Post ID.
+ */
+function edit_post( $post_data = null ) {
 
 
-// Update an existing post with values provided in $_POST.
-function edit_post() {
+       if ( empty($post_data) )
+               $post_data = &$_POST;
 
 
-       $post_ID = (int) $_POST['post_ID'];
+       $post_ID = (int) $post_data['post_ID'];
 
 
-       if ( 'page' == $_POST['post_type'] ) {
+       if ( 'page' == $post_data['post_type'] ) {
                if ( !current_user_can( 'edit_page', $post_ID ) )
                        wp_die( __('You are not allowed to edit this page.' ));
        } else {
                if ( !current_user_can( 'edit_page', $post_ID ) )
                        wp_die( __('You are not allowed to edit this page.' ));
        } else {
@@ -122,7 +147,7 @@ function edit_post() {
        }
 
        // Autosave shouldn't save too soon after a real save
        }
 
        // Autosave shouldn't save too soon after a real save
-       if ( 'autosave' == $_POST['action'] ) {
+       if ( 'autosave' == $post_data['action'] ) {
                $post =& get_post( $post_ID );
                $now = time();
                $then = strtotime($post->post_date_gmt . ' +0000');
                $post =& get_post( $post_ID );
                $now = time();
                $then = strtotime($post->post_date_gmt . ' +0000');
@@ -131,24 +156,40 @@ function edit_post() {
                        return $post_ID;
        }
 
                        return $post_ID;
        }
 
-       $translated = _wp_translate_postdata( true );
-       if ( is_wp_error($translated) )
-               wp_die( $translated->get_error_message() );
+       $post_data = _wp_translate_postdata( true, $post_data );
+       if ( is_wp_error($post_data) )
+               wp_die( $post_data->get_error_message() );
+
+       if ( isset($post_data['visibility']) ) {
+               switch ( $post_data['visibility'] ) {
+                       case 'public' :
+                               $post_data['post_password'] = '';
+                               break;
+                       case 'password' :
+                               unset( $post_data['sticky'] );
+                               break;
+                       case 'private' :
+                               $post_data['post_status'] = 'private';
+                               $post_data['post_password'] = '';
+                               unset( $post_data['sticky'] );
+                               break;
+               }
+       }
 
        // Meta Stuff
 
        // Meta Stuff
-       if ( isset($_POST['meta']) && $_POST['meta'] ) {
-               foreach ( $_POST['meta'] as $key => $value )
+       if ( isset($post_data['meta']) && $post_data['meta'] ) {
+               foreach ( $post_data['meta'] as $key => $value )
                        update_meta( $key, $value['key'], $value['value'] );
        }
 
                        update_meta( $key, $value['key'], $value['value'] );
        }
 
-       if ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) {
-               foreach ( $_POST['deletemeta'] as $key => $value )
+       if ( isset($post_data['deletemeta']) && $post_data['deletemeta'] ) {
+               foreach ( $post_data['deletemeta'] as $key => $value )
                        delete_meta( $key );
        }
 
        add_meta( $post_ID );
 
                        delete_meta( $key );
        }
 
        add_meta( $post_ID );
 
-       wp_update_post( $_POST );
+       wp_update_post( $post_data );
 
        // Reunite any orphaned attachments with their parent
        if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
 
        // Reunite any orphaned attachments with their parent
        if ( !$draft_ids = get_user_option( 'autosave_draft_ids' ) )
@@ -161,10 +202,121 @@ function edit_post() {
 
        wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
 
 
        wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
 
+       if ( current_user_can( 'edit_others_posts' ) ) {
+               if ( !empty($post_data['sticky']) )
+                       stick_post($post_ID);
+               else
+                       unstick_post($post_ID);
+       }
+
        return $post_ID;
 }
 
        return $post_ID;
 }
 
-// Default post information to use when populating the "Write Post" form.
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Updates all bulk edited posts/pages, adding (but not removing) tags and
+ * categories. Skips pages when they would be their own parent or child.
+ *
+ * @since unknown
+ *
+ * @return array
+ */
+function bulk_edit_posts( $post_data = null ) {
+       global $wpdb;
+
+       if ( empty($post_data) )
+               $post_data = &$_POST;
+
+       if ( isset($post_data['post_type']) && 'page' == $post_data['post_type'] ) {
+               if ( ! current_user_can( 'edit_pages' ) )
+                       wp_die( __('You are not allowed to edit pages.') );
+       } else {
+               if ( ! current_user_can( 'edit_posts' ) )
+                       wp_die( __('You are not allowed to edit posts.') );
+       }
+
+       $post_IDs = array_map( 'intval', (array) $post_data['post'] );
+
+       $reset = array( 'post_author', 'post_status', 'post_password', 'post_parent', 'page_template', 'comment_status', 'ping_status', 'keep_private', 'tags_input', 'post_category', 'sticky' );
+       foreach ( $reset as $field ) {
+               if ( isset($post_data[$field]) && ( '' == $post_data[$field] || -1 == $post_data[$field] ) )
+                       unset($post_data[$field]);
+       }
+
+       if ( isset($post_data['post_category']) ) {
+               if ( is_array($post_data['post_category']) && ! empty($post_data['post_category']) )
+                       $new_cats = array_map( absint, $post_data['post_category'] );
+               else
+                       unset($post_data['post_category']);
+       }
+
+       if ( isset($post_data['tags_input']) ) {
+               $new_tags = preg_replace( '/\s*,\s*/', ',', rtrim( trim($post_data['tags_input']), ' ,' ) );
+               $new_tags = explode(',', $new_tags);
+       }
+
+       if ( isset($post_data['post_parent']) && ($parent = (int) $post_data['post_parent']) ) {
+               $pages = $wpdb->get_results("SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'");
+               $children = array();
+
+               for ( $i = 0; $i < 50 && $parent > 0; $i++ ) {
+                       $children[] = $parent;
+
+                       foreach ( $pages as $page ) {
+                               if ( $page->ID == $parent ) {
+                                       $parent = $page->post_parent;
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       $updated = $skipped = $locked = array();
+       foreach ( $post_IDs as $post_ID ) {
+
+               if ( isset($children) && in_array($post_ID, $children) ) {
+                       $skipped[] = $post_ID;
+                       continue;
+               }
+
+               if ( wp_check_post_lock( $post_ID ) ) {
+                       $locked[] = $post_ID;
+                       continue;
+               }
+
+               if ( isset($new_cats) ) {
+                       $cats = (array) wp_get_post_categories($post_ID);
+                       $post_data['post_category'] = array_unique( array_merge($cats, $new_cats) );
+               }
+
+               if ( isset($new_tags) ) {
+                       $tags = wp_get_post_tags($post_ID, array('fields' => 'names'));
+                       $post_data['tags_input'] = array_unique( array_merge($tags, $new_tags) );
+               }
+
+               $post_data['ID'] = $post_ID;
+               $updated[] = wp_update_post( $post_data );
+
+               if ( current_user_can( 'edit_others_posts' ) && isset( $post_data['sticky'] ) ) {
+                       if ( 'sticky' == $post_data['sticky'] )
+                               stick_post( $post_ID );
+                       else
+                               unstick_post( $post_ID );
+               }
+
+       }
+
+       return array( 'updated' => $updated, 'skipped' => $skipped, 'locked' => $locked );
+}
+
+/**
+ * Default post information to use when populating the "Write Post" form.
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_default_post_to_edit() {
        if ( !empty( $_REQUEST['post_title'] ) )
                $post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
 function get_default_post_to_edit() {
        if ( !empty( $_REQUEST['post_title'] ) )
                $post_title = wp_specialchars( stripslashes( $_REQUEST['post_title'] ));
@@ -182,8 +334,8 @@ function get_default_post_to_edit() {
                $text       = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
                $text       = funky_javascript_fix( $text);
                $popupurl   = clean_url($_REQUEST['popupurl']);
                $text       = wp_specialchars( stripslashes( urldecode( $_REQUEST['text'] ) ) );
                $text       = funky_javascript_fix( $text);
                $popupurl   = clean_url($_REQUEST['popupurl']);
-        $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
-    }
+               $post_content = '<a href="'.$popupurl.'">'.$post_title.'</a>'."\n$text";
+       }
 
        if ( !empty( $_REQUEST['excerpt'] ) )
                $post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
 
        if ( !empty( $_REQUEST['excerpt'] ) )
                $post_excerpt = wp_specialchars( stripslashes( $_REQUEST['excerpt'] ));
@@ -194,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_password = '';
        $post->post_status = 'draft';
        $post->post_type = 'post';
        $post->to_ping = '';
        $post->post_status = 'draft';
        $post->post_type = 'post';
        $post->to_ping = '';
@@ -212,13 +365,27 @@ function get_default_post_to_edit() {
        return $post;
 }
 
        return $post;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_default_page_to_edit() {
 function get_default_page_to_edit() {
-       $page = get_default_post_to_edit();
-       $page->post_type = 'page';
-       return $page;
+       $page = get_default_post_to_edit();
+       $page->post_type = 'page';
+       return $page;
 }
 
 }
 
-// Get an existing post and format it for editing.
+/**
+ * Get an existing post and format it for editing.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @return unknown
+ */
 function get_post_to_edit( $id ) {
 
        $post = get_post( $id, OBJECT, 'edit' );
 function get_post_to_edit( $id ) {
 
        $post = get_post( $id, OBJECT, 'edit' );
@@ -229,9 +396,23 @@ function get_post_to_edit( $id ) {
        return $post;
 }
 
        return $post;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $title
+ * @param unknown_type $content
+ * @param unknown_type $post_date
+ * @return unknown
+ */
 function post_exists($title, $content = '', $post_date = '') {
        global $wpdb;
 
 function post_exists($title, $content = '', $post_date = '') {
        global $wpdb;
 
+       $title = stripslashes($title);
+       $content = stripslashes($content);
+       $post_date = stripslashes($post_date);
+
        if (!empty ($post_date))
                $post_date = $wpdb->prepare("AND post_date = %s", $post_date);
 
        if (!empty ($post_date))
                $post_date = $wpdb->prepare("AND post_date = %s", $post_date);
 
@@ -244,7 +425,13 @@ function post_exists($title, $content = '', $post_date = '') {
        return 0;
 }
 
        return 0;
 }
 
-// Creates a new post from the "Write Post" form using $_POST information.
+/**
+ * Creates a new post from the "Write Post" form using $_POST information.
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function wp_write_post() {
        global $user_ID;
 
 function wp_write_post() {
        global $user_ID;
 
@@ -279,6 +466,22 @@ function wp_write_post() {
        if ( is_wp_error($translated) )
                return $translated;
 
        if ( is_wp_error($translated) )
                return $translated;
 
+       if ( isset($_POST['visibility']) ) {
+               switch ( $_POST['visibility'] ) {
+                       case 'public' :
+                               $_POST['post_password'] = '';
+                               break;
+                       case 'password' :
+                               unset( $_POST['sticky'] );
+                               break;
+                       case 'private' :
+                               $_POST['post_status'] = 'private';
+                               $_POST['post_password'] = '';
+                               unset( $_POST['sticky'] );
+                               break;
+               }
+       }
+
        // Create the post.
        $post_ID = wp_insert_post( $_POST );
        if ( is_wp_error( $post_ID ) )
        // Create the post.
        $post_ID = wp_insert_post( $_POST );
        if ( is_wp_error( $post_ID ) )
@@ -311,6 +514,13 @@ function wp_write_post() {
        return $post_ID;
 }
 
        return $post_ID;
 }
 
+/**
+ * Calls wp_write_post() and handles the errors.
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function write_post() {
        $result = wp_write_post();
        if( is_wp_error( $result ) )
 function write_post() {
        $result = wp_write_post();
        if( is_wp_error( $result ) )
@@ -323,16 +533,23 @@ function write_post() {
 // Post Meta
 //
 
 // Post Meta
 //
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post_ID
+ * @return unknown
+ */
 function add_meta( $post_ID ) {
        global $wpdb;
        $post_ID = (int) $post_ID;
 
        $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
 
 function add_meta( $post_ID ) {
        global $wpdb;
        $post_ID = (int) $post_ID;
 
        $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
 
-       $metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) );
-       $metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) );
-       $metavalue = maybe_serialize( stripslashes( (trim( $_POST['metavalue'] ) ) ));
-       $metavalue = $wpdb->escape( $metavalue );
+       $metakeyselect = isset($_POST['metakeyselect']) ? stripslashes( trim( $_POST['metakeyselect'] ) ) : '';
+       $metakeyinput = isset($_POST['metakeyinput']) ? stripslashes( trim( $_POST['metakeyinput'] ) ) : '';
+       $metavalue = isset($_POST['metavalue']) ? maybe_serialize( stripslashes( trim( $_POST['metavalue'] ) ) ) : '';
 
        if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
                // We have a key/value pair. If both the select and the
 
        if ( ('0' === $metavalue || !empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {
                // We have a key/value pair. If both the select and the
@@ -349,14 +566,20 @@ function add_meta( $post_ID ) {
 
                wp_cache_delete($post_ID, 'post_meta');
 
 
                wp_cache_delete($post_ID, 'post_meta');
 
-               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta 
-                       (post_id,meta_key,meta_value ) VALUES (%s, %s, %s)",
-                       $post_ID, $metakey, $metavalue) );
+               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value ) VALUES (%s, %s, %s)", $post_ID, $metakey, $metavalue) );
                return $wpdb->insert_id;
        }
        return false;
 } // add_meta
 
                return $wpdb->insert_id;
        }
        return false;
 } // add_meta
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $mid
+ * @return unknown
+ */
 function delete_meta( $mid ) {
        global $wpdb;
        $mid = (int) $mid;
 function delete_meta( $mid ) {
        global $wpdb;
        $mid = (int) $mid;
@@ -367,7 +590,13 @@ function delete_meta( $mid ) {
        return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
 }
 
        return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
 }
 
-// Get a list of previously defined keys
+/**
+ * Get a list of previously defined keys.
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_meta_keys() {
        global $wpdb;
 
 function get_meta_keys() {
        global $wpdb;
 
@@ -380,6 +609,14 @@ function get_meta_keys() {
        return $keys;
 }
 
        return $keys;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $mid
+ * @return unknown
+ */
 function get_post_meta_by_id( $mid ) {
        global $wpdb;
        $mid = (int) $mid;
 function get_post_meta_by_id( $mid ) {
        global $wpdb;
        $mid = (int) $mid;
@@ -390,7 +627,16 @@ function get_post_meta_by_id( $mid ) {
        return $meta;
 }
 
        return $meta;
 }
 
-// Some postmeta stuff
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Some postmeta stuff.
+ *
+ * @since unknown
+ *
+ * @param unknown_type $postid
+ * @return unknown
+ */
 function has_meta( $postid ) {
        global $wpdb;
 
 function has_meta( $postid ) {
        global $wpdb;
 
@@ -400,6 +646,16 @@ function has_meta( $postid ) {
 
 }
 
 
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $meta_id
+ * @param unknown_type $meta_key
+ * @param unknown_type $meta_value
+ * @return unknown
+ */
 function update_meta( $meta_id, $meta_key, $meta_value ) {
        global $wpdb;
 
 function update_meta( $meta_id, $meta_key, $meta_value ) {
        global $wpdb;
 
@@ -413,7 +669,7 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
 
        $meta_value = maybe_serialize( stripslashes( $meta_value ));
        $meta_id = (int) $meta_id;
 
        $meta_value = maybe_serialize( stripslashes( $meta_value ));
        $meta_id = (int) $meta_id;
-       
+
        $data  = compact( 'meta_key', 'meta_value' );
        $where = compact( 'meta_id' );
 
        $data  = compact( 'meta_key', 'meta_value' );
        $where = compact( 'meta_id' );
 
@@ -424,7 +680,15 @@ function update_meta( $meta_id, $meta_key, $meta_value ) {
 // Private
 //
 
 // Private
 //
 
-// Replace hrefs of attachment anchors with up-to-date permalinks.
+/**
+ * Replace hrefs of attachment anchors with up-to-date permalinks.
+ *
+ * @since unknown
+ * @access private
+ *
+ * @param unknown_type $post_ID
+ * @return unknown
+ */
 function _fix_attachment_links( $post_ID ) {
 
        $post = & get_post( $post_ID, ARRAY_A );
 function _fix_attachment_links( $post_ID ) {
 
        $post = & get_post( $post_ID, ARRAY_A );
@@ -465,7 +729,16 @@ function _fix_attachment_links( $post_ID ) {
        return wp_update_post( $post);
 }
 
        return wp_update_post( $post);
 }
 
-// Move child posts to a new parent
+/**
+ * Move child posts to a new parent.
+ *
+ * @since unknown
+ * @access private
+ *
+ * @param unknown_type $old_ID
+ * @param unknown_type $new_ID
+ * @return unknown
+ */
 function _relocate_children( $old_ID, $new_ID ) {
        global $wpdb;
        $old_ID = (int) $old_ID;
 function _relocate_children( $old_ID, $new_ID ) {
        global $wpdb;
        $old_ID = (int) $old_ID;
@@ -473,24 +746,39 @@ function _relocate_children( $old_ID, $new_ID ) {
        return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
 }
 
        return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $type
+ * @return unknown
+ */
 function get_available_post_statuses($type = 'post') {
        $stati = wp_count_posts($type);
 
        return array_keys(get_object_vars($stati));
 }
 
 function get_available_post_statuses($type = 'post') {
        $stati = wp_count_posts($type);
 
        return array_keys(get_object_vars($stati));
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $q
+ * @return unknown
+ */
 function wp_edit_posts_query( $q = false ) {
 function wp_edit_posts_query( $q = false ) {
-       global $wpdb;
        if ( false === $q )
                $q = $_GET;
        if ( false === $q )
                $q = $_GET;
-       $q['m']   = (int) $q['m'];
-       $q['cat'] = (int) $q['cat'];
+       $q['m']   = isset($q['m']) ? (int) $q['m'] : 0;
+       $q['cat'] = isset($q['cat']) ? (int) $q['cat'] : 0;
        $post_stati  = array(   //      array( adj, noun )
        $post_stati  = array(   //      array( adj, noun )
-                               'publish' => array(__('Published'), __('Published posts'), __ngettext_noop('Published (%s)', 'Published (%s)')),
-                               'future' => array(__('Scheduled'), __('Scheduled posts'), __ngettext_noop('Scheduled (%s)', 'Scheduled (%s)')),
-                               'pending' => array(__('Pending Review'), __('Pending posts'), __ngettext_noop('Pending Review (%s)', 'Pending Review (%s)')),
-                               'draft' => array(__('Draft'), _c('Drafts|manage posts header'), __ngettext_noop('Draft (%s)', 'Drafts (%s)')),
-                               'private' => array(__('Private'), __('Private posts'), __ngettext_noop('Private (%s)', 'Private (%s)')),
+                               '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>')),
                        );
 
        $post_stati = apply_filters('post_stati', $post_stati);
                        );
 
        $post_stati = apply_filters('post_stati', $post_stati);
@@ -503,10 +791,10 @@ function wp_edit_posts_query( $q = false ) {
                $post_status_q .= '&perm=readable';
        }
 
                $post_status_q .= '&perm=readable';
        }
 
-       if ( 'pending' === $q['post_status'] ) {
+       if ( isset($q['post_status']) && 'pending' === $q['post_status'] ) {
                $order = 'ASC';
                $orderby = 'modified';
                $order = 'ASC';
                $orderby = 'modified';
-       } elseif ( 'draft' === $q['post_status'] ) {
+       } elseif ( isset($q['post_status']) && 'draft' === $q['post_status'] ) {
                $order = 'DESC';
                $orderby = 'modified';
        } else {
                $order = 'DESC';
                $orderby = 'modified';
        } else {
@@ -519,6 +807,14 @@ function wp_edit_posts_query( $q = false ) {
        return array($post_stati, $avail_post_stati);
 }
 
        return array($post_stati, $avail_post_stati);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $type
+ * @return unknown
+ */
 function get_available_post_mime_types($type = 'attachment') {
        global $wpdb;
 
 function get_available_post_mime_types($type = 'attachment') {
        global $wpdb;
 
@@ -526,19 +822,27 @@ function get_available_post_mime_types($type = 'attachment') {
        return $types;
 }
 
        return $types;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $q
+ * @return unknown
+ */
 function wp_edit_attachments_query( $q = false ) {
 function wp_edit_attachments_query( $q = false ) {
-       global $wpdb;
        if ( false === $q )
                $q = $_GET;
        if ( false === $q )
                $q = $_GET;
-       $q['m']   = (int) $q['m'];
-       $q['cat'] = (int) $q['cat'];
+
+       $q['m']   = isset( $q['m'] ) ? (int) $q['m'] : 0;
+       $q['cat'] = isset( $q['cat'] ) ? (int) $q['cat'] : 0;
        $q['post_type'] = 'attachment';
        $q['post_status'] = 'any';
        $q['posts_per_page'] = 15;
        $post_mime_types = array(       //      array( adj, noun )
        $q['post_type'] = 'attachment';
        $q['post_status'] = 'any';
        $q['posts_per_page'] = 15;
        $post_mime_types = array(       //      array( adj, noun )
-                               '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'), __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>')),
                        );
        $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
                        );
        $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
@@ -552,17 +856,37 @@ function wp_edit_attachments_query( $q = false ) {
        return array($post_mime_types, $avail_post_mime_types);
 }
 
        return array($post_mime_types, $avail_post_mime_types);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @param unknown_type $page
+ * @return unknown
+ */
 function postbox_classes( $id, $page ) {
 function postbox_classes( $id, $page ) {
+       if ( isset( $_GET['edit'] ) && $_GET['edit'] == $id )
+               return '';
        $current_user = wp_get_current_user();
        $current_user = wp_get_current_user();
-       if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) {
+       if ( $closed = get_user_option('closedpostboxes_'.$page, 0, false ) ) {
                if ( !is_array( $closed ) ) return '';
                return in_array( $id, $closed )? 'if-js-closed' : '';
        } else {
                if ( !is_array( $closed ) ) return '';
                return in_array( $id, $closed )? 'if-js-closed' : '';
        } else {
-               if ( 'tagsdiv' == $id || 'categorydiv' == $id ) return '';
-               else return 'if-js-closed';
+               return '';
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @param unknown_type $title
+ * @param unknown_type $name
+ * @return unknown
+ */
 function get_sample_permalink($id, $title=null, $name = null) {
        $post = &get_post($id);
        if (!$post->ID) {
 function get_sample_permalink($id, $title=null, $name = null) {
        $post = &get_post($id);
        if (!$post->ID) {
@@ -576,8 +900,7 @@ function get_sample_permalink($id, $title=null, $name = null) {
        // drafts, so we will fake, that our post is published
        if (in_array($post->post_status, array('draft', 'pending'))) {
                $post->post_status = 'publish';
        // drafts, so we will fake, that our post is published
        if (in_array($post->post_status, array('draft', 'pending'))) {
                $post->post_status = 'publish';
-               $post->post_date = date('Y-m-d H:i:s');
-               $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);
        }
 
        // If the user wants to set a new name -- override the current one
        }
 
        // If the user wants to set a new name -- override the current one
@@ -586,6 +909,8 @@ function get_sample_permalink($id, $title=null, $name = null) {
                $post->post_name = sanitize_title($name? $name : $title, $post->ID);
        }
 
                $post->post_name = sanitize_title($name? $name : $title, $post->ID);
        }
 
+       $post->filter = 'sample'; 
+
        $permalink = get_permalink($post, true);
 
        // Handle page hierarchy
        $permalink = get_permalink($post, true);
 
        // Handle page hierarchy
@@ -603,9 +928,21 @@ function get_sample_permalink($id, $title=null, $name = null) {
        $post->post_status = $original_status;
        $post->post_date = $original_date;
        $post->post_name = $original_name;
        $post->post_status = $original_status;
        $post->post_date = $original_date;
        $post->post_name = $original_name;
+       unset($post->filter);
+
        return $permalink;
 }
 
        return $permalink;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @param unknown_type $new_title
+ * @param unknown_type $new_slug
+ * @return unknown
+ */
 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);
 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);
@@ -613,20 +950,34 @@ function get_sample_permalink_html($id, $new_title=null, $new_slug=null) {
                return '';
        }
        $title = __('Click to edit this part of the permalink');
                return '';
        }
        $title = __('Click to edit this part of the permalink');
-       if (strlen($post_name) > 30) {
-               $post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
+       if (function_exists('mb_strlen')) {
+               if (mb_strlen($post_name) > 30) {
+                       $post_name_abridged = mb_substr($post_name, 0, 14). '&hellip;' . mb_substr($post_name, -14);
+               } else {
+                       $post_name_abridged = $post_name;
+               }
        } else {
        } else {
-               $post_name_abridged = $post_name;
+               if (strlen($post_name) > 30) {
+                       $post_name_abridged = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
+               } else {
+                       $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>';
        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
        $return = '<strong>' . __('Permalink:') . "</strong>\n" . '<span id="sample-permalink">' . $display_link . "</span>\n";
        }
        $post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name_abridged.'</span><span id="editable-post-name-full">'.$post_name.'</span>';
        $display_link = str_replace(array('%pagename%','%postname%'), $post_name_html, $permalink);
        $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" onclick="edit_permalink(' . $id . '); return false;">' . __('Edit') . "</a></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 $return;
 }
 
        return $return;
 }
 
-// false: not locked or locked by current user
-// int: user ID of user with lock
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post_id
+ * @return bool|int False: not locked or locked by current user. Int: user ID of user with lock.
+ */
 function wp_check_post_lock( $post_id ) {
        global $current_user;
 
 function wp_check_post_lock( $post_id ) {
        global $current_user;
 
@@ -643,6 +994,14 @@ function wp_check_post_lock( $post_id ) {
        return false;
 }
 
        return false;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post_id
+ * @return unknown
+ */
 function wp_set_post_lock( $post_id ) {
        global $current_user;
        if ( !$post = get_post( $post_id ) )
 function wp_set_post_lock( $post_id ) {
        global $current_user;
        if ( !$post = get_post( $post_id ) )
@@ -659,11 +1018,11 @@ function wp_set_post_lock( $post_id ) {
 }
 
 /**
 }
 
 /**
- * wp_create_post_autosave() - creates autosave data for the specified post from $_POST data
+ * Creates autosave data for the specified post from $_POST data.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses _wp_translate_postdata()
  * @uses _wp_post_revision_fields()
  *
  * @uses _wp_translate_postdata()
  * @uses _wp_post_revision_fields()
@@ -683,3 +1042,312 @@ function wp_create_post_autosave( $post_id ) {
        // 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 );
 }
+
+/**
+ * Save draft or manually autosave for showing preview.
+ *
+ * @package WordPress
+ * @since 2.7
+ *
+ * @uses wp_write_post()
+ * @uses edit_post()
+ * @uses get_post()
+ * @uses current_user_can()
+ * @uses wp_create_post_autosave()
+ *
+ * @return str URL to redirect to show the preview
+ */
+function post_preview() {
+
+       $post_ID = (int) $_POST['post_ID'];
+       if ( $post_ID < 1 )
+               wp_die( __('Preview not available. Please save as a draft first.') );
+
+       if ( isset($_POST['catslist']) )
+               $_POST['post_category'] = explode(",", $_POST['catslist']);
+
+       if ( isset($_POST['tags_input']) )
+               $_POST['tags_input'] = explode(",", $_POST['tags_input']);
+
+       if ( $_POST['post_type'] == 'page' || empty($_POST['post_category']) )
+               unset($_POST['post_category']);
+
+       $_POST['ID'] = $post_ID;
+       $post = get_post($post_ID);
+
+       if ( 'page' == $post->post_type ) {
+               if ( !current_user_can('edit_page', $post_ID) )
+                       wp_die(__('You are not allowed to edit this page.'));
+       } else {
+               if ( !current_user_can('edit_post', $post_ID) )
+                       wp_die(__('You are not allowed to edit this post.'));
+       }
+
+       if ( 'draft' == $post->post_status ) {
+               $id = edit_post();
+       } else { // Non drafts are not overwritten.  The autosave is stored in a special post revision.
+               $id = wp_create_post_autosave( $post->ID );
+               if ( ! is_wp_error($id) )
+                       $id = $post->ID;
+       }
+
+       if ( is_wp_error($id) )
+               wp_die( $id->get_error_message() );
+
+       if ( $_POST['post_status'] == 'draft'  ) {
+               $url = add_query_arg( 'preview', 'true', get_permalink($id) );
+       } else {
+               $nonce = wp_create_nonce('post_preview_' . $id);
+               $url = add_query_arg( array( 'preview' => 'true', 'preview_id' => $id, 'preview_nonce' => $nonce ), get_permalink($id) );
+       }
+
+       return $url;
+}
+
+/**
+ * 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
+ */
+function wp_tiny_mce( $teeny = false ) {
+       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
+
+       /*
+       The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
+       By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
+       The + sign marks the default language. More information:
+       http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
+       */
+       $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
+
+       if ( $teeny ) {
+               $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' );
+
+               /*
+               The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
+               It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin.
+               The url should be absolute and should include the js file name to be loaded. Example:
+               array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
+               If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
+               */
+               $mce_external_plugins = apply_filters('mce_external_plugins', array());
+
+               $ext_plugins = "\n";
+               if ( ! empty($mce_external_plugins) ) {
+
+                       /*
+                       The following filter loads external language files for TinyMCE plugins.
+                       It takes an associative array 'plugin_name' => 'path', where path is the
+                       include path to the file. The language file should follow the same format as
+                       /tinymce/langs/wp-langs.php and should define a variable $strings that
+                       holds all translated strings.
+                       When this filter is not used, the function will try to load {mce_locale}.js.
+                       If that is not found, en.js will be tried next.
+                       */
+                       $mce_external_languages = apply_filters('mce_external_languages', array());
+
+                       $loaded_langs = array();
+                       $strings = '';
+
+                       if ( ! empty($mce_external_languages) ) {
+                               foreach ( $mce_external_languages as $name => $path ) {
+                                       if ( @is_file($path) && @is_readable($path) ) {
+                                               include_once($path);
+                                               $ext_plugins .= $strings . "\n";
+                                               $loaded_langs[] = $name;
+                                       }
+                               }
+                       }
+
+                       foreach ( $mce_external_plugins as $name => $url ) {
+
+                               if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);
+
+                               $plugins[] = '-' . $name;
+
+                               $plugurl = dirname($url);
+                               $strings = $str1 = $str2 = '';
+                               if ( ! in_array($name, $loaded_langs) ) {
+                                       $path = str_replace( WP_PLUGIN_URL, '', $plugurl );
+                                       $path = WP_PLUGIN_DIR . $path . '/langs/';
+
+                                       if ( function_exists('realpath') )
+                                               $path = trailingslashit( realpath($path) );
+
+                                       if ( @is_file($path . $mce_locale . '.js') )
+                                               $strings .= @file_get_contents($path . $mce_locale . '.js') . "\n";
+
+                                       if ( @is_file($path . $mce_locale . '_dlg.js') )
+                                               $strings .= @file_get_contents($path . $mce_locale . '_dlg.js') . "\n";
+
+                                       if ( 'en' != $mce_locale && empty($strings) ) {
+                                               if ( @is_file($path . 'en.js') ) {
+                                                       $str1 = @file_get_contents($path . 'en.js');
+                                                       $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str1, 1 ) . "\n";
+                                               }
+
+                                               if ( @is_file($path . 'en_dlg.js') ) {
+                                                       $str2 = @file_get_contents($path . 'en_dlg.js');
+                                                       $strings .= preg_replace( '/([\'"])en\./', '$1' . $mce_locale . '.', $str2, 1 ) . "\n";
+                                               }
+                                       }
+
+                                       if ( ! empty($strings) )
+                                               $ext_plugins .= "\n" . $strings . "\n";
+                               }
+
+                               $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
+                               $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
+                       }
+               }
+       }
+
+       $plugins = implode($plugins, ',');
+
+       if ( $teeny ) {
+               $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );
+               $mce_buttons = implode($mce_buttons, ',');
+               $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = '';
+       } else {
+               $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
+               $mce_buttons = implode($mce_buttons, ',');
+
+               $mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ));
+               $mce_buttons_2 = implode($mce_buttons_2, ',');
+
+               $mce_buttons_3 = apply_filters('mce_buttons_3', array());
+               $mce_buttons_3 = implode($mce_buttons_3, ',');
+
+               $mce_buttons_4 = apply_filters('mce_buttons_4', array());
+               $mce_buttons_4 = implode($mce_buttons_4, ',');
+       }
+       $no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
+
+       // TinyMCE init settings
+       $initArray = array (
+               'mode' => 'none',
+               'onpageload' => 'switchEditors.edInit',
+               'width' => '100%',
+               'theme' => 'advanced',
+               'skin' => 'wp_theme',
+               'theme_advanced_buttons1' => "$mce_buttons",
+               'theme_advanced_buttons2' => "$mce_buttons_2",
+               'theme_advanced_buttons3' => "$mce_buttons_3",
+               'theme_advanced_buttons4' => "$mce_buttons_4",
+               'language' => "$mce_locale",
+               'spellchecker_languages' => "$mce_spellchecker_languages",
+               'theme_advanced_toolbar_location' => 'top',
+               'theme_advanced_toolbar_align' => 'left',
+               'theme_advanced_statusbar_location' => 'bottom',
+               'theme_advanced_resizing' => true,
+               'theme_advanced_resize_horizontal' => false,
+               'dialog_type' => 'modal',
+               'relative_urls' => false,
+               'remove_script_host' => false,
+               '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,
+               'tab_focus' => ':prev,:next',
+               'content_css' => "$mce_css",
+               'save_callback' => 'switchEditors.saveCallback',
+               'wpeditimage_disable_captions' => $no_captions,
+               'plugins' => "$plugins"
+       );
+
+       // 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".
+       // Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
+       if ( $teeny ) {
+               $initArray = apply_filters('teeny_mce_before_init', $initArray);
+       } else {
+               $initArray = apply_filters('tiny_mce_before_init', $initArray);
+       }
+
+       $language = $initArray['language'];
+
+       $ver = apply_filters('tiny_mce_version', '3101');
+
+       if ( 'en' != $language )
+               include_once(ABSPATH . WPINC . '/js/tinymce/langs/wp-langs.php');
+
+       $mce_options = '';
+       foreach ( $initArray as $k => $v )
+           $mce_options .= $k . ':"' . $v . '", ';
+
+       $mce_options = rtrim( trim($mce_options), '\n\r,' ); ?>
+
+<script type="text/javascript">
+/* <![CDATA[ */
+tinyMCEPreInit = {
+       base : "<?php echo $baseurl; ?>",
+       suffix : "",
+       query : "ver=<?php echo $ver; ?>",
+       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');
+       }
+};
+/* ]]> */
+</script>
+<script type="text/javascript" src="<?php echo $baseurl; ?>/tiny_mce.js?ver=<?php echo $ver; ?>"></script>
+<?php if ( 'en' != $language && isset($lang) ) { ?>
+<script type="text/javascript">
+<?php echo $lang; ?>
+</script>
+<?php } else { ?>
+<script type="text/javascript" src="<?php echo $baseurl; ?>/langs/wp-langs-en.js?ver=<?php echo $ver; ?>"></script>
+<?php } ?>
+<script type="text/javascript">
+<?php if ( $ext_plugins ) echo $ext_plugins; ?>
+
+// Mark translations as done
+tinyMCEPreInit.go();
+
+// Init
+tinyMCE.init(tinyMCEPreInit.mceInit);
+</script>
+
+<?php
+}
+?>
index 7162b42b3e6767c1ab8a328300004d2eb47ee5ea..1f9c5be59c60e452a807ad5781bd280ab282d52d 100644 (file)
@@ -1,19 +1,33 @@
 <?php
 <?php
-// Here we keep the DB structure and option values
-
+/**
+ * WordPress Administration Scheme API
+ *
+ * Here we keep the DB structure and option values.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The database character collate.
+ * @var string
+ * @global string
+ * @name $charset_collate
+ */
 $charset_collate = '';
 
 // Declare these as global in case schema.php is included from a function.
 global $wpdb, $wp_queries;
 
 $charset_collate = '';
 
 // Declare these as global in case schema.php is included from a function.
 global $wpdb, $wp_queries;
 
-if ( $wpdb->supports_collation() ) {
+if ( $wpdb->has_cap( 'collation' ) ) {
        if ( ! empty($wpdb->charset) )
                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
        if ( ! empty($wpdb->collate) )
                $charset_collate .= " COLLATE $wpdb->collate";
 }
 
        if ( ! empty($wpdb->charset) )
                $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
        if ( ! empty($wpdb->collate) )
                $charset_collate .= " COLLATE $wpdb->collate";
 }
 
-$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,
  name varchar(200) NOT NULL default '',
  slug varchar(200) NOT NULL default '',
  term_id bigint(20) NOT NULL auto_increment,
  name varchar(200) NOT NULL default '',
  slug varchar(200) NOT NULL default '',
@@ -125,7 +139,8 @@ CREATE TABLE $wpdb->posts (
   comment_count bigint(20) NOT NULL default '0',
   PRIMARY KEY  (ID),
   KEY post_name (post_name),
   comment_count bigint(20) NOT NULL default '0',
   PRIMARY KEY  (ID),
   KEY post_name (post_name),
-  KEY type_status_date (post_type,post_status,post_date,ID)
+  KEY type_status_date (post_type,post_status,post_date,ID),
+  KEY post_parent (post_parent)
 ) $charset_collate;
 CREATE TABLE $wpdb->users (
   ID bigint(20) unsigned NOT NULL auto_increment,
 ) $charset_collate;
 CREATE TABLE $wpdb->users (
   ID bigint(20) unsigned NOT NULL auto_increment,
@@ -152,13 +167,20 @@ CREATE TABLE $wpdb->usermeta (
   KEY meta_key (meta_key)
 ) $charset_collate;";
 
   KEY meta_key (meta_key)
 ) $charset_collate;";
 
+/**
+ * Create WordPress options and set the default values.
+ *
+ * @since 1.5.0
+ * @uses $wpdb
+ * @uses $wp_db_version
+ */
 function populate_options() {
        global $wpdb, $wp_db_version;
 function populate_options() {
        global $wpdb, $wp_db_version;
-       
+
        $guessurl = wp_guess_url();
        $guessurl = wp_guess_url();
-       
+
        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('siteurl', $guessurl);
        add_option('blogname', __('My Blog'));
        add_option('blogdescription', __('Just another WordPress weblog'));
@@ -257,7 +279,29 @@ function populate_options() {
        add_option('avatar_default', 'mystery');
        add_option('enable_app', 0);
        add_option('enable_xmlrpc', 0);
        add_option('avatar_default', 'mystery');
        add_option('enable_app', 0);
        add_option('enable_xmlrpc', 0);
-       
+
+       // 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());
+
        // 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) :
        // 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) :
@@ -271,14 +315,25 @@ function populate_options() {
        endforeach;
 }
 
        endforeach;
 }
 
+/**
+ * Execute WordPress role creation for the various WordPress versions.
+ *
+ * @since 2.0.0
+ */
 function populate_roles() {
        populate_roles_160();
        populate_roles_210();
        populate_roles_230();
        populate_roles_250();
        populate_roles_260();
 function populate_roles() {
        populate_roles_160();
        populate_roles_210();
        populate_roles_230();
        populate_roles_250();
        populate_roles_260();
+       populate_roles_270();
 }
 
 }
 
+/**
+ * Create the roles for WordPress 2.0
+ *
+ * @since 2.0.0
+ */
 function populate_roles_160() {
        // Add roles
 
 function populate_roles_160() {
        // Add roles
 
@@ -296,7 +351,7 @@ function populate_roles_160() {
        add_role('subscriber', 'Subscriber|User role');
 
        // Add caps for Administrator role
        add_role('subscriber', 'Subscriber|User role');
 
        // Add caps for Administrator role
-       $role = get_role('administrator');
+       $role =& get_role('administrator');
        $role->add_cap('switch_themes');
        $role->add_cap('edit_themes');
        $role->add_cap('activate_plugins');
        $role->add_cap('switch_themes');
        $role->add_cap('edit_themes');
        $role->add_cap('activate_plugins');
@@ -329,7 +384,7 @@ function populate_roles_160() {
        $role->add_cap('level_0');
 
        // Add caps for Editor role
        $role->add_cap('level_0');
 
        // Add caps for Editor role
-       $role = get_role('editor');
+       $role =& get_role('editor');
        $role->add_cap('moderate_comments');
        $role->add_cap('manage_categories');
        $role->add_cap('manage_links');
        $role->add_cap('moderate_comments');
        $role->add_cap('manage_categories');
        $role->add_cap('manage_links');
@@ -351,7 +406,7 @@ function populate_roles_160() {
        $role->add_cap('level_0');
 
        // Add caps for Author role
        $role->add_cap('level_0');
 
        // Add caps for Author role
-       $role = get_role('author');
+       $role =& get_role('author');
        $role->add_cap('upload_files');
        $role->add_cap('edit_posts');
        $role->add_cap('edit_published_posts');
        $role->add_cap('upload_files');
        $role->add_cap('edit_posts');
        $role->add_cap('edit_published_posts');
@@ -362,22 +417,27 @@ function populate_roles_160() {
        $role->add_cap('level_0');
 
        // Add caps for Contributor role
        $role->add_cap('level_0');
 
        // Add caps for Contributor role
-       $role = get_role('contributor');
+       $role =& get_role('contributor');
        $role->add_cap('edit_posts');
        $role->add_cap('read');
        $role->add_cap('level_1');
        $role->add_cap('level_0');
 
        // Add caps for Subscriber role
        $role->add_cap('edit_posts');
        $role->add_cap('read');
        $role->add_cap('level_1');
        $role->add_cap('level_0');
 
        // Add caps for Subscriber role
-       $role = get_role('subscriber');
+       $role =& get_role('subscriber');
        $role->add_cap('read');
        $role->add_cap('level_0');
 }
 
        $role->add_cap('read');
        $role->add_cap('level_0');
 }
 
+/**
+ * Create and modify WordPress roles for WordPress 2.1.
+ *
+ * @since 2.1.0
+ */
 function populate_roles_210() {
        $roles = array('administrator', 'editor');
        foreach ($roles as $role) {
 function populate_roles_210() {
        $roles = array('administrator', 'editor');
        foreach ($roles as $role) {
-               $role = get_role($role);
+               $role =& get_role($role);
                if ( empty($role) )
                        continue;
 
                if ( empty($role) )
                        continue;
 
@@ -398,42 +458,57 @@ function populate_roles_210() {
                $role->add_cap('read_private_pages');
        }
 
                $role->add_cap('read_private_pages');
        }
 
-       $role = get_role('administrator');
+       $role =& get_role('administrator');
        if ( ! empty($role) ) {
                $role->add_cap('delete_users');
                $role->add_cap('create_users');
        }
 
        if ( ! empty($role) ) {
                $role->add_cap('delete_users');
                $role->add_cap('create_users');
        }
 
-       $role = get_role('author');
+       $role =& get_role('author');
        if ( ! empty($role) ) {
                $role->add_cap('delete_posts');
                $role->add_cap('delete_published_posts');
        }
 
        if ( ! empty($role) ) {
                $role->add_cap('delete_posts');
                $role->add_cap('delete_published_posts');
        }
 
-       $role = get_role('contributor');
+       $role =& get_role('contributor');
        if ( ! empty($role) ) {
                $role->add_cap('delete_posts');
        }
 }
 
        if ( ! empty($role) ) {
                $role->add_cap('delete_posts');
        }
 }
 
+/**
+ * Create and modify WordPress roles for WordPress 2.3.
+ *
+ * @since 2.3.0
+ */
 function populate_roles_230() {
 function populate_roles_230() {
-       $role = get_role( 'administrator' );
+       $role =& get_role( 'administrator' );
 
        if ( !empty( $role ) ) {
                $role->add_cap( 'unfiltered_upload' );
        }
 }
 
 
        if ( !empty( $role ) ) {
                $role->add_cap( 'unfiltered_upload' );
        }
 }
 
+/**
+ * Create and modify WordPress roles for WordPress 2.5.
+ *
+ * @since 2.5.0
+ */
 function populate_roles_250() {
 function populate_roles_250() {
-       $role = get_role( 'administrator' );
+       $role =& get_role( 'administrator' );
 
        if ( !empty( $role ) ) {
                $role->add_cap( 'edit_dashboard' );
        }
 }
 
 
        if ( !empty( $role ) ) {
                $role->add_cap( 'edit_dashboard' );
        }
 }
 
+/**
+ * Create and modify WordPress roles for WordPress 2.6.
+ *
+ * @since 2.6.0
+ */
 function populate_roles_260() {
 function populate_roles_260() {
-       $role = get_role( 'administrator' );
+       $role =& get_role( 'administrator' );
 
        if ( !empty( $role ) ) {
                $role->add_cap( 'update_plugins' );
 
        if ( !empty( $role ) ) {
                $role->add_cap( 'update_plugins' );
@@ -441,4 +516,18 @@ function populate_roles_260() {
        }
 }
 
        }
 }
 
+/**
+ * Create and modify WordPress roles for WordPress 2.7.
+ *
+ * @since 2.7.0
+ */
+function populate_roles_270() {
+       $role =& get_role( 'administrator' );
+
+       if ( !empty( $role ) ) {
+               $role->add_cap( 'install_plugins' );
+               $role->add_cap( 'update_themes' );
+       }
+}
+
 ?>
 ?>
index a0b95a7af6f2aa32e2a6fa727cd38a25254419b0..a6c753d48b47e294b80e07f4a3b59311252e1b98 100644 (file)
@@ -1,9 +1,23 @@
 <?php
 <?php
+/**
+ * WordPress Taxonomy Administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 //
 // Category
 //
 
 
 //
 // Category
 //
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $cat_name
+ * @return unknown
+ */
 function category_exists($cat_name) {
        $id = is_term($cat_name, 'category');
        if ( is_array($id) )
 function category_exists($cat_name) {
        $id = is_term($cat_name, 'category');
        if ( is_array($id) )
@@ -11,11 +25,28 @@ function category_exists($cat_name) {
        return $id;
 }
 
        return $id;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @return unknown
+ */
 function get_category_to_edit( $id ) {
        $category = get_category( $id, OBJECT, 'edit' );
        return $category;
 }
 
 function get_category_to_edit( $id ) {
        $category = get_category( $id, OBJECT, 'edit' );
        return $category;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $cat_name
+ * @param unknown_type $parent
+ * @return unknown
+ */
 function wp_create_category( $cat_name, $parent = 0 ) {
        if ( $id = category_exists($cat_name) )
                return $id;
 function wp_create_category( $cat_name, $parent = 0 ) {
        if ( $id = category_exists($cat_name) )
                return $id;
@@ -23,6 +54,15 @@ function wp_create_category( $cat_name, $parent = 0 ) {
        return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
 }
 
        return wp_insert_category( array('cat_name' => $cat_name, 'category_parent' => $parent) );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $categories
+ * @param unknown_type $post_id
+ * @return unknown
+ */
 function wp_create_categories($categories, $post_id = '') {
        $cat_ids = array ();
        foreach ($categories as $category) {
 function wp_create_categories($categories, $post_id = '') {
        $cat_ids = array ();
        foreach ($categories as $category) {
@@ -39,6 +79,14 @@ function wp_create_categories($categories, $post_id = '') {
        return $cat_ids;
 }
 
        return $cat_ids;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $cat_ID
+ * @return unknown
+ */
 function wp_delete_category($cat_ID) {
        $cat_ID = (int) $cat_ID;
        $default = get_option('default_category');
 function wp_delete_category($cat_ID) {
        $cat_ID = (int) $cat_ID;
        $default = get_option('default_category');
@@ -50,9 +98,18 @@ function wp_delete_category($cat_ID) {
        return wp_delete_term($cat_ID, 'category', array('default' => $default));
 }
 
        return wp_delete_term($cat_ID, 'category', array('default' => $default));
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $catarr
+ * @param unknown_type $wp_error
+ * @return unknown
+ */
 function wp_insert_category($catarr, $wp_error = false) {
        $cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
 function wp_insert_category($catarr, $wp_error = false) {
        $cat_defaults = array('cat_ID' => 0, 'cat_name' => '', 'category_description' => '', 'category_nicename' => '', 'category_parent' => '');
-       $cat_arr = wp_parse_args($cat_arr, $cat_defaults);
+       $catarr = wp_parse_args($catarr, $cat_defaults);
        extract($catarr, EXTR_SKIP);
 
        if ( trim( $cat_name ) == '' ) {
        extract($catarr, EXTR_SKIP);
 
        if ( trim( $cat_name ) == '' ) {
@@ -99,10 +156,18 @@ function wp_insert_category($catarr, $wp_error = false) {
        return $cat_ID['term_id'];
 }
 
        return $cat_ID['term_id'];
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $catarr
+ * @return unknown
+ */
 function wp_update_category($catarr) {
        $cat_ID = (int) $catarr['cat_ID'];
 
 function wp_update_category($catarr) {
        $cat_ID = (int) $catarr['cat_ID'];
 
-       if ( $cat_ID == $catarr['category_parent'] )
+       if ( isset($catarr['category_parent']) && ($cat_ID == $catarr['category_parent']) )
                return false;
 
        // First, get all of the original fields
                return false;
 
        // First, get all of the original fields
@@ -121,6 +186,14 @@ function wp_update_category($catarr) {
 // Tags
 //
 
 // Tags
 //
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post_id
+ * @return unknown
+ */
 function get_tags_to_edit( $post_id ) {
        $post_id = (int) $post_id;
        if ( !$post_id )
 function get_tags_to_edit( $post_id ) {
        $post_id = (int) $post_id;
        if ( !$post_id )
@@ -139,10 +212,26 @@ function get_tags_to_edit( $post_id ) {
        return $tags_to_edit;
 }
 
        return $tags_to_edit;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $tag_name
+ * @return unknown
+ */
 function tag_exists($tag_name) {
        return is_term($tag_name, 'post_tag');
 }
 
 function tag_exists($tag_name) {
        return is_term($tag_name, 'post_tag');
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $tag_name
+ * @return unknown
+ */
 function wp_create_tag($tag_name) {
        if ( $id = tag_exists($tag_name) )
                return $id;
 function wp_create_tag($tag_name) {
        if ( $id = tag_exists($tag_name) )
                return $id;
index e132733e8ce6f8a4a883e2bcc19c4d3c3415a3ac..2566a61684332021e0803acc10891877a1b1eeb3 100644 (file)
@@ -1,15 +1,43 @@
 <?php
 <?php
-
-//
-// Big Mess
-//
+/**
+ * Template WordPress Administration API.
+ *
+ * A Big Mess. Also some neat functions that are nicely written.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 // Ugly recursive category stuff.
 
 // Ugly recursive category stuff.
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $parent
+ * @param unknown_type $level
+ * @param unknown_type $categories
+ * @param unknown_type $page
+ * @param unknown_type $per_page
+ */
 function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
        $count = 0;
        _cat_rows($categories, $count, $parent, $level, $page, $per_page);
 }
 
 function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
        $count = 0;
        _cat_rows($categories, $count, $parent, $level, $page, $per_page);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $categories
+ * @param unknown_type $count
+ * @param unknown_type $parent
+ * @param unknown_type $level
+ * @param unknown_type $page
+ * @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);
 function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
        if ( empty($categories) ) {
                $args = array('hide_empty' => 0);
@@ -39,7 +67,6 @@ function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $p
                // If the page starts in a subtree, print the parents.
                if ( $count == $start && $category->parent > 0 ) {
                        $my_parents = array();
                // If the page starts in a subtree, print the parents.
                if ( $count == $start && $category->parent > 0 ) {
                        $my_parents = array();
-                       $my_parent = $category->parent;
                        while ( $my_parent) {
                                $my_parent = get_category($my_parent);
                                $my_parents[] = $my_parent;
                        while ( $my_parent) {
                                $my_parent = get_category($my_parent);
                                $my_parents[] = $my_parent;
@@ -57,7 +84,7 @@ 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[$i]); // Prune the working set
                $count++;
 
                if ( isset($children[$category->term_id]) )
                $count++;
 
                if ( isset($children[$category->term_id]) )
@@ -68,83 +95,284 @@ function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $p
        $output = ob_get_contents();
        ob_end_clean();
 
        $output = ob_get_contents();
        ob_end_clean();
 
-       $output = apply_filters('cat_rows', $output);
-
        echo $output;
 }
 
        echo $output;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $category
+ * @param unknown_type $level
+ * @param unknown_type $name_override
+ * @return unknown
+ */
 function _cat_row( $category, $level, $name_override = false ) {
 function _cat_row( $category, $level, $name_override = false ) {
-       global $class;
+       static $row_class = '';
 
 
-       $category = get_category( $category );
+       $category = get_category( $category, OBJECT, 'display' );
 
 
+       $default_cat_id = (int) get_option( 'default_category' );
        $pad = str_repeat( '&#8212; ', $level );
        $name = ( $name_override ? $name_override : $pad . ' ' . $category->name );
        $pad = str_repeat( '&#8212; ', $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' ) ) {
        if ( current_user_can( 'manage_categories' ) ) {
-               $edit = "<a class='row-title' href='categories.php?action=edit&amp;cat_ID=$category->term_id' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>$name</a>";
+               $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "'>" . attribute_escape( $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['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>";
+               $action_count = count($actions);
+               $i = 0;
+               $edit .= '<div class="row-actions">';
+               foreach ( $actions as $action => $link ) {
+                       ++$i;
+                       ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                       $edit .= "<span class='$action'>$link$sep</span>";
+               }
+               $edit .= '</div>';
        } else {
                $edit = $name;
        }
 
        } else {
                $edit = $name;
        }
 
-       $class = " class='alternate'" == $class ? '' : " class='alternate'";
+       $row_class = 'alternate' == $row_class ? '' : 'alternate';
+       $qe_data = get_category_to_edit($category->term_id);
 
        $category->count = number_format_i18n( $category->count );
        $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
 
        $category->count = number_format_i18n( $category->count );
        $posts_count = ( $category->count > 0 ) ? "<a href='edit.php?cat=$category->term_id'>$category->count</a>" : $category->count;
-       $output = "<tr id='cat-$category->term_id'$class>
-                          <th scope='row' class='check-column'>";
-       if ( absint(get_option( 'default_category' ) ) != $category->term_id ) {
-               $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
-       } else {
-               $output .= "&nbsp;";
+       $output = "<tr id='cat-$category->term_id' class='iedit $row_class'>";
+
+       $columns = get_column_headers('categories');
+       $hidden = get_hidden_columns('categories');
+       foreach ( $columns as $column_name => $column_display_name ) {
+               $class = "class=\"$column_name column-$column_name\"";
+
+               $style = '';
+               if ( in_array($column_name, $hidden) )
+                       $style = ' style="display:none;"';
+
+               $attributes = "$class$style";
+
+               switch ($column_name) {
+                       case 'cb':
+                               $output .= "<th scope='row' class='check-column'>";
+                               if ( $default_cat_id != $category->term_id ) {
+                                       $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
+                               } else {
+                                       $output .= "&nbsp;";
+                               }
+                               $output .= '</th>';
+                               break;
+                       case 'name':
+                               $output .= "<td $attributes>$edit";
+                               $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
+                               $output .= '<div class="name">' . $qe_data->name . '</div>';
+                               $output .= '<div class="slug">' . $qe_data->slug . '</div>';
+                               $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
+                               break;
+                       case 'description':
+                               $output .= "<td $attributes>$category->description</td>";
+                               break;
+                       case 'slug':
+                               $output .= "<td $attributes>$category->slug</td>";
+                               break;
+                       case 'posts':
+                               $attributes = 'class="posts column-posts num"' . $style;
+                               $output .= "<td $attributes>$posts_count</td>\n";
+               }
+       }
+       $output .= '</tr>';
+
+       return $output;
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since 2.7
+ *
+ * Outputs the HTML for the hidden table rows used in Categories, Link Caregories and Tags quick edit.
+ *
+ * @param string $type "tag", "category" or "link-category"
+ * @return
+ */
+function inline_edit_term_row($type) {
+
+       if ( ! current_user_can( 'manage_categories' ) )
+               return;
+
+       $is_tag = $type == 'edit-tags';
+       $columns = get_column_headers($type);
+       $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($type) ) );
+       $col_count = count($columns) - count($hidden);
+       ?>
+
+<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
+       <tr id="inline-edit" class="inline-edit-row" style="display: none"><td colspan="<?php echo $col_count; ?>">
+
+               <fieldset><div class="inline-edit-col">
+                       <h4><?php _e( 'Quick Edit' ); ?></h4>
+
+                       <label>
+                               <span class="title"><?php _e( 'Name' ); ?></span>
+                               <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span>
+                       </label>
+
+                       <label>
+                               <span class="title"><?php _e( 'Slug' ); ?></span>
+                               <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span>
+                       </label>
+
+<?php if ( 'category' == $type ) : ?>
+
+                       <label>
+                               <span class="title"><?php _e( 'Parent' ); ?></span>
+                               <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('None'))); ?>
+                       </label>
+
+<?php endif; // $type ?>
+
+               </div></fieldset>
+
+<?php
+
+       $core_columns = array( 'cb' => true, 'description' => true, 'name' => true, 'slug' => true, 'posts' => true );
+
+       foreach ( $columns as $column_name => $column_display_name ) {
+               if ( isset( $core_columns[$column_name] ) )
+                       continue;
+               do_action( 'quick_edit_custom_box', $column_name, $type );
        }
        }
-       $output .= "</th>
-                               <td>$edit</td>
-                               <td>$category->description</td>
-                               <td class='num'>$posts_count</td>\n\t</tr>\n";
 
 
-       return apply_filters('cat_row', $output);
+?>
+
+       <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="" />
+               <span class="error" style="display:none;"></span>
+               <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?>
+               <br class="clear" />
+       </p>
+       </td></tr>
+       </tbody></table></form>
+<?php
 }
 
 }
 
-function link_cat_row( $category ) {
-       global $class;
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $category
+ * @param unknown_type $name_override
+ * @return unknown
+ */
+function link_cat_row( $category, $name_override = false ) {
+       static $row_class = '';
 
 
-       if ( !$category = get_term( $category, 'link_category' ) )
+       if ( !$category = get_term( $category, 'link_category', OBJECT, 'display' ) )
                return false;
        if ( is_wp_error( $category ) )
                return $category;
 
                return false;
        if ( is_wp_error( $category ) )
                return $category;
 
+       $default_cat_id = (int) get_option( 'default_link_category' );
        $name = ( $name_override ? $name_override : $category->name );
        $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' ) ) {
        if ( current_user_can( 'manage_categories' ) ) {
-               $edit = "<a class='row-title' href='link-category.php?action=edit&amp;cat_ID=$category->term_id' title='" . attribute_escape(sprintf(__('Edit "%s"'), $category->name)) . "' class='edit'>$name</a>";
-               $default_cat_id = (int) get_option( 'default_link_category' );
+               $edit = "<a class='row-title' href='$edit_link' title='" . attribute_escape(sprintf(__('Edit "%s"'), $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['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>";
+               $action_count = count($actions);
+               $i = 0;
+               $edit .= '<div class="row-actions">';
+               foreach ( $actions as $action => $link ) {
+                       ++$i;
+                       ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                       $edit .= "<span class='$action'>$link$sep</span>";
+               }
+               $edit .= '</div>';
        } else {
                $edit = $name;
        }
 
        } else {
                $edit = $name;
        }
 
-       $class = " class='alternate'" == $class ? '' : " class='alternate'";
+       $row_class = 'alternate' == $row_class ? '' : 'alternate';
+       $qe_data = get_term_to_edit($category->term_id, 'link_category');
 
        $category->count = number_format_i18n( $category->count );
        $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
 
        $category->count = number_format_i18n( $category->count );
        $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;
-       $output = "<tr id='link-cat-$category->term_id'$class>
-                          <th scope='row' class='check-column'>";
-       if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
-               $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
-       } else {
-               $output .= "&nbsp;";
+       $output = "<tr id='link-cat-$category->term_id' class='iedit $row_class'>";
+       $columns = get_column_headers('edit-link-categories');
+       $hidden = get_hidden_columns('edit-link-categories');
+       foreach ( $columns as $column_name => $column_display_name ) {
+               $class = "class=\"$column_name column-$column_name\"";
+
+               $style = '';
+               if ( in_array($column_name, $hidden) )
+                       $style = ' style="display:none;"';
+
+               $attributes = "$class$style";
+
+               switch ($column_name) {
+                       case 'cb':
+                               $output .= "<th scope='row' class='check-column'>";
+                               if ( absint( get_option( 'default_link_category' ) ) != $category->term_id ) {
+                                       $output .= "<input type='checkbox' name='delete[]' value='$category->term_id' />";
+                               } else {
+                                       $output .= "&nbsp;";
+                               }
+                               $output .= "</th>";
+                               break;
+                       case 'name':
+                               $output .= "<td $attributes>$edit";
+                               $output .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
+                               $output .= '<div class="name">' . $qe_data->name . '</div>';
+                               $output .= '<div class="slug">' . $qe_data->slug . '</div>';
+                               $output .= '<div class="cat_parent">' . $qe_data->parent . '</div></div></td>';
+                               break;
+                       case 'description':
+                               $output .= "<td $attributes>$category->description</td>";
+                               break;
+                       case 'slug':
+                               $output .= "<td $attributes>$category->slug</td>";
+                               break;
+                       case 'links':
+                               $attributes = 'class="links column-links num"' . $style;
+                               $output .= "<td $attributes>$count</td>";
+               }
        }
        }
-       $output .= "</th>
-                               <td>$edit</td>
-                               <td>$category->description</td>
-                               <td class='num'>$count</td></tr>";
+       $output .= '</tr>';
 
 
-       return apply_filters( 'link_cat_row', $output );
+       return $output;
 }
 
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $checked
+ * @param unknown_type $current
+ */
 function checked( $checked, $current) {
        if ( $checked == $current)
                echo ' checked="checked"';
 }
 
 function checked( $checked, $current) {
        if ( $checked == $current)
                echo ' checked="checked"';
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $selected
+ * @param unknown_type $current
+ */
 function selected( $selected, $current) {
        if ( $selected == $current)
                echo ' selected="selected"';
 function selected( $selected, $current) {
        if ( $selected == $current)
                echo ' selected="selected"';
@@ -154,12 +382,27 @@ function selected( $selected, $current) {
 // Category Checklists
 //
 
 // Category Checklists
 //
 
-// Deprecated. Use wp_link_category_checklist
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ * @deprecated Use {@link wp_link_category_checklist()}
+ * @see wp_link_category_checklist()
+ *
+ * @param unknown_type $default
+ * @param unknown_type $parent
+ * @param unknown_type $popular_ids
+ */
 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
        global $post_ID;
        wp_category_checklist($post_ID);
 }
 
 function dropdown_categories( $default = 0, $parent = 0, $popular_ids = array() ) {
        global $post_ID;
        wp_category_checklist($post_ID);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 class Walker_Category_Checklist extends Walker {
        var $tree_type = 'category';
        var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
 class Walker_Category_Checklist extends Walker {
        var $tree_type = 'category';
        var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
@@ -178,7 +421,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 for="in-category-' . $category->term_id . '" 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"' : "" ) . '/> ' . wp_specialchars( apply_filters('the_category', $category->name )) . '</label>';
        }
 
        function end_el(&$output, $category, $depth, $args) {
        }
 
        function end_el(&$output, $category, $depth, $args) {
@@ -186,12 +429,24 @@ class Walker_Category_Checklist extends Walker {
        }
 }
 
        }
 }
 
-function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
-       $walker = new Walker_Category_Checklist;
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post_id
+ * @param unknown_type $descendants_and_self
+ * @param unknown_type $selected_cats
+ * @param unknown_type $popular_cats
+ */
+function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null ) {
+       if ( empty($walker) || !is_a($walker, 'Walker') )
+               $walker = new Walker_Category_Checklist;
+
        $descendants_and_self = (int) $descendants_and_self;
 
        $args = array();
        $descendants_and_self = (int) $descendants_and_self;
 
        $args = array();
-       
+
        if ( is_array( $selected_cats ) )
                $args['selected_cats'] = $selected_cats;
        elseif ( $post_id )
        if ( is_array( $selected_cats ) )
                $args['selected_cats'] = $selected_cats;
        elseif ( $post_id )
@@ -227,6 +482,17 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
        echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
 }
 
        echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $taxonomy
+ * @param unknown_type $default
+ * @param unknown_type $number
+ * @param unknown_type $echo
+ * @return unknown
+ */
 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
        global $post_ID;
        if ( $post_ID )
 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
        global $post_ID;
        if ( $post_ID )
@@ -244,7 +510,7 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
                ?>
 
                <li id="<?php echo $id; ?>" class="popular-category">
                ?>
 
                <li id="<?php echo $id; ?>" class="popular-category">
-                       <label class="selectit" for="in-<?php echo $id; ?>">
+                       <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 ) ); ?>
                        </label>
                        <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 ) ); ?>
                        </label>
@@ -255,14 +521,31 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
        return $popular_ids;
 }
 
        return $popular_ids;
 }
 
-// Deprecated. Use wp_link_category_checklist
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ * @deprecated Use {@link wp_link_category_checklist()}
+ * @see wp_link_category_checklist()
+ *
+ * @param unknown_type $default
+ */
 function dropdown_link_categories( $default = 0 ) {
        global $link_id;
 
        wp_link_category_checklist($link_id);
 }
 
 function dropdown_link_categories( $default = 0 ) {
        global $link_id;
 
        wp_link_category_checklist($link_id);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $link_id
+ */
 function wp_link_category_checklist( $link_id = 0 ) {
 function wp_link_category_checklist( $link_id = 0 ) {
+       $default = 1;
+
        if ( $link_id ) {
                $checked_categories = wp_get_link_cats($link_id);
 
        if ( $link_id ) {
                $checked_categories = wp_get_link_cats($link_id);
 
@@ -291,18 +574,68 @@ function wp_link_category_checklist( $link_id = 0 ) {
 
 // Returns a single tag row (see tag_rows below)
 // Note: this is also used in admin-ajax.php!
 
 // Returns a single tag row (see tag_rows below)
 // Note: this is also used in admin-ajax.php!
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $tag
+ * @param unknown_type $class
+ * @return unknown
+ */
 function _tag_row( $tag, $class = '' ) {
                $count = number_format_i18n( $tag->count );
                $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
 
                $name = apply_filters( 'term_name', $tag->name );
 function _tag_row( $tag, $class = '' ) {
                $count = number_format_i18n( $tag->count );
                $count = ( $count > 0 ) ? "<a href='edit.php?tag=$tag->slug'>$count</a>" : $count;
 
                $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";
                $out = '';
                $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
                $out = '';
                $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
-               $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
-               $out .= '<td><strong><a class="row-title" href="edit-tags.php?action=edit&amp;tag_ID=' . $tag->term_id . '" title="' . attribute_escape(sprintf(__('Edit "%s"'), $name)) . '">' .
-                       $name . '</a></td>';
+               $columns = get_column_headers('edit-tags');
+               $hidden = get_hidden_columns('edit-tags');
+               foreach ( $columns as $column_name => $column_display_name ) {
+                       $class = "class=\"$column_name column-$column_name\"";
+
+                       $style = '';
+                       if ( in_array($column_name, $hidden) )
+                               $style = ' style="display:none;"';
+
+                       $attributes = "$class$style";
+
+                       switch ($column_name) {
+                               case 'cb':
+                                       $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 />';
+                                       $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>";
+                                       $action_count = count($actions);
+                                       $i = 0;
+                                       $out .= '<div class="row-actions">';
+                                       foreach ( $actions as $action => $link ) {
+                                               ++$i;
+                                               ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                                               $out .= "<span class='$action'>$link$sep</span>";
+                                       }
+                                       $out .= '</div>';
+                                       $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
+                                       $out .= '<div class="name">' . $qe_data->name . '</div>';
+                                       $out .= '<div class="slug">' . $qe_data->slug . '</div></div></td>';
+                                       break;
+                               case 'slug':
+                                       $out .= "<td $attributes>$tag->slug</td>";
+                                       break;
+                               case 'posts':
+                                       $attributes = 'class="posts column-posts num"' . $style;
+                                       $out .= "<td $attributes>$count</td>";
+                                       break;
+                       }
+               }
 
 
-               $out .= "<td class='num'>$count</td>";
                $out .= '</tr>';
 
                return $out;
                $out .= '</tr>';
 
                return $out;
@@ -311,6 +644,16 @@ function _tag_row( $tag, $class = '' ) {
 // Outputs appropriate rows for the Nth page of the Tag Management screen,
 // assuming M tags displayed at a time on the page
 // Returns the number of tags displayed
 // Outputs appropriate rows for the Nth page of the Tag Management screen,
 // assuming M tags displayed at a time on the page
 // Returns the number of tags displayed
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ * @param unknown_type $pagesize
+ * @param unknown_type $searchterms
+ * @return unknown
+ */
 function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
 
        // Get a page worth of tags
 function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
 
        // Get a page worth of tags
@@ -326,238 +669,1018 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
 
        // convert it to table rows
        $out = '';
 
        // convert it to table rows
        $out = '';
-       $class = '';
        $count = 0;
        foreach( $tags as $tag )
        $count = 0;
        foreach( $tags as $tag )
-               $out .= _tag_row( $tag, ++$count % 2 ? ' class="alternate"' : '' );
+               $out .= _tag_row( $tag, ++$count % 2 ? ' class="iedit alternate"' : ' class="iedit"' );
 
        // filter and send to screen
 
        // filter and send to screen
-       $out = apply_filters('tag_rows', $out);
        echo $out;
        return $count;
 }
 
 // define the columns to display, the syntax is 'internal name' => 'display name'
        echo $out;
        return $count;
 }
 
 // define the columns to display, the syntax is 'internal name' => 'display name'
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 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" />';
-       if ( 'draft' === $_GET['post_status'] )
-               $posts_columns['modified'] = __('Modified');
-       elseif ( 'pending' === $_GET['post_status'] )
-               $posts_columns['modified'] = __('Submitted');
-       else
-               $posts_columns['date'] = __('Date');
-       $posts_columns['title'] = __('Title');
+       $posts_columns['title'] = _c('Post|noun');
        $posts_columns['author'] = __('Author');
        $posts_columns['categories'] = __('Categories');
        $posts_columns['tags'] = __('Tags');
        $posts_columns['author'] = __('Author');
        $posts_columns['categories'] = __('Categories');
        $posts_columns['tags'] = __('Tags');
-       if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
+       if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
                $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
                $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
-       $posts_columns['status'] = __('Status');
+       $posts_columns['date'] = __('Date');
        $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
 
        return $posts_columns;
 }
 
 // define the columns to display, the syntax is 'internal name' => 'display name'
        $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
 
        return $posts_columns;
 }
 
 // define the columns to display, the syntax is 'internal name' => 'display name'
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function wp_manage_media_columns() {
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
        $posts_columns['icon'] = '';
 function wp_manage_media_columns() {
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
        $posts_columns['icon'] = '';
-       $posts_columns['media'] = _c('Media|media column header');
-       $posts_columns['desc'] = _c('Description|media column header');
-       $posts_columns['date'] = _c('Date Added|media column header');
-       $posts_columns['parent'] = _c('Appears with|media column header');
+       $posts_columns['media'] = _c('File|media column header');
+       $posts_columns['author'] = __('Author');
+       //$posts_columns['tags'] = _c('Tags|media column header');
+       $posts_columns['parent'] = _c('Attached to|media column header');
        $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
        $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
-       $posts_columns['location'] = _c('Location|media column header');
+       //$posts_columns['comments'] = __('Comments');
+       $posts_columns['date'] = _c('Date|media column header');
        $posts_columns = apply_filters('manage_media_columns', $posts_columns);
 
        return $posts_columns;
 }
 
        $posts_columns = apply_filters('manage_media_columns', $posts_columns);
 
        return $posts_columns;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function wp_manage_pages_columns() {
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
 function wp_manage_pages_columns() {
        $posts_columns = array();
        $posts_columns['cb'] = '<input type="checkbox" />';
-       if ( 'draft' === $_GET['post_status'] )
-               $posts_columns['modified'] = __('Modified');
-       elseif ( 'pending' === $_GET['post_status'] )
-               $posts_columns['modified'] = __('Submitted');
-       else
-               $posts_columns['date'] = __('Date');
        $posts_columns['title'] = __('Title');
        $posts_columns['author'] = __('Author');
        $posts_columns['title'] = __('Title');
        $posts_columns['author'] = __('Author');
-       if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) )
+       $post_status = 'all';
+       if ( !empty($_GET['post_status']) )
+               $post_status = $_GET['post_status'];
+       if ( !in_array($post_status, array('pending', 'draft', 'future')) )
                $posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>';
                $posts_columns['comments'] = '<div class="vers"><img alt="" src="images/comment-grey-bubble.png" /></div>';
-       $posts_columns['status'] = __('Status');
+       $posts_columns['date'] = __('Date');
        $posts_columns = apply_filters('manage_pages_columns', $posts_columns);
 
        return $posts_columns;
 }
 
        $posts_columns = apply_filters('manage_pages_columns', $posts_columns);
 
        return $posts_columns;
 }
 
-/*
- * display one row if the page doesn't have any children
- * otherwise, display the row and its children in subsequent rows
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ * @return unknown
  */
  */
-function display_page_row( $page, $level = 0 ) {
-       global $post;
-       static $class;
+function get_column_headers($page) {
+       global $_wp_column_headers;
+
+       if ( !isset($_wp_column_headers) )
+               $_wp_column_headers = array();
+
+       // Store in static to avoid running filters on each call
+       if ( isset($_wp_column_headers[$page]) )
+               return $_wp_column_headers[$page];
+
+       switch ($page) {
+               case 'edit':
+                        $_wp_column_headers[$page] = wp_manage_posts_columns();
+                        break;
+               case 'edit-pages':
+                       $_wp_column_headers[$page] = wp_manage_pages_columns();
+                       break;
+               case 'edit-comments':
+                       $_wp_column_headers[$page] = array(
+                               'cb' => '<input type="checkbox" />',
+                               'author' => __('Author'),
+                               'comment' => _c('Comment|noun'),
+                               //'date' => __('Submitted'),
+                               'response' => __('In Response To')
+                       );
 
 
-       $post = $page;
-       setup_postdata($page);
+                       break;
+               case 'link-manager':
+                       $_wp_column_headers[$page] = array(
+                               'cb' => '<input type="checkbox" />',
+                               'name' => __('Name'),
+                               'url' => __('URL'),
+                               'categories' => __('Categories'),
+                               'rel' => __('rel'),
+                               'visible' => __('Visible')
+                       );
 
 
-       $page->post_title = wp_specialchars( $page->post_title );
-       $pad = str_repeat( '&#8212; ', $level );
-       $id = (int) $page->ID;
-       $class = ('alternate' == $class ) ? '' : 'alternate';
-       $posts_columns = wp_manage_pages_columns();
-       $title = get_the_title();
-       if ( empty($title) )
-               $title = __('(no title)');
-?>
-  <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'>
+                       break;
+               case 'upload':
+                       $_wp_column_headers[$page] = wp_manage_media_columns();
+                       break;
+               case 'categories':
+                       $_wp_column_headers[$page] = array(
+                               'cb' => '<input type="checkbox" />',
+                               'name' => __('Name'),
+                               'description' => __('Description'),
+                               'slug' => __('Slug'),
+                               'posts' => __('Posts')
+                       );
 
 
+                       break;
+               case 'edit-link-categories':
+                       $_wp_column_headers[$page] = array(
+                               'cb' => '<input type="checkbox" />',
+                               'name' => __('Name'),
+                               'description' => __('Description'),
+                               'slug' => __('Slug'),
+                               'links' => __('Links')
+                       );
 
 
- <?php
+                       break;
+               case 'edit-tags':
+                       $_wp_column_headers[$page] = array(
+                               'cb' => '<input type="checkbox" />',
+                               'name' => __('Name'),
+                               'slug' => __('Slug'),
+                               'posts' => __('Posts')
+                       );
 
 
-foreach ($posts_columns as $column_name=>$column_display_name) {
+                       break;
+               case 'users':
+                       $_wp_column_headers[$page] = array(
+                               'cb' => '<input type="checkbox" />',
+                               'username' => __('Username'),
+                               'name' => __('Name'),
+                               'email' => __('E-mail'),
+                               'role' => __('Role'),
+                               'posts' => __('Posts')
+                       );
+                       break;
+               default :
+                       $_wp_column_headers[$page] = array();
+       }
 
 
-       switch ($column_name) {
+       $_wp_column_headers[$page] = apply_filters('manage_' . $page . '_columns', $_wp_column_headers[$page]);
+       return $_wp_column_headers[$page];
+}
 
 
-       case 'cb':
-               ?>
-               <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th>
-               <?php
-               break;
-       case 'modified':
-       case 'date':
-               if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
-                       $t_time = $h_time = __('Unpublished');
-               } else {
-                       if ( 'modified' == $column_name ) {
-                               $t_time = get_the_modified_time(__('Y/m/d g:i:s A'));
-                               $m_time = $page->post_modified;
-                               $time = get_post_modified_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 {
-                               $h_time = mysql2date(__('Y/m/d'), $m_time);
-                       }
-               }
-               ?>
-               <td><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td>
-               <?php
-               break;
-       case 'title':
-               ?>
-               <td><strong><a class="row-title" href="page.php?action=edit&amp;post=<?php the_ID(); ?>" title="<?php echo attribute_escape(sprintf(__('Edit "%s"'), $title)); ?>"><?php echo $pad; echo $title ?></a></strong>
-               <?php if ('private' == $page->post_status) _e(' &#8212; <strong>Private</strong>'); ?></td>
-               <?php
-               break;
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $type
+ * @param unknown_type $id
+ */
+function print_column_headers( $type, $id = true ) {
+       $type = str_replace('.php', '', $type);
+       $columns = get_column_headers( $type );
+       $hidden = get_hidden_columns($type);
+       $styles = array();
+//     $styles['tag']['posts'] = 'width: 90px;';
+//     $styles['link-category']['links'] = 'width: 90px;';
+//     $styles['category']['posts'] = 'width: 90px;';
+//     $styles['link']['visible'] = 'text-align: center;';
 
 
-       case 'comments':
-               ?>
-               <td class="num"><div class="post-com-count-wrapper">
-               <?php
-               $left = get_pending_comments_num( $page->ID );
-               $pending_phrase = sprintf( __('%s pending'), number_format( $left ) );
-               if ( $left )
-                       echo '<strong>';
-               comments_number("<a href='edit-pages.php?page_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('0') . '</span></a>', "<a href='edit-pages.php?page_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('1') . '</span></a>', "<a href='edit-pages.php?page_id=$id' title='$pending_phrase' class='post-com-count'><span class='comment-count'>" . __('%') . '</span></a>');
-               if ( $left )
-                       echo '</strong>';
-               ?>
-               </div></td>
-               <?php
-               break;
+       foreach ( $columns as $column_key => $column_display_name ) {
+               $class = ' class="manage-column';
 
 
-       case 'author':
-               ?>
-               <td><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
-               <?php
-               break;
+               $class .= " column-$column_key";
 
 
-       case 'status':
-               ?>
-               <td>
-               <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink">
-               <?php
-               switch ( $page->post_status ) {
-                       case 'publish' :
-                       case 'private' :
-                               _e('Published');
-                               break;
-                       case 'future' :
-                               _e('Scheduled');
-                               break;
-                       case 'pending' :
-                               _e('Pending Review');
-                               break;
-                       case 'draft' :
-                               _e('Unpublished');
-                               break;
-               }
-               ?>
-               </a>
-               </td>
-               <?php
-               break;
+               if ( 'cb' == $column_key )
+                       $class .= ' check-column';
+               elseif ( in_array($column_key, array('posts', 'comments', 'links')) )
+                       $class .= ' num';
 
 
-       default:
-               ?>
-               <td><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td>
-               <?php
-               break;
-       }
-}
- ?>
+               $class .= '"';
 
 
-   </tr>
+               $style = '';
+               if ( in_array($column_key, $hidden) )
+                       $style = 'display:none;';
 
 
-<?php
+               if ( isset($styles[$type]) && isset($styles[$type][$column_key]) )
+                       $style .= ' ' . $styles[$type][$column_key];
+               $style = ' style="' . $style . '"';
+?>
+       <th scope="col" <?php echo $id ? "id=\"$column_key\"" : ""; echo $class; echo $style; ?>><?php echo $column_display_name; ?></th>
+<?php }
 }
 
 }
 
-/*
- * displays pages in hierarchical order with paging support
+/**
+ * Register column headers for a particular screen.  The header names will be listed in the Screen Options.
+ *
+ * @since 2.7.0
+ *
+ * @param string $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions.
+ * @param array $columns An array of columns with column IDs as the keys and translated column names as the values
+ * @see get_column_headers(), print_column_headers(), get_hidden_columns()
  */
  */
-function page_rows($pages, $pagenum = 1, $per_page = 20) {
-       $level = 0;
+function register_column_headers($screen, $columns) {
+       global $_wp_column_headers;
 
 
-       if ( ! $pages ) {
-               $pages = get_pages( array('sort_column' => 'menu_order') );
+       if ( !isset($_wp_column_headers) )
+               $_wp_column_headers = array();
 
 
-               if ( ! $pages )
-                       return false;
-       }
+       $_wp_column_headers[$screen] = $columns;
+}
 
 
-       /* 
-        * arrange pages into two parts: top level pages and children_pages
-        * children_pages is two dimensional array, eg. 
-        * children_pages[10][] contains all sub-pages whose parent is 10. 
-        * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ */
+function get_hidden_columns($page) {
+       $page = str_replace('.php', '', $page);
+       return (array) get_user_option( 'manage-' . $page . '-columns-hidden', 0, false );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * Outputs the quick edit and bulk edit table rows for posts and pages
+ *
+ * @since 2.7
+ *
+ * @param string $type 'post' or 'page'
+ */
+function inline_edit_row( $type ) {
+       global $current_user, $mode;
+
+       $is_page = 'page' == $type;
+       if ( $is_page ) {
+               $screen = 'edit-pages';
+               $post = get_default_page_to_edit();
+       } else {
+               $screen = 'edit';
+               $post = get_default_post_to_edit();
+       }
+
+       $columns = $is_page ? wp_manage_pages_columns() : wp_manage_posts_columns();
+       $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns($screen) ) );
+       $col_count = count($columns) - count($hidden);
+       $m = ( isset($mode) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
+       $can_publish = current_user_can("publish_{$type}s");
+       $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
+
+?>
+
+<form method="get" action=""><table style="display: none"><tbody id="inlineedit">
+       <?php
+       $bulk = 0;
+       while ( $bulk < 2 ) { ?>
+
+       <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$type ";
+               echo $bulk ? "bulk-edit-row bulk-edit-row-$type" : "quick-edit-row quick-edit-row-$type";
+       ?>" style="display: none"><td colspan="<?php echo $col_count; ?>">
+
+       <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
+               <h4><?php echo $bulk ? ( $is_page ? __( 'Bulk Edit Pages' ) : __( 'Bulk Edit Posts' ) ) : __( 'Quick Edit' ); ?></h4>
+
+
+<?php if ( $bulk ) : ?>
+               <div id="bulk-title-div">
+                       <div id="bulk-titles"></div>
+               </div>
+
+<?php else : // $bulk ?>
+
+               <label>
+                       <span class="title"><?php _e( 'Title' ); ?></span>
+                       <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
+               </label>
+
+<?php endif; // $bulk ?>
+
+
+<?php if ( !$bulk ) : ?>
+
+               <label>
+                       <span class="title"><?php _e( 'Slug' ); ?></span>
+                       <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
+               </label>
+
+               <label><span class="title"><?php _e( 'Date' ); ?></span></label>
+               <div class="inline-edit-date">
+                       <?php touch_time(1, 1, 4, 1); ?>
+               </div>
+               <br class="clear" />
+
+<?php endif; // $bulk
+
+               ob_start();
+               $authors = get_editable_user_ids( $current_user->id, true, $type ); // TODO: ROLE SYSTEM
+               if ( $authors && count( $authors ) > 1 ) :
+                       $users_opt = array('include' => $authors, 'name' => 'post_author', 'class'=> 'authors', 'multi' => 1);
+                       if ( $bulk )
+                               $users_opt['show_option_none'] = __('- No Change -');
+?>
+               <label>
+                       <span class="title"><?php _e( 'Author' ); ?></span>
+                       <?php wp_dropdown_users( $users_opt ); ?>
+               </label>
+
+<?php
+               endif; // authors
+               $authors_dropdown = ob_get_clean();
+?>
+
+<?php if ( !$bulk ) : echo $authors_dropdown; ?>
+
+               <div class="inline-edit-group">
+                       <label class="alignleft">
+                               <span class="title"><?php _e( 'Password' ); ?></span>
+                               <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>
+
+                       <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>
+               </div>
+
+<?php endif; ?>
+
+       </div></fieldset>
+
+<?php if ( !$is_page && !$bulk ) : ?>
+
+       <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
+               <span class="title inline-edit-categories-label"><?php _e( 'Categories' ); ?>
+                       <span class="catshow"><?php _e('[more]'); ?></span>
+                       <span class="cathide" style="display:none;"><?php _e('[less]'); ?></span>
+               </span>
+               <ul class="cat-checklist">
+                       <?php wp_category_checklist(); ?>
+               </ul>
+       </div></fieldset>
+
+<?php endif; // !$is_page && !$bulk ?>
+
+       <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
+
+<?php
+       if ( $bulk )
+               echo $authors_dropdown;
+?>
+
+<?php if ( $is_page ) : ?>
+
+               <label>
+                       <span class="title"><?php _e( 'Parent' ); ?></span>
+<?php
+       $dropdown_args = array('selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __('Main Page (no parent)'), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title');
+       if ( $bulk )
+               $dropdown_args['show_option_no_change'] =  __('- No Change -');
+       $dropdown_args = apply_filters('quick_edit_dropdown_pages_args', $dropdown_args);
+       wp_dropdown_pages($dropdown_args);
+?>
+               </label>
+
+<?php  if ( !$bulk ) : ?>
+
+               <label>
+                       <span class="title"><?php _e( 'Order' ); ?></span>
+                       <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
+               </label>
+
+<?php  endif; // !$bulk ?>
+
+               <label>
+                       <span class="title"><?php _e( 'Template' ); ?></span>
+                       <select name="page_template">
+<?php  if ( $bulk ) : ?>
+                               <option value="-1"><?php _e('- No Change -'); ?></option>
+<?php  endif; // $bulk ?>
+                               <option value="default"><?php _e( 'Default Template' ); ?></option>
+                               <?php page_template_dropdown() ?>
+                       </select>
+               </label>
+
+<?php elseif ( !$bulk ) : // $is_page ?>
+
+               <label class="inline-edit-tags">
+                       <span class="title"><?php _e( 'Tags' ); ?></span>
+                       <textarea cols="22" rows="1" name="tags_input" class="tags_input"></textarea>
+               </label>
+
+<?php endif; // $is_page  ?>
+
+<?php if ( $bulk ) : ?>
+
+               <div class="inline-edit-group">
+               <label class="alignleft">
+                       <span class="title"><?php _e( 'Comments' ); ?></span>
+                       <select name="comment_status">
+                               <option value=""><?php _e('- No Change -'); ?></option>
+                               <option value="open"><?php _e('Allow'); ?></option>
+                               <option value="closed"><?php _e('Do not allow'); ?></option>
+                       </select>
+               </label>
+
+               <label class="alignright">
+                       <span class="title"><?php _e( 'Pings' ); ?></span>
+                       <select name="ping_status">
+                               <option value=""><?php _e('- No Change -'); ?></option>
+                               <option value="open"><?php _e('Allow'); ?></option>
+                               <option value="closed"><?php _e('Do not allow'); ?></option>
+                       </select>
+               </label>
+               </div>
+
+<?php else : // $bulk ?>
+
+               <div class="inline-edit-group">
+                       <label class="alignleft">
+                               <input type="checkbox" name="comment_status" value="open" />
+                               <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
+                       </label>
+
+                       <label class="alignleft">
+                               <input type="checkbox" name="ping_status" value="open" />
+                               <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
+                       </label>
+               </div>
+
+<?php endif; // $bulk ?>
+
+
+               <div class="inline-edit-group">
+                       <label class="inline-edit-status alignleft">
+                               <span class="title"><?php _e( 'Status' ); ?></span>
+                               <select name="_status">
+<?php if ( $bulk ) : ?>
+                                       <option value="-1"><?php _e('- No Change -'); ?></option>
+<?php endif; // $bulk ?>
+                               <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
+                                       <option value="publish"><?php _e( 'Published' ); ?></option>
+                                       <option value="future"><?php _e( 'Scheduled' ); ?></option>
+<?php if ( $bulk ) : ?>
+                                       <option value="private"><?php _e('Private') ?></option>
+<?php endif; // $bulk ?>
+                               <?php endif; ?>
+                                       <option value="pending"><?php _e( 'Pending Review' ); ?></option>
+                                       <option value="draft"><?php _e( 'Unpublished' ); ?></option>
+                               </select>
+                       </label>
+
+<?php if ( !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ) : ?>
+
+<?php  if ( $bulk ) : ?>
+
+                       <label class="alignright">
+                               <span class="title"><?php _e( 'Sticky' ); ?></span>
+                               <select name="sticky">
+                                       <option value="-1"><?php _e( '- No Change -' ); ?></option>
+                                       <option value="sticky"><?php _e( 'Sticky' ); ?></option>
+                                       <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
+                               </select>
+                       </label>
+
+<?php  else : // $bulk ?>
+
+                       <label class="alignleft">
+                               <input type="checkbox" name="sticky" value="sticky" />
+                               <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
+                       </label>
+
+<?php  endif; // $bulk ?>
+
+<?php endif; // !$is_page && $can_publish && current_user_can( 'edit_others_posts' ) ?>
+
+               </div>
+
+       </div></fieldset>
+
+<?php
+       foreach ( $columns as $column_name => $column_display_name ) {
+               if ( isset( $core_columns[$column_name] ) )
+                       continue;
+               do_action( $bulk ? 'bulk_edit_custom_box' : 'quick_edit_custom_box', $column_name, $type);
+       }
+?>
+       <p class="submit inline-edit-save">
+               <a accesskey="c" href="#inline-edit" title="<?php _e('Cancel'); ?>" class="button-secondary cancel alignleft"><?php _e('Cancel'); ?></a>
+               <?php if ( ! $bulk ) {
+                       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="" />
+               <?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 ); ?>" />
+               <?php } ?>
+               <input type="hidden" name="post_view" value="<?php echo $m; ?>" />
+               <br class="clear" />
+       </p>
+       </td></tr>
+<?php
+       $bulk++;
+       } ?>
+       </tbody></table></form>
+<?php
+}
+
+// adds hidden fields with the data for use in the inline editor for posts and pages
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $post
+ */
+function get_inline_data($post) {
+
+       if ( ! current_user_can('edit_' . $post->post_type, $post->ID) )
+               return;
+
+       $title = attribute_escape($post->post_title);
+
+       echo '
+<div class="hidden" id="inline_' . $post->ID . '">
+       <div class="post_title">' . $title . '</div>
+       <div class="post_name">' . $post->post_name . '</div>
+       <div class="post_author">' . $post->post_author . '</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>';
+
+       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="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="post_category">' . implode( ',', wp_get_post_categories( $post->ID ) ) . '</div>
+       <div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
+
+       echo '</div>';
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $posts
+ */
+function post_rows( $posts = array() ) {
+       global $wp_query, $post, $mode;
+
+       add_filter('the_title','wp_specialchars');
+
+       // Create array of post IDs.
+       $post_ids = array();
+
+       if ( empty($posts) )
+               $posts = &$wp_query->posts;
+
+       foreach ( $posts as $a_post )
+               $post_ids[] = $a_post->ID;
+
+       $comment_pending_count = get_pending_comments_num($post_ids);
+       if ( empty($comment_pending_count) )
+               $comment_pending_count = array();
+
+       foreach ( $posts as $post ) {
+               if ( empty($comment_pending_count[$post->ID]) )
+                       $comment_pending_count[$post->ID] = 0;
+
+               _post_row($post, $comment_pending_count[$post->ID], $mode);
+       }
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $a_post
+ * @param unknown_type $pending_comments
+ * @param unknown_type $mode
+ */
+function _post_row($a_post, $pending_comments, $mode) {
+       global $post;
+       static $rowclass;
+
+       $global_post = $post;
+       $post = $a_post;
+       setup_postdata($post);
+
+       $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
+       global $current_user;
+       $post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
+       $edit_link = get_edit_post_link( $post->ID );
+       $title = _draft_or_post_title();
+?>
+       <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status ); ?> iedit' valign="top">
+<?php
+       $posts_columns = get_column_headers('edit');
+       $hidden = get_hidden_columns('edit');
+       foreach ( $posts_columns as $column_name=>$column_display_name ) {
+               $class = "class=\"$column_name column-$column_name\"";
+
+               $style = '';
+               if ( in_array($column_name, $hidden) )
+                       $style = ' style="display:none;"';
+
+               $attributes = "$class$style";
+
+               switch ($column_name) {
+
+               case 'cb':
+               ?>
+               <th scope="row" class="check-column"><?php if ( current_user_can( 'edit_post', $post->ID ) ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th>
+               <?php
+               break;
+
+               case 'date':
+                       if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
+                               $t_time = $h_time = __('Unpublished');
+                       } 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_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);
+                               }
+                       }
+
+                       echo '<td ' . $attributes . '>';
+                       if ( 'excerpt' == $mode )
+                               echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
+                       else
+                               echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
+                       echo '<br />';
+                       if ( 'publish' == $post->post_status ) {
+                               _e('Published');
+                       } elseif ( 'future' == $post->post_status ) {
+                               if ( isset($missed) )
+                                       echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
+                               else
+                                       _e('Scheduled');
+                       } else {
+                               _e('Last Modified');
+                       }
+                       echo '</td>';
+               break;
+
+               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>
+               <?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>";
+                       }
+                       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>';
+                       } else {
+                               $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+                       }
+                       $action_count = count($actions);
+                       $i = 0;
+                       echo '<div class="row-actions">';
+                       foreach ( $actions as $action => $link ) {
+                               ++$i;
+                               ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                               echo "<span class='$action'>$link$sep</span>";
+                       }
+                       echo '</div>';
+
+                       get_inline_data($post);
+               ?>
+               </td>
+               <?php
+               break;
+
+               case 'categories':
+               ?>
+               <td <?php echo $attributes ?>><?php
+                       $categories = get_the_category();
+                       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>";
+                                       echo join( ', ', $out );
+                       } else {
+                               _e('Uncategorized');
+                       }
+               ?></td>
+               <?php
+               break;
+
+               case 'tags':
+               ?>
+               <td <?php echo $attributes ?>><?php
+                       $tags = get_the_tags($post->ID);
+                       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>";
+                               echo join( ', ', $out );
+                       } else {
+                               _e('No Tags');
+                       }
+               ?></td>
+               <?php
+               break;
+
+               case 'comments':
+               ?>
+               <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
+               <?php
+                       $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>');
+                               if ( $pending_comments )
+                               echo '</strong>';
+               ?>
+               </div></td>
+               <?php
+               break;
+
+               case 'author':
+               ?>
+               <td <?php echo $attributes ?>><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
+               <?php
+               break;
+
+               case 'control_view':
+               ?>
+               <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td>
+               <?php
+               break;
+
+               case 'control_edit':
+               ?>
+               <td><?php if ( current_user_can('edit_post', $post->ID) ) { echo "<a href='$edit_link' class='edit'>" . __('Edit') . "</a>"; } ?></td>
+               <?php
+               break;
+
+               case 'control_delete':
+               ?>
+               <td><?php if ( current_user_can('delete_post', $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td>
+               <?php
+               break;
+
+               default:
+               ?>
+               <td <?php echo $attributes ?>><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td>
+               <?php
+               break;
+       }
+}
+?>
+       </tr>
+<?php
+       $post = $global_post;
+}
+
+/*
+ * display one row if the page doesn't have any children
+ * otherwise, display the row and its children in subsequent rows
+ */
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ * @param unknown_type $level
+ */
+function display_page_row( $page, $level = 0 ) {
+       global $post;
+       static $rowclass;
+
+       $post = $page;
+       setup_postdata($page);
+
+       $page->post_title = wp_specialchars( $page->post_title );
+       $pad = str_repeat( '&#8212; ', $level );
+       $id = (int) $page->ID;
+       $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
+       $posts_columns = get_column_headers('edit-pages');
+       $hidden = get_hidden_columns('edit-pages');
+       $title = _draft_or_post_title();
+?>
+<tr id="page-<?php echo $id; ?>" class="<?php echo $rowclass; ?> iedit">
+<?php
+
+foreach ($posts_columns as $column_name=>$column_display_name) {
+       $class = "class=\"$column_name column-$column_name\"";
+
+       $style = '';
+       if ( in_array($column_name, $hidden) )
+               $style = ' style="display:none;"';
+
+       $attributes = "$class$style";
+
+       switch ($column_name) {
+
+       case 'cb':
+               ?>
+               <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th>
+               <?php
+               break;
+       case 'date':
+               if ( '0000-00-00 00:00:00' == $page->post_date && 'date' == $column_name ) {
+                       $t_time = $h_time = __('Unpublished');
+               } 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 {
+                               $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 />';
+               if ( 'publish' == $page->post_status || 'future' == $page->post_status )
+                       _e('Published');
+               else
+                       _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 );
+               ?>
+               <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>
+               <?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['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>";
+               }
+               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>';
+               } else {
+                       $actions['view'] = '<a href="' . get_permalink($page->ID) . '" title="' . attribute_escape(sprintf(__('View "%s"'), $title)) . '" rel="permalink">' . __('View') . '</a>';
+               }
+               $action_count = count($actions);
+
+               $i = 0;
+               echo '<div class="row-actions">';
+               foreach ( $actions as $action => $link ) {
+                       ++$i;
+                       ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                       echo "<span class='$action'>$link$sep</span>";
+               }
+               echo '</div>';
+
+               get_inline_data($post);
+               echo '</td>';
+               break;
+
+       case 'comments':
+               ?>
+               <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
+               <?php
+               $left = get_pending_comments_num( $page->ID );
+               $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>');
+               if ( $left )
+                       echo '</strong>';
+               ?>
+               </div></td>
+               <?php
+               break;
+
+       case 'author':
+               ?>
+               <td <?php echo $attributes ?>><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>
+               <?php
+               break;
+
+       default:
+               ?>
+               <td <?php echo $attributes ?>><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td>
+               <?php
+               break;
+       }
+}
+?>
+
+</tr>
+
+<?php
+}
+
+/*
+ * displays pages in hierarchical order with paging support
+ */
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $pages
+ * @param unknown_type $pagenum
+ * @param unknown_type $per_page
+ * @return unknown
+ */
+function page_rows($pages, $pagenum = 1, $per_page = 20) {
+       global $wpdb;
+
+       $level = 0;
+
+       if ( ! $pages ) {
+               $pages = get_pages( array('sort_column' => 'menu_order') );
+
+               if ( ! $pages )
+                       return false;
+       }
+
+       /*
+        * arrange pages into two parts: top level pages and children_pages
+        * children_pages is two dimensional array, eg.
+        * children_pages[10][] contains all sub-pages whose parent is 10.
+        * It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
         * If searching, ignore hierarchy and treat everything as top level
         */
         * If searching, ignore hierarchy and treat everything as top level
         */
-       if ( empty($_GET['s']) )  {
-               
+       if ( empty($_GET['s']) ) {
+
                $top_level_pages = array();
                $top_level_pages = array();
-               $children_pages  = array();
-               
+               $children_pages = array();
+
                foreach ( $pages as $page ) {
                foreach ( $pages as $page ) {
-                       
+
                        // catch and repair bad pages
                        if ( $page->post_parent == $page->ID ) {
                                $page->post_parent = 0;
                                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
                                clean_page_cache( $page->ID );
                        }
                        // catch and repair bad pages
                        if ( $page->post_parent == $page->ID ) {
                                $page->post_parent = 0;
                                $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
                                clean_page_cache( $page->ID );
                        }
-       
+
                        if ( 0 == $page->post_parent )
                                $top_level_pages[] = $page;
                        else
                        if ( 0 == $page->post_parent )
                                $top_level_pages[] = $page;
                        else
@@ -570,7 +1693,7 @@ function page_rows($pages, $pagenum = 1, $per_page = 20) {
        $count = 0;
        $start = ($pagenum - 1) * $per_page;
        $end = $start + $per_page;
        $count = 0;
        $start = ($pagenum - 1) * $per_page;
        $end = $start + $per_page;
-       
+
        foreach ( $pages as $page ) {
                if ( $count >= $end )
                        break;
        foreach ( $pages as $page ) {
                if ( $count >= $end )
                        break;
@@ -583,7 +1706,7 @@ function page_rows($pages, $pagenum = 1, $per_page = 20) {
                if ( isset($children_pages) )
                        _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
        }
                if ( isset($children_pages) )
                        _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
        }
-       
+
        // if it is the last pagenum and there are orphaned pages, display them with paging as well
        if ( isset($children_pages) && $count < $end ){
                foreach( $children_pages as $orphans ){
        // if it is the last pagenum and there are orphaned pages, display them with paging as well
        if ( isset($children_pages) && $count < $end ){
                foreach( $children_pages as $orphans ){
@@ -602,19 +1725,31 @@ function page_rows($pages, $pagenum = 1, $per_page = 20) {
  * Given a top level page ID, display the nested hierarchy of sub-pages
  * together with paging support
  */
  * Given a top level page ID, display the nested hierarchy of sub-pages
  * together with paging support
  */
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $children_pages
+ * @param unknown_type $count
+ * @param unknown_type $parent
+ * @param unknown_type $level
+ * @param unknown_type $pagenum
+ * @param unknown_type $per_page
+ */
 function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
 function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
-       
+
        if ( ! isset( $children_pages[$parent] ) )
        if ( ! isset( $children_pages[$parent] ) )
-               return; 
-               
+               return;
+
        $start = ($pagenum - 1) * $per_page;
        $end = $start + $per_page;
        $start = ($pagenum - 1) * $per_page;
        $end = $start + $per_page;
-       
+
        foreach ( $children_pages[$parent] as $page ) {
        foreach ( $children_pages[$parent] as $page ) {
-               
+
                if ( $count >= $end )
                        break;
                if ( $count >= $end )
                        break;
-                       
+
                // If the page starts in a subtree, print the parents.
                if ( $count == $start && $page->post_parent > 0 ) {
                        $my_parents = array();
                // If the page starts in a subtree, print the parents.
                if ( $count == $start && $page->post_parent > 0 ) {
                        $my_parents = array();
@@ -635,20 +1770,30 @@ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_
 
                if ( $count >= $start )
                        echo "\t" . display_page_row( $page, $level );
 
                if ( $count >= $start )
                        echo "\t" . display_page_row( $page, $level );
-                       
+
                $count++;
 
                _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
        }
                $count++;
 
                _page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
        }
-       
+
        unset( $children_pages[$parent] ); //required in order to keep track of orphans
 }
 
        unset( $children_pages[$parent] ); //required in order to keep track of orphans
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $user_object
+ * @param unknown_type $style
+ * @param unknown_type $role
+ * @return unknown
+ */
 function user_row( $user_object, $style = '', $role = '' ) {
        global $wp_roles;
 
        $current_user = wp_get_current_user();
 function user_row( $user_object, $style = '', $role = '' ) {
        global $wp_roles;
 
        $current_user = wp_get_current_user();
-       
+
        if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
                $user_object = new WP_User( (int) $user_object );
        $email = $user_object->user_email;
        if ( !( is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) )
                $user_object = new WP_User( (int) $user_object );
        $email = $user_object->user_email;
@@ -658,42 +1803,98 @@ function user_row( $user_object, $style = '', $role = '' ) {
        if ('/' == substr( $short_url, -1 ))
                $short_url = substr( $short_url, 0, -1 );
        if ( strlen( $short_url ) > 35 )
        if ('/' == substr( $short_url, -1 ))
                $short_url = substr( $short_url, 0, -1 );
        if ( strlen( $short_url ) > 35 )
-               $short_url =  substr( $short_url, 0, 32 ).'...';
+               $short_url = substr( $short_url, 0, 32 ).'...';
        $numposts = get_usernumposts( $user_object->ID );
        if ( current_user_can( 'edit_user', $user_object->ID ) ) {
                if ($current_user->ID == $user_object->ID) {
        $numposts = get_usernumposts( $user_object->ID );
        if ( current_user_can( 'edit_user', $user_object->ID ) ) {
                if ($current_user->ID == $user_object->ID) {
-                       $edit = 'profile.php';
+                       $edit_link = 'profile.php';
                } else {
                } else {
-                       $edit = 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 = clean_url( add_query_arg( 'wp_http_referer', urlencode( clean_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 />";
+               $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>";
+               $action_count = count($actions);
+               $i = 0;
+               $edit .= '<div class="row-actions">';
+               foreach ( $actions as $action => $link ) {
+                       ++$i;
+                       ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                       $edit .= "<span class='$action'>$link$sep</span>";
                }
                }
-               $edit = "<a href=\"$edit\">$user_object->user_login</a>";
+               $edit .= '</div>';
        } else {
        } else {
-               $edit = $user_object->user_login;
+               $edit = '<strong>' . $user_object->user_login . '</strong>';
        }
        }
-       $role_name = $wp_roles->role_names[$role] ? translate_with_context($wp_roles->role_names[$role]) : __('None');
-       $r = "<tr id='user-$user_object->ID'$style>
-               <th scope='row' class='check-column'><input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='$role' value='{$user_object->ID}' /></th>
-               <td><strong>$edit</strong></td>
-               <td>$user_object->first_name $user_object->last_name</td>
-               <td><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>
-               <td>$role_name</td>";
-       $r .= "\n\t\t<td class='num'>";
-       if ( $numposts > 0 ) {
-               $r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
-               $r .= $numposts;
-               $r .= '</a>';
-       } else {
-               $r .= 0;
+       $role_name = isset($wp_roles->role_names[$role]) ? translate_with_context($wp_roles->role_names[$role]) : __('None');
+       $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 );
+       foreach ( $columns as $column_name => $column_display_name ) {
+               $class = "class=\"$column_name column-$column_name\"";
+
+               $style = '';
+               if ( in_array($column_name, $hidden) )
+                       $style = ' style="display:none;"';
+
+               $attributes = "$class$style";
+
+               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>";
+                               break;
+                       case 'username':
+                               $r .= "<td $attributes>$avatar $edit</td>";
+                               break;
+                       case 'name':
+                               $r .= "<td $attributes>$user_object->first_name $user_object->last_name</td>";
+                               break;
+                       case 'email':
+                               $r .= "<td $attributes><a href='mailto:$email' title='" . sprintf( __('e-mail: %s' ), $email ) . "'>$email</a></td>";
+                               break;
+                       case 'role':
+                               $r .= "<td $attributes>$role_name</td>";
+                               break;
+                       case 'posts':
+                               $attributes = 'class="posts column-posts num"' . $style;
+                               $r .= "<td $attributes>";
+                               if ( $numposts > 0 ) {
+                                       $r .= "<a href='edit.php?author=$user_object->ID' title='" . __( 'View posts by this author' ) . "' class='edit'>";
+                                       $r .= $numposts;
+                                       $r .= '</a>';
+                               } else {
+                                       $r .= 0;
+                               }
+                               $r .= "</td>";
+               }
        }
        }
-       $r .= "</td>\n\t</tr>";
+       $r .= '</tr>';
+
        return $r;
 }
 
        return $r;
 }
 
-function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $status
+ * @param unknown_type $s
+ * @param unknown_type $start
+ * @param unknown_type $num
+ * @param unknown_type $post
+ * @param unknown_type $type
+ * @return unknown
+ */
+function _wp_get_comment_list( $status = '', $s = false, $start, $num, $post = 0, $type = '' ) {
        global $wpdb;
 
        $start = abs( (int) $start );
        $num = (int) $num;
        global $wpdb;
 
        $start = abs( (int) $start );
        $num = (int) $num;
+       $post = (int) $post;
 
        if ( 'moderated' == $status )
                $approved = "comment_approved = '0'";
 
        if ( 'moderated' == $status )
                $approved = "comment_approved = '0'";
@@ -704,6 +1905,25 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
        else
                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
 
        else
                $approved = "( comment_approved = '0' OR comment_approved = '1' )";
 
+       if ( $post ) {
+               $post = " AND comment_post_ID = '$post'";
+               $orderby = "ORDER BY comment_date_gmt ASC LIMIT $start, $num";
+       } else {
+               $post = '';
+               $orderby = "ORDER BY comment_date_gmt DESC LIMIT $start, $num";
+       }
+
+       if ( 'comment' == $type )
+               $typesql = "AND comment_type = ''";
+       elseif ( 'pingback' == $type )
+               $typesql = "AND comment_type = 'pingback'";
+       elseif ( 'trackback' == $type )
+               $typesql = "AND comment_type = 'trackback'";
+       elseif ( 'pings' == $type )
+               $typesql = "AND ( comment_type = 'pingback' OR comment_type = 'trackback' )";
+       else
+               $typesql = '';
+
        if ( $s ) {
                $s = $wpdb->escape($s);
                $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
        if ( $s ) {
                $s = $wpdb->escape($s);
                $comments = $wpdb->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE
@@ -713,9 +1933,10 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
                        comment_author_IP LIKE ('%$s%') OR
                        comment_content LIKE ('%$s%') ) AND
                        $approved
                        comment_author_IP LIKE ('%$s%') OR
                        comment_content LIKE ('%$s%') ) AND
                        $approved
-                       ORDER BY comment_date_gmt DESC LIMIT $start, $num");
+                       $typesql
+                       $orderby");
        } else {
        } else {
-               $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved ORDER BY comment_date_gmt DESC LIMIT $start, $num" );
+               $comments = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->comments WHERE $approved $post $typesql $orderby" );
        }
 
        update_comment_cache($comments);
        }
 
        update_comment_cache($comments);
@@ -725,30 +1946,28 @@ function _wp_get_comment_list( $status = '', $s = false, $start, $num ) {
        return array($comments, $total);
 }
 
        return array($comments, $total);
 }
 
-function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true ) {
-       global $comment, $post;
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $comment_id
+ * @param unknown_type $mode
+ * @param unknown_type $comment_status
+ * @param unknown_type $checkbox
+ */
+function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true, $from_ajax = false ) {
+       global $comment, $post, $_comment_pending_count;
        $comment = get_comment( $comment_id );
        $post = get_post($comment->comment_post_ID);
        $comment = get_comment( $comment_id );
        $post = get_post($comment->comment_post_ID);
-       $authordata = get_userdata($post->post_author);
        $the_comment_status = wp_get_comment_status($comment->comment_ID);
        $the_comment_status = wp_get_comment_status($comment->comment_ID);
-       $class = ('unapproved' == $the_comment_status) ? 'unapproved' : '';
-
-       if ( current_user_can( 'edit_post', $post->ID ) ) {
-               $post_link = "<a href='" . get_comment_link() . "'>";
 
 
-               $post_link .= get_the_title($comment->comment_post_ID) . '</a>';
-                       
-               $edit_link_start = "<a class='row-title' href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . __('Edit comment') . "'>";
-               $edit_link_end = '</a>';
-       } else {
-               $post_link = get_the_title($comment->comment_post_ID);
-               $edit_link_start = $edit_link_end ='';
-       }
-       
        $author_url = get_comment_author_url();
        if ( 'http://' == $author_url )
                $author_url = '';
        $author_url_display = $author_url;
        $author_url = get_comment_author_url();
        if ( 'http://' == $author_url )
                $author_url = '';
        $author_url_display = $author_url;
+       $author_url_display = str_replace('http://www.', '', $author_url_display);
+       $author_url_display = str_replace('http://', '', $author_url_display);
        if ( strlen($author_url_display) > 50 )
                $author_url_display = substr($author_url_display, 0, 49) . '...';
 
        if ( strlen($author_url_display) > 50 )
                $author_url_display = substr($author_url_display, 0, 49) . '...';
 
@@ -758,62 +1977,235 @@ 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=$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 = 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" ) );
 
 
-?>
-  <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'>
-<?php if ( $checkbox ) : ?>
-    <td class="check-column"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td>
-<?php endif; ?>
-    <td class="comment">
-    <p class="comment-author"><strong><?php echo $edit_link_start; comment_author(); echo $edit_link_end; ?></strong><br />
-    <?php if ( !empty($author_url) ) : ?>
-    <a href="<?php echo $author_url ?>"><?php echo $author_url_display; ?></a> |
-    <?php endif; ?>
-    <?php if ( current_user_can( 'edit_post', $post->ID ) ) : ?>
-    <?php if ( !empty($comment->comment_author_email) ): ?>
-    <?php comment_author_email_link() ?> |
-    <?php endif; ?>
-    <a href="edit-comments.php?s=<?php comment_author_IP() ?>&amp;mode=detail"><?php comment_author_IP() ?></a>
-       <?php endif; //current_user_can?>    
-    </p>
-       <?php if ( 'detail' == $mode ) comment_text(); ?>
-       <p><?php printf(__('From %1$s, %2$s'), $post_link, $ptime) ?></p>
-    </td>
-    <td><?php comment_date(__('Y/m/d')); ?></td>
-    <td class="action-links">
-<?php
+       echo "<tr id='comment-$comment->comment_ID' class='$the_comment_status'>";
+       $columns = get_column_headers('edit-comments');
+       $hidden = get_hidden_columns('edit-comments');
+       foreach ( $columns as $column_name => $column_display_name ) {
+               $class = "class=\"$column_name column-$column_name\"";
 
 
-       $actions = array();
+               $style = '';
+               if ( in_array($column_name, $hidden) )
+                       $style = ' style="display:none;"';
 
 
-       if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
-               $actions['approve']   = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' 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' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
+               $attributes = "$class$style";
 
 
-               // we're looking at list of only approved or only unapproved comments
-               if ( 'moderated' == $comment_status ) {
-                       $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
-                       unset($actions['unapprove']);
-               } elseif ( 'approved' == $comment_status ) {
-                       $actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
-                       unset($actions['approve']);
+               switch ($column_name) {
+                       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' />";
+                               echo '</th>';
+                               break;
+                       case 'comment':
+                               echo "<td $attributes>";
+                               echo '<div id="submitted-on">';
+                               printf(__('Submitted on <a href="%1$s">%2$s at %3$s</a>'), get_comment_link($comment->comment_ID), get_comment_date(__('Y/m/d')), get_comment_date(__('g:ia')));
+                               echo '</div>';
+                               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="comment_status"><?php echo $comment->comment_approved; ?></div>
+                               </div>
+                               <?php
+                               $actions = array();
+
+                               if ( current_user_can('edit_post', $post->ID) ) {
+                                       $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 ( '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']);
+                                               } else {
+                                                       $actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&amp;new=approved vim-a vim-destructive' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
+                                                       unset($actions['unapprove']);
+                                               }
+                                       }
+                                       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['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>';
+                                       if ( 'spam' != $the_comment_status )
+                                               $actions['reply'] = '<a onclick="commentReply.open(\''.$comment->comment_ID.'\',\''.$post->ID.'\');return false;" class="vim-r" title="'.__('Reply to this comment').'" href="#">' . __('Reply') . '</a>';
+
+                                       $actions = apply_filters( 'comment_row_actions', $actions, $comment );
+
+                                       $i = 0;
+                                       echo '<div class="row-actions">';
+                                       foreach ( $actions as $action => $link ) {
+                                               ++$i;
+                                               ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
+
+                                               // Reply and quickedit need a hide-if-no-js span when not added with ajax
+                                               if ( ('reply' == $action || 'quickedit' == $action) && ! $from_ajax )
+                                                       $action .= ' hide-if-no-js';
+
+                                               echo "<span class='$action'>$sep$link</span>";
+                                       }
+                                       echo '</div>';
+                               }
+
+                               echo '</td>';
+                               break;
+                       case 'author':
+                               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 ( !empty($comment->comment_author_email) ) {
+                                               comment_author_email_link();
+                                               echo '<br />';
+                                       }
+                                       echo '<a href="edit-comments.php?s=';
+                                       comment_author_IP();
+                                       echo '&amp;mode=detail';
+                                       if ( 'spam' == $comment_status )
+                                               echo '&amp;comment_status=spam';
+                                       echo '">';
+                                       comment_author_IP();
+                                       echo '</a>';
+                               } //current_user_can
+                               echo '</td>';
+                               break;
+                       case 'date':
+                               echo "<td $attributes>" . get_comment_date(__('Y/m/d \a\t g:ia')) . '</td>';
+                               break;
+                       case 'response':
+                               if ( 'single' !== $mode ) {
+                                       if ( isset( $_comment_pending_count[$post->ID] ) ) {
+                                               $pending_comments = absint( $_comment_pending_count[$post->ID] );
+                                       } else {
+                                               $_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 ) ) {
+                                               $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">';
+                                       $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>');
+                                       if ( $pending_comments )
+                                               echo '</strong>';
+                                       echo '</span> ';
+                                       echo "<a href='" . get_permalink( $post->ID ) . "'>#</a>";
+                                       echo '</div></td>';
+                               }
                }
                }
+       }
+       echo "</tr>\n";
+}
 
 
-               $actions['spam']      = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
-               $actions['delete']    = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
-               $actions = apply_filters( 'comment_row_actions', $actions, $comment );
-               foreach ( $actions as $action => $link )
-                       echo "<span class='$action'>$link</span>";
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $position
+ * @param unknown_type $checkbox
+ * @param unknown_type $mode
+ */
+function wp_comment_reply($position = '1', $checkbox = false, $mode = 'single', $table_row = true) {
+       global $current_user;
+
+       // allow plugin to replace the popup content
+       $content = apply_filters( 'wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode) );
+
+       if ( ! empty($content) ) {
+               echo $content;
+               return;
        }
        }
-       ?>
-       </td>
-  </tr>
-       <?php
+
+       $columns = get_column_headers('edit-comments');
+       $hidden = array_intersect( array_keys( $columns ), array_filter( get_hidden_columns('edit-comments') ) );
+       $col_count = count($columns) - count($hidden);
+
+?>
+<form method="get" action="">
+<?php if ( $table_row ) : ?>
+<table style="display:none;"><tbody id="com-reply"><tr id="replyrow"><td colspan="<?php echo $col_count; ?>">
+<?php else : ?>
+<div id="com-reply" style="display:none;"><div id="replyrow">
+<?php endif; ?>
+       <div id="replyhead" style="display:none;"><?php _e('Reply to Comment'); ?></div>
+
+       <div id="edithead" style="display:none;">
+               <div class="inside">
+               <label for="author"><?php _e('Name') ?></label>
+               <input type="text" name="newcomment_author" size="50" value="" tabindex="101" id="author" />
+               </div>
+
+               <div class="inside">
+               <label for="author-email"><?php _e('E-mail') ?></label>
+               <input type="text" name="newcomment_author_email" size="50" value="" tabindex="102" id="author-email" />
+               </div>
+
+               <div class="inside">
+               <label for="author-url"><?php _e('URL') ?></label>
+               <input type="text" id="author-url" name="newcomment_author_url" size="103" value="" tabindex="103" />
+               </div>
+               <div style="clear:both;"></div>
+       </div>
+
+       <div id="replycontainer"><textarea rows="8" cols="40" name="replycontent" tabindex="104" id="replycontent"></textarea></div>
+
+       <p id="replysubmit" class="submit">
+       <a href="#comments-form" class="cancel button-secondary alignleft" tabindex="106"><?php _e('Cancel'); ?></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="" />
+       <span class="error" style="display:none;"></span>
+       <br class="clear" />
+       </p>
+
+       <input type="hidden" name="user_ID" id="user_ID" value="<?php echo $current_user->ID; ?>" />
+       <input type="hidden" name="action" id="action" value="" />
+       <input type="hidden" name="comment_ID" id="comment_ID" value="" />
+       <input type="hidden" name="comment_post_ID" id="comment_post_ID" value="" />
+       <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; ?>" />
+       <?php wp_nonce_field( 'replyto-comment', '_ajax_nonce', false ); ?>
+       <?php wp_comment_form_unfiltered_html_nonce(); ?>
+<?php if ( $table_row ) : ?>
+</td></tr></tbody></table>
+<?php else : ?>
+</div></div>
+<?php endif; ?>
+</form>
+<?php
 }
 
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $currentcat
+ * @param unknown_type $currentparent
+ * @param unknown_type $parent
+ * @param unknown_type $level
+ * @param unknown_type $categories
+ * @return unknown
+ */
 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
        if (!$categories )
                $categories = get_categories( array('hide_empty' => 0) );
 function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
        if (!$categories )
                $categories = get_categories( array('hide_empty' => 0) );
@@ -835,28 +2227,58 @@ function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $le
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $meta
+ */
 function list_meta( $meta ) {
        // Exit if no meta
 function list_meta( $meta ) {
        // Exit if no meta
-       if (!$meta ) {
-               echo '<tbody id="the-list" class="list:meta"><tr style="display: none;"><td>&nbsp;</td></tr></tbody>'; //TBODY needed for list-manipulation JS
+       if ( ! $meta ) {
+               echo '
+<table id="list-table" style="display: none;">
+       <thead>
+       <tr>
+               <th class="left">' . __( 'Name' ) . '</th>
+               <th>' . __( 'Value' ) . '</th>
+       </tr>
+       </thead>
+       <tbody id="the-list" class="list:meta">
+       <tr><td></td></tr>
+       </tbody>
+</table>'; //TBODY needed for list-manipulation JS
                return;
        }
        $count = 0;
 ?>
                return;
        }
        $count = 0;
 ?>
+<table id="list-table">
        <thead>
        <tr>
        <thead>
        <tr>
-               <th><?php _e( 'Key' ) ?></th>
+               <th class="left"><?php _e( 'Name' ) ?></th>
                <th><?php _e( 'Value' ) ?></th>
                <th><?php _e( 'Value' ) ?></th>
-               <th colspan='2'><?php _e( 'Action' ) ?></th>
        </tr>
        </thead>
        <tbody id='the-list' class='list:meta'>
 <?php
        foreach ( $meta as $entry )
                echo _list_meta_row( $entry, $count );
        </tr>
        </thead>
        <tbody id='the-list' class='list:meta'>
 <?php
        foreach ( $meta as $entry )
                echo _list_meta_row( $entry, $count );
-       echo "\n\t</tbody>";
+?>
+       </tbody>
+</table>
+<?php
 }
 
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $entry
+ * @param unknown_type $count
+ * @return unknown
+ */
 function _list_meta_row( $entry, &$count ) {
        static $update_nonce = false;
        if ( !$update_nonce )
 function _list_meta_row( $entry, &$count ) {
        static $update_nonce = false;
        if ( !$update_nonce )
@@ -882,23 +2304,30 @@ function _list_meta_row( $entry, &$count ) {
                }
        }
 
                }
        }
 
-       $entry['meta_key']   = attribute_escape($entry['meta_key']);
+       $entry['meta_key'] = attribute_escape($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 valign='top'><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']}' /></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>";
-       $r .= "\n\t\t<td style='text-align: center;'><input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /><br />";
-       $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
+       $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<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 .= "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 .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
        $r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
-       $r .= "</td>\n\t</tr>";
+       $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>";
        return $r;
 }
 
        return $r;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function meta_form() {
        global $wpdb;
        $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
 function meta_form() {
        global $wpdb;
        $limit = (int) apply_filters( 'postmeta_form_limit', 30 );
@@ -912,44 +2341,65 @@ function meta_form() {
        if ( $keys )
                natcasesort($keys);
 ?>
        if ( $keys )
                natcasesort($keys);
 ?>
-<p><strong><?php _e( 'Add a new custom field:' ) ?></strong></p>
-<table id="newmeta" cellspacing="3" cellpadding="3">
-       <tr>
-<th colspan="2"><label <?php if ( $keys ) : ?> for="metakeyselect" <?php else : ?> for="metakeyinput" <?php endif; ?>><?php _e( 'Key' ) ?></label></th>
+<p><strong><?php _e( 'Add new custom field:' ) ?></strong></p>
+<table id="newmeta">
+<thead>
+<tr>
+<th class="left"><label for="metakeyselect"><?php _e( 'Name' ) ?></label></th>
 <th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
 </tr>
 <th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
 </tr>
-       <tr valign="top">
-               <td style="width: 18%;" class="textright">
-<?php if ( $keys ) : ?>
+</thead>
+
+<tbody>
+<tr>
+<td id="newmetaleft" class="left">
+<?php if ( $keys ) { ?>
 <select id="metakeyselect" name="metakeyselect" tabindex="7">
 <option value="#NONE#"><?php _e( '- Select -' ); ?></option>
 <?php
 
        foreach ( $keys as $key ) {
                $key = attribute_escape( $key );
 <select id="metakeyselect" name="metakeyselect" tabindex="7">
 <option value="#NONE#"><?php _e( '- Select -' ); ?></option>
 <?php
 
        foreach ( $keys as $key ) {
                $key = attribute_escape( $key );
-               echo "\n\t<option value='$key'>$key</option>";
+               echo "\n<option value='$key'>$key</option>";
        }
 ?>
        }
 ?>
-</select> <label for="metakeyinput"><?php _e( 'or' ); ?></label>
-<?php endif; ?>
+</select>
+<input class="hide-if-js" type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" />
+<a href="#postcustomstuff" class="hide-if-no-js" onclick="jQuery('#metakeyinput, #metakeyselect, #enternew, #cancelnew').toggle();return false;">
+<span id="enternew"><?php _e('Enter new'); ?></span>
+<span id="cancelnew" class="hidden"><?php _e('Cancel'); ?></span></a>
+<?php } else { ?>
+<input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" value="" />
+<?php } ?>
 </td>
 </td>
-<td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
-               <td><textarea id="metavalue" name="metavalue" rows="3" cols="25" tabindex="8"></textarea></td>
-       </tr>
-<tr class="submit"><td colspan="3">
-       <?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
-       <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
+<td><textarea id="metavalue" name="metavalue" rows="2" cols="25" tabindex="8"></textarea></td>
+</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' ) ?>" />
+<?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
 </td></tr>
 </td></tr>
+</tbody>
 </table>
 <?php
 
 }
 
 </table>
 <?php
 
 }
 
-function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $edit
+ * @param unknown_type $for_post
+ * @param unknown_type $tab_index
+ * @param unknown_type $multi
+ */
+function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
        global $wp_locale, $post, $comment;
 
        if ( $for_post )
        global $wp_locale, $post, $comment;
 
        if ( $for_post )
-               $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date || '0000-00-00 00:00:00' == $post->post_date ) ) ? false : true;
+               $edit = ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) ) ? false : true;
 
        $tab_index_attribute = '';
        if ( (int) $tab_index > 0 )
 
        $tab_index_attribute = '';
        if ( (int) $tab_index > 0 )
@@ -966,29 +2416,55 @@ function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {
        $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
        $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
 
        $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj );
        $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj );
 
-       $month = "<select id=\"mm\" name=\"mm\"$tab_index_attribute>\n";
+       $cur_jj = gmdate( 'd', $time_adj );
+       $cur_mm = gmdate( 'm', $time_adj );
+       $cur_aa = gmdate( 'Y', $time_adj );
+       $cur_hh = gmdate( 'H', $time_adj );
+       $cur_mn = gmdate( 'i', $time_adj );
+
+       $month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n";
        for ( $i = 1; $i < 13; $i = $i +1 ) {
                $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
                if ( $i == $mm )
                        $month .= ' selected="selected"';
        for ( $i = 1; $i < 13; $i = $i +1 ) {
                $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"';
                if ( $i == $mm )
                        $month .= ' selected="selected"';
-               $month .= '>' . $wp_locale->get_month( $i ) . "</option>\n";
+               $month .= '>' . $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) . "</option>\n";
        }
        $month .= '</select>';
 
        }
        $month .= '</select>';
 
-       $day = '<input type="text" id="jj" name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />';
-       $year = '<input type="text" id="aa" name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off"  />';
-       $hour = '<input type="text" id="hh" name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />';
-       $minute = '<input type="text" id="mn" name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />';
-       printf(_c('%1$s%2$s, %3$s <br />@ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute);
+       $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" />';
+       $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);
+
+       echo '<input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
+
+       if ( $multi ) return;
+
        echo "\n\n";
        echo "\n\n";
-       foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit )
+       foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) {
                echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
                echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n";
+               $cur_timeunit = 'cur_' . $timeunit;
+               echo '<input type="hidden" id="'. $cur_timeunit . '" name="'. $cur_timeunit . '" value="' . $$cur_timeunit . '" />' . "\n";
+       }
 ?>
 
 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" />
 ?>
 
 <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>
 <?php
 }
 
 <?php
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $default
+ */
 function page_template_dropdown( $default = '' ) {
        $templates = get_page_templates();
        ksort( $templates );
 function page_template_dropdown( $default = '' ) {
        $templates = get_page_templates();
        ksort( $templates );
@@ -1001,6 +2477,16 @@ function page_template_dropdown( $default = '' ) {
        endforeach;
 }
 
        endforeach;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $default
+ * @param unknown_type $parent
+ * @param unknown_type $level
+ * @return unknown
+ */
 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
        global $wpdb, $post_ID;
        $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
 function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
        global $wpdb, $post_ID;
        $items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
@@ -1019,7 +2505,7 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
                        else
                                $current = '';
 
                        else
                                $current = '';
 
-                       echo "\n\t<option value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";
+                       echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";
                        parent_dropdown( $default, $item->ID, $level +1 );
                }
        } else {
                        parent_dropdown( $default, $item->ID, $level +1 );
                }
        } else {
@@ -1027,16 +2513,26 @@ function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function browse_happy() {
        $getit = __( 'WordPress recommends a better browser' );
        echo '
 function browse_happy() {
        $getit = __( 'WordPress recommends a better browser' );
        echo '
-               <span id="bh" class="alignright"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></span>
-               ';
+               <div id="bh"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></div>
+';
 }
 
 }
 
-if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)
-       add_action( 'in_admin_footer', 'browse_happy' );
-
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $id
+ * @return unknown
+ */
 function the_attachment_links( $id = false ) {
        $id = (int) $id;
        $post = & get_post( $id );
 function the_attachment_links( $id = false ) {
        $id = (int) $id;
        $post = & get_post( $id );
@@ -1068,7 +2564,7 @@ function the_attachment_links( $id = false ) {
 <?php else : ?>
        <tr>
                <th scope="row"><?php _e( 'Link to file' ) ?></th>
 <?php else : ?>
        <tr>
                <th scope="row"><?php _e( 'Link to file' ) ?></th>
-               <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() );  ?></a></textarea></td>
+               <td><textarea rows="1" cols="40" type="text" class="attachmentlinks" readonly="readonly"><a href="<?php echo wp_get_attachment_url(); ?>" class="attachmentlink"><?php echo basename( wp_get_attachment_url() ); ?></a></textarea></td>
        </tr>
        <tr>
                <th scope="row"><?php _e( 'Link to page' ) ?></th>
        </tr>
        <tr>
                <th scope="row"><?php _e( 'Link to page' ) ?></th>
@@ -1080,8 +2576,16 @@ function the_attachment_links( $id = false ) {
 <?php
 }
 
 <?php
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $default
+ */
 function wp_dropdown_roles( $default = false ) {
        global $wp_roles;
 function wp_dropdown_roles( $default = false ) {
        global $wp_roles;
+       $p = '';
        $r = '';
        foreach( $wp_roles->role_names as $role => $name ) {
                $name = translate_with_context($name);
        $r = '';
        foreach( $wp_roles->role_names as $role => $name ) {
                $name = translate_with_context($name);
@@ -1093,6 +2597,14 @@ function wp_dropdown_roles( $default = false ) {
        echo $p . $r;
 }
 
        echo $p . $r;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $size
+ * @return unknown
+ */
 function wp_convert_hr_to_bytes( $size ) {
        $size = strtolower($size);
        $bytes = (int) $size;
 function wp_convert_hr_to_bytes( $size ) {
        $size = strtolower($size);
        $bytes = (int) $size;
@@ -1105,6 +2617,14 @@ function wp_convert_hr_to_bytes( $size ) {
        return $bytes;
 }
 
        return $bytes;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $bytes
+ * @return unknown
+ */
 function wp_convert_bytes_to_hr( $bytes ) {
        $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
        $log = log( $bytes, 1024 );
 function wp_convert_bytes_to_hr( $bytes ) {
        $units = array( 0 => 'B', 1 => 'kB', 2 => 'MB', 3 => 'GB' );
        $log = log( $bytes, 1024 );
@@ -1113,6 +2633,13 @@ function wp_convert_bytes_to_hr( $bytes ) {
        return $size . $units[$power];
 }
 
        return $size . $units[$power];
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function wp_max_upload_size() {
        $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
        $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
 function wp_max_upload_size() {
        $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
        $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
@@ -1120,6 +2647,13 @@ function wp_max_upload_size() {
        return $bytes;
 }
 
        return $bytes;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $action
+ */
 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 );
@@ -1139,6 +2673,11 @@ function wp_import_upload_form( $action ) {
 <?php
 }
 
 <?php
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
 function wp_remember_old_slug() {
        global $post;
        $name = attribute_escape($post->post_name); // just in case
 function wp_remember_old_slug() {
        global $post;
        $name = attribute_escape($post->post_name); // just in case
@@ -1147,53 +2686,60 @@ function wp_remember_old_slug() {
 }
 
 /**
 }
 
 /**
- * add_meta_box() - Add a meta box to an edit form
+ * Add a meta box to an edit form.
  *
  *
- * @since 2.5
+ * @since 2.5.0
  *
  * @param string $id String for use in the 'id' attribute of tags.
  *
  * @param string $id String for use in the 'id' attribute of tags.
- * @param string $title Title of the meta box
- * @param string $callback Function that fills the box with the desired content.  The function should echo its output.
- * @param string $page The type of edit page on which to show the box (post, page, link)
- * @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 $title Title of the meta box.
+ * @param string $callback Function that fills the box with the desired content. The function should echo its output.
+ * @param string $page The type of edit page on which to show the box (post, page, link).
+ * @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') {
        global $wp_meta_boxes;
 
  */
 function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
        global $wp_meta_boxes;
 
-       
-       if  ( !isset($wp_meta_boxes) )
+       if ( !isset($wp_meta_boxes) )
                $wp_meta_boxes = array();
        if ( !isset($wp_meta_boxes[$page]) )
                $wp_meta_boxes[$page] = array();
        if ( !isset($wp_meta_boxes[$page][$context]) )
                $wp_meta_boxes[$page][$context] = array();
 
                $wp_meta_boxes = array();
        if ( !isset($wp_meta_boxes[$page]) )
                $wp_meta_boxes[$page] = array();
        if ( !isset($wp_meta_boxes[$page][$context]) )
                $wp_meta_boxes[$page][$context] = array();
 
+       foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
        foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
        foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
-               if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
+               if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
                        continue;
                        continue;
+
                // If a core box was previously added or removed by a plugin, don't add.
                if ( 'core' == $priority ) {
                        // If core box previously deleted, don't add
                // If a core box was previously added or removed by a plugin, don't add.
                if ( 'core' == $priority ) {
                        // If core box previously deleted, don't add
-                       if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
+                       if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
                                return;
                        // If box was added with default priority, give it core priority to maintain sort order
                        if ( 'default' == $a_priority ) {
                                return;
                        // If box was added with default priority, give it core priority to maintain sort order
                        if ( 'default' == $a_priority ) {
-                               $wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
-                               unset($wp_meta_boxes[$page][$context]['default'][$id]);
+                               $wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
+                               unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
                        }
                        return;
                }
                // If no priority given and id already present, use existing priority
                        }
                        return;
                }
                // If no priority given and id already present, use existing priority
-               if ( empty($priority) )
+               if ( empty($priority) ) {
                        $priority = $a_priority;
                        $priority = $a_priority;
-               // An id can be in only one priority
-               if ( $priority != $a_priority )
-                       unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
+               // else if we're adding to the sorted priortiy, we don't know the title or callback. Glab them from the previously added context/priority.
+               } 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'];
+               }
+               // An id can be in only one priority and one context
+               if ( $priority != $a_priority || $context != $a_context )
+                       unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
+       }
        }
 
        if ( empty($priority) )
        }
 
        if ( empty($priority) )
-               $priority = low;
+               $priority = 'low';
 
        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();
@@ -1201,41 +2747,80 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
        $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);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ * @param unknown_type $context
+ * @param unknown_type $object
+ * @return int number of meta_boxes
+ */
 function do_meta_boxes($page, $context, $object) {
        global $wp_meta_boxes;
 function do_meta_boxes($page, $context, $object) {
        global $wp_meta_boxes;
+       static $already_sorted = false;
 
 
-       do_action('do_meta_boxes', $page, $context, $object);
+       //do_action('do_meta_boxes', $page, $context, $object);
 
 
-       if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
-               return;
+       $hidden = get_hidden_meta_boxes($page);
 
 
-       foreach ( array('high', 'core', 'default', 'low') as $priority ) {
-               foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
-                       if ( false === $box )
-                               continue;
-                       echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
-                       echo "<h3>{$box['title']}</h3>\n";
-                       echo '<div class="inside">' . "\n";
-                       call_user_func($box['callback'], $object, $box);
-                       echo "</div>\n";
-                       echo "</div>\n";
+       echo "<div id='$context-sortables' class='meta-box-sortables'>\n";
+
+       $i = 0;
+       do {
+               // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
+               if ( !$already_sorted && $sorted = get_user_option( "meta-box-order_$page", 0, false ) ) {
+                       foreach ( $sorted as $box_context => $ids )
+                               foreach ( explode(',', $ids) as $id )
+                                       if ( $id )
+                                               add_meta_box( $id, null, null, $page, $box_context, 'sorted' );
                }
                }
-       }
+               $already_sorted = true;
+
+               if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
+                       break;
+
+               foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) {
+                       if ( isset($wp_meta_boxes[$page][$context][$priority]) ) {
+                               foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
+                                       if ( false == $box || ! $box['title'] )
+                                               continue;
+                                       $i++;
+                                       $style = '';
+                                       if ( in_array($box['id'], $hidden) )
+                                               $style = 'style="display:none;"';
+                                       echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '" ' . $style . '>' . "\n";
+                                       echo '<div class="handlediv" title="' . __('Click to toggle') . '"><br /></div>';
+                                       echo "<h3 class='hndle'><span>{$box['title']}</span></h3>\n";
+                                       echo '<div class="inside">' . "\n";
+                                       call_user_func($box['callback'], $object, $box);
+                                       echo "</div>\n";
+                                       echo "</div>\n";
+                               }
+                       }
+               }
+       } while(0);
+
+       echo "</div>";
+
+       return $i;
+
 }
 
 /**
 }
 
 /**
- * remove_meta_box() - Remove a meta box from an edit form
+ * Remove a meta box from an edit form.
  *
  *
- * @since 2.6
+ * @since 2.6.0
  *
  * @param string $id String for use in the 'id' attribute of tags.
  *
  * @param string $id String for use in the 'id' attribute of tags.
- * @param string $page The type of edit page on which to show the box (post, page, link)
- * @param string $context The context within the page where the boxes should show ('normal', 'advanced')
+ * @param string $page The type of edit page on which to show the box (post, page, link).
+ * @param string $context The context within the page where the boxes should show ('normal', 'advanced').
  */
 function remove_meta_box($id, $page, $context) {
        global $wp_meta_boxes;
 
  */
 function remove_meta_box($id, $page, $context) {
        global $wp_meta_boxes;
 
-       if  ( !isset($wp_meta_boxes) )
+       if ( !isset($wp_meta_boxes) )
                $wp_meta_boxes = array();
        if ( !isset($wp_meta_boxes[$page]) )
                $wp_meta_boxes[$page] = array();
                $wp_meta_boxes = array();
        if ( !isset($wp_meta_boxes[$page]) )
                $wp_meta_boxes[$page] = array();
@@ -1246,4 +2831,621 @@ function remove_meta_box($id, $page, $context) {
                $wp_meta_boxes[$page][$context][$priority][$id] = false;
 }
 
                $wp_meta_boxes[$page][$context][$priority][$id] = false;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ */
+function meta_box_prefs($page) {
+       global $wp_meta_boxes;
+
+       if ( empty($wp_meta_boxes[$page]) )
+               return;
+
+       $hidden = get_hidden_meta_boxes($page);
+
+       foreach ( array_keys($wp_meta_boxes[$page]) as $context ) {
+               foreach ( array_keys($wp_meta_boxes[$page][$context]) as $priority ) {
+                       foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) {
+                               if ( false == $box || ! $box['title'] )
+                                       continue;
+                               // Submit box cannot be hidden
+                               if ( 'submitdiv' == $box['id'] || 'linksubmitdiv' == $box['id'] )
+                                       continue;
+                               $box_id = $box['id'];
+                               echo '<label for="' . $box_id . '-hide">';
+                               echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />';
+                               echo "{$box['title']}</label>\n";
+                       }
+               }
+       }
+}
+
+function get_hidden_meta_boxes($page) {
+       $hidden = (array) get_user_option( "meta-box-hidden_$page", 0, false );
+
+       // Hide slug boxes by default
+       if ( empty($hidden[0]) ) {
+               if ( 'page' == $page )
+                       $hidden = array('pageslugdiv');
+               elseif ( 'post' == $page )
+                       $hidden = array('slugdiv');
+       }
+
+       return $hidden;
+}
+
+/**
+ * Add a new section to a settings page.
+ *
+ * @since 2.7.0
+ *
+ * @param string $id String for use in the 'id' attribute of tags.
+ * @param string $title Title of the section.
+ * @param string $callback Function that fills the section with the desired content. The function should echo its output.
+ * @param string $page The type of settings page on which to show the section (general, reading, writing, ...).
+ */
+function add_settings_section($id, $title, $callback, $page) {
+       global $wp_settings_sections;
+
+       if ( !isset($wp_settings_sections) )
+               $wp_settings_sections = array();
+       if ( !isset($wp_settings_sections[$page]) )
+               $wp_settings_sections[$page] = array();
+       if ( !isset($wp_settings_sections[$page][$id]) )
+               $wp_settings_sections[$page][$id] = array();
+
+       $wp_settings_sections[$page][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
+}
+
+/**
+ * Add a new field to a settings page.
+ *
+ * @since 2.7.0
+ *
+ * @param string $id String for use in the 'id' attribute of tags.
+ * @param string $title Title of the field.
+ * @param string $callback Function that fills the field with the desired content. The function should echo its output.
+ * @param string $page The type of settings page on which to show the field (general, reading, writing, ...).
+ * @param string $section The section of the settingss page in which to show the box (default, ...).
+ * @param array $args Additional arguments
+ */
+function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
+       global $wp_settings_fields;
+
+       if ( !isset($wp_settings_fields) )
+               $wp_settings_fields = array();
+       if ( !isset($wp_settings_fields[$page]) )
+               $wp_settings_fields[$page] = array();
+       if ( !isset($wp_settings_fields[$page][$section]) )
+               $wp_settings_fields[$page][$section] = array();
+
+       $wp_settings_fields[$page][$section][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $args);
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ */
+function do_settings_sections($page) {
+       global $wp_settings_sections, $wp_settings_fields;
+
+       if ( !isset($wp_settings_sections) || !isset($wp_settings_sections[$page]) )
+               return;
+
+       foreach ( (array) $wp_settings_sections[$page] as $section ) {
+               echo "<h3>{$section['title']}</h3>\n";
+               call_user_func($section['callback'], $section);
+               if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section['id']]) )
+                       continue;
+               echo '<table class="form-table">';
+               do_settings_fields($page, $section['id']);
+               echo '</table>';
+       }
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ * @param unknown_type $section
+ */
+function do_settings_fields($page, $section) {
+       global $wp_settings_fields;
+
+       if ( !isset($wp_settings_fields) || !isset($wp_settings_fields[$page]) || !isset($wp_settings_fields[$page][$section]) )
+               return;
+
+       foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
+               echo '<tr valign="top">';
+               if ( !empty($field['args']['label_for']) )
+                       echo '<th scope="row"><label for="' . $field['args']['label_for'] . '">' . $field['title'] . '</label></th>';
+               else
+                       echo '<th scope="row">' . $field['title'] . '</th>';
+               echo '<td>';
+               call_user_func($field['callback']);
+               echo '</td>';
+               echo '</tr>';
+       }
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $page
+ */
+function manage_columns_prefs($page) {
+       $columns = get_column_headers($page);
+
+       $hidden = get_hidden_columns($page);
+
+       foreach ( $columns as $column => $title ) {
+               // Can't hide these
+               if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column )
+                       continue;
+               if ( empty($title) )
+                       continue;
+
+               if ( 'comments' == $column )
+                       $title = __('Comments');
+               $id = "$column-hide";
+               echo '<label for="' . $id . '">';
+               echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . (! in_array($column, $hidden) ? ' checked="checked"' : '') . ' />';
+               echo "$title</label>\n";
+       }
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $found_action
+ */
+function find_posts_div($found_action = '') {
+?>
+       <div id="find-posts" class="find-box" style="display:none;">
+               <div id="find-posts-head" class="find-box-head"><?php _e('Find Posts or Pages'); ?></div>
+               <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; ?>" />
+                               <?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 />
+
+                               <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-pages" value="pages" />
+                               <label for="find-posts-pages"><?php _e( 'Pages' ); ?></label>
+                       </div>
+                       <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'); ?>" />
+               </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.
+ *
+ * The password is passed through {@link attribute_escape()} to ensure that it
+ * is safe for placing in an html attribute.
+ *
+ * @uses attribute_escape
+ * @since 2.7.0
+ */
+function the_post_password() {
+       global $post;
+       if ( isset( $post->post_password ) ) echo attribute_escape( $post->post_password );
+}
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ */
+function favorite_actions() {
+       $actions = array(
+               'post-new.php' => array(__('New Post'), 'edit_posts'),
+               'edit.php?post_status=draft' => array(__('Drafts'), 'edit_posts'),
+               'page-new.php' => array(__('New Page'), 'edit_pages'),
+               'media-new.php' => array(__('Upload'), 'upload_files'),
+               'edit-comments.php' => array(__('Comments'), 'moderate_comments')
+               );
+
+       $actions = apply_filters('favorite_actions', $actions);
+
+       $allowed_actions = array();
+       foreach ( $actions as $action => $data ) {
+               if ( current_user_can($data[1]) )
+                       $allowed_actions[$action] = $data[0];
+       }
+
+       if ( empty($allowed_actions) )
+               return;
+
+       $first = array_keys($allowed_actions);
+       $first = $first[0];
+       echo '<div id="favorite-actions">';
+       echo '<div id="favorite-first"><a href="' . $first . '">' . $allowed_actions[$first] . '</a></div><div id="favorite-toggle"><br /></div>';
+       echo '<div id="favorite-inside">';
+
+       array_shift($allowed_actions);
+
+       foreach ( $allowed_actions as $action => $label) {
+               echo "<div class='favorite-action'><a href='$action'>";
+               echo $label;
+               echo "</a></div>\n";
+       }
+       echo "</div></div>\n";
+}
+
+/**
+ * Get the post title.
+ *
+ * The post title is fetched and if it is blank then a default string is
+ * returned.
+ *
+ * @since 2.7.0
+ * @param int $id The post id. If not supplied the global $post is used.
+ *
+ */
+function _draft_or_post_title($post_id = 0)
+{
+       $title = get_the_title($post_id);
+       if ( empty($title) )
+               $title = __('(no title)');
+       return $title;
+}
+
+/**
+ * Display the search query.
+ *
+ * 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
+ * @since 2.7.0
+ *
+ */
+function _admin_search_query() {
+       echo isset($_GET['s']) ? attribute_escape( stripslashes( $_GET['s'] ) ) : '';
+}
+
+/**
+ * Generic Iframe header for use with Thickbox
+ *
+ * @since 2.7.0
+ * @param string $title Title of the Iframe page.
+ * @param bool $limit_styles Limit styles to colour-related styles only (unless others are enqueued).
+ *
+ */
+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>
+<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; <?php _e('WordPress'); ?></title>
+<?php
+wp_enqueue_style( 'global' );
+wp_enqueue_style( 'colors' );
+if ( ! $limit_styles )
+       wp_enqueue_style( 'wp-admin' );
+?>
+<script type="text/javascript">
+//<![CDATA[
+function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}}
+//]]>
+</script>
+<?php
+do_action('admin_print_styles');
+do_action('admin_print_scripts');
+do_action('admin_head');
+?>
+</head>
+<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>>
+<?php
+}
+
+/**
+ * Generic Iframe footer for use with Thickbox
+ *
+ * @since 2.7.0
+ *
+ */
+function iframe_footer() {
+       echo '
+       </body>
+</html>';
+}
+
+function _post_states($post) {
+       $post_states = array();
+       if ( isset($_GET['post_status']) )
+               $post_status = $_GET['post_status'];
+       else
+               $post_status = '';
+
+       if ( !empty($post->post_password) )
+               $post_states[] = __('Password protected');
+       if ( 'private' == $post->post_status && 'private' != $post_status )
+               $post_states[] = __('Private');
+       if ( 'draft' == $post->post_status && 'draft' != $post_status )
+               $post_states[] = __('Draft');
+       if ( 'pending' == $post->post_status && 'pending' != $post_status )
+               $post_states[] = __('Pending');
+
+       if ( ! empty($post_states) ) {
+               $state_count = count($post_states);
+               $i = 0;
+               echo ' - ';
+               foreach ( $post_states as $state ) {
+                       ++$i;
+                       ( $i == $state_count ) ? $sep = '' : $sep = ', ';
+                       echo "<span class='post-state'>$state$sep</span>";
+               }
+       }
+}
+
+function screen_meta($screen) {
+       global $wp_meta_boxes, $_wp_contextual_help;
+
+       $screen = str_replace('.php', '', $screen);
+       $screen = str_replace('-new', '', $screen);
+       $screen = str_replace('-add', '', $screen);
+       $screen = apply_filters('screen_meta_screen', $screen);
+
+       $column_screens = get_column_headers($screen);
+       $meta_screens = array('index' => 'dashboard');
+
+       if ( isset($meta_screens[$screen]) )
+               $screen = $meta_screens[$screen];
+       $show_screen = false;
+       if ( !empty($wp_meta_boxes[$screen]) || !empty($column_screens) )
+               $show_screen = true;
+?>
+<div id="screen-meta">
+<?php
+       if ( $show_screen ) :
+?>
+<div id="screen-options-wrap" class="hidden">
+       <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);
+               wp_nonce_field( 'hiddencolumns', 'hiddencolumnsnonce', false );
+       }
+?>
+       <br class="clear" />
+       </div></form>
+</div>
+
+<?php
+       endif;
+
+       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">
+       <?php
+       $contextual_help = '';
+       if ( isset($_wp_contextual_help[$screen]) ) {
+               if ( !empty($title) )
+                       $contextual_help .= '<h5>' . sprintf(__('Get help with "%s"'), $title) . '</h5>';
+               else
+                       $contextual_help .= '<h5>' . __('Get help with this page') . '</h5>';
+               $contextual_help .= '<div class="metabox-prefs">' . $_wp_contextual_help[$screen] . "</div>\n";
+
+               $contextual_help .= '<h5>' . __('Other Help') . '</h5>';
+       } else {
+               $contextual_help .= '<h5>' . __('Help') . '</h5>';
+       }
+
+       $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>');
+       $contextual_help .= "</div>\n";
+       echo apply_filters('contextual_help', $contextual_help, $screen);
+       ?>
+       </div>
+
+<div id="screen-meta-links">
+<div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle">
+<a href="#contextual-help" id="contextual-help-link" class="show-settings"><?php _e('Help') ?></a>
+</div>
+<?php if ( $show_screen ) { ?>
+<div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle">
+<a href="#screen-options" id="show-settings-link" class="show-settings"><?php _e('Screen Options') ?></a>
+</div>
+<?php } ?>
+</div>
+</div>
+<?php
+}
+
+/**
+ * Add contextual help text for a page
+ *
+ * @since 2.7.0
+ *
+ * @param string $screen The handle for the screen to add help to.  This is usually the hook name returned by the add_*_page() functions.
+ * @param string $help Arbitrary help text
+ */
+function add_contextual_help($screen, $help) {
+       global $_wp_contextual_help;
+
+       if ( !isset($_wp_contextual_help) )
+               $_wp_contextual_help = array();
+
+       $_wp_contextual_help[$screen] = $help;
+}
+
+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 you’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>
+';
+}
+
+function screen_icon($name = '') {
+       global $parent_file, $hook_suffix;
+
+       if ( empty($name) ) {
+               if ( isset($parent_file) && !empty($parent_file) )
+                       $name = substr($parent_file, 0, -4);
+               else
+                       $name = str_replace(array('.php', '-new', '-add'), '', $hook_suffix);
+       }
+       unset($hook_suffix);
+?>
+       <div id="icon-<?php echo $name; ?>" class="icon32"><br /></div>
+<?php
+}
+
 ?>
 ?>
index ec670ce6a3764f176ac4b5a5b790d73a1afcb554..8b883e23ab1fa2345e3e0f7f82769866ab2b51df 100644 (file)
@@ -1,5 +1,18 @@
 <?php
 <?php
+/**
+ * WordPress Theme Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function current_theme_info() {
        $themes = get_themes();
        $current_theme = get_current_theme();
 function current_theme_info() {
        $themes = get_themes();
        $current_theme = get_current_theme();
@@ -18,6 +31,13 @@ function current_theme_info() {
        return $ct;
 }
 
        return $ct;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_broken_themes() {
        global $wp_broken_themes;
 
 function get_broken_themes() {
        global $wp_broken_themes;
 
@@ -25,6 +45,13 @@ function get_broken_themes() {
        return $wp_broken_themes;
 }
 
        return $wp_broken_themes;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_page_templates() {
        $themes = get_themes();
        $theme = get_current_theme();
 function get_page_templates() {
        $themes = get_themes();
        $theme = get_current_theme();
@@ -35,11 +62,13 @@ function get_page_templates() {
                foreach ( $templates as $template ) {
                        $template_data = implode( '', file( WP_CONTENT_DIR.$template ));
 
                foreach ( $templates as $template ) {
                        $template_data = implode( '', file( WP_CONTENT_DIR.$template ));
 
-                       preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
-                       preg_match( '|Description:(.*)$|mi', $template_data, $description );
+                       $name = '';
+                       if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) )
+                               $name = $name[1];
 
 
-                       $name = $name[1];
-                       $description = $description[1];
+                       $description = '';
+                       if( preg_match( '|Description:(.*)$|mi', $template_data, $description ) )
+                               $description = $description[1];
 
                        if ( !empty( $name ) ) {
                                $page_templates[trim( $name )] = basename( $template );
 
                        if ( !empty( $name ) ) {
                                $page_templates[trim( $name )] = basename( $template );
diff --git a/wp-admin/includes/update-core.php b/wp-admin/includes/update-core.php
new file mode 100644 (file)
index 0000000..2e4781b
--- /dev/null
@@ -0,0 +1,263 @@
+<?php
+/**
+ * WordPress core upgrade functionality.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ * @since 2.7.0
+ */
+
+/**
+ * Stores files to be deleted.
+ *
+ * @since 2.7.0
+ * @global array $_old_files
+ * @var array
+ * @name $_old_files
+ */
+global $_old_files;
+
+$_old_files = array(
+'wp-admin/bookmarklet.php',
+'wp-admin/css/upload.css',
+'wp-admin/css/upload-rtl.css',
+'wp-admin/css/press-this-ie.css',
+'wp-admin/css/press-this-ie-rtl.css',
+'wp-admin/edit-form.php',
+'wp-admin/link-import.php',
+'wp-admin/images/box-bg-left.gif',
+'wp-admin/images/box-bg-right.gif',
+'wp-admin/images/box-bg.gif',
+'wp-admin/images/box-butt-left.gif',
+'wp-admin/images/box-butt-right.gif',
+'wp-admin/images/box-butt.gif',
+'wp-admin/images/box-head-left.gif',
+'wp-admin/images/box-head-right.gif',
+'wp-admin/images/box-head.gif',
+'wp-admin/images/heading-bg.gif',
+'wp-admin/images/login-bkg-bottom.gif',
+'wp-admin/images/login-bkg-tile.gif',
+'wp-admin/images/notice.gif',
+'wp-admin/images/toggle.gif',
+'wp-admin/images/comment-stalk-classic.gif',
+'wp-admin/images/comment-stalk-fresh.gif',
+'wp-admin/images/comment-stalk-rtl.gif',
+'wp-admin/images/comment-pill.gif',
+'wp-admin/images/del.png',
+'wp-admin/images/media-button-gallery.gif',
+'wp-admin/images/media-buttons.gif',
+'wp-admin/images/tail.gif',
+'wp-admin/images/gear.png',
+'wp-admin/images/tab.png',
+'wp-admin/images/postbox-bg.gif',
+'wp-admin/includes/upload.php',
+'wp-admin/js/dbx-admin-key.js',
+'wp-admin/js/link-cat.js',
+'wp-admin/js/forms.js',
+'wp-admin/js/upload.js',
+'wp-admin/profile-update.php',
+'wp-admin/templates.php',
+'wp-includes/images/audio.png',
+'wp-includes/images/css.png',
+'wp-includes/images/default.png',
+'wp-includes/images/doc.png',
+'wp-includes/images/exe.png',
+'wp-includes/images/html.png',
+'wp-includes/images/js.png',
+'wp-includes/images/pdf.png',
+'wp-includes/images/swf.png',
+'wp-includes/images/tar.png',
+'wp-includes/images/text.png',
+'wp-includes/images/video.png',
+'wp-includes/images/zip.png',
+'wp-includes/js/dbx.js',
+'wp-includes/js/fat.js',
+'wp-includes/js/list-manipulation.js',
+'wp-includes/js/jquery/jquery.dimensions.min.js',
+'wp-includes/js/tinymce/langs/en.js',
+'wp-includes/js/tinymce/plugins/autosave/editor_plugin_src.js',
+'wp-includes/js/tinymce/plugins/autosave/langs',
+'wp-includes/js/tinymce/plugins/directionality/images',
+'wp-includes/js/tinymce/plugins/directionality/langs',
+'wp-includes/js/tinymce/plugins/inlinepopups/css',
+'wp-includes/js/tinymce/plugins/inlinepopups/images',
+'wp-includes/js/tinymce/plugins/inlinepopups/jscripts',
+'wp-includes/js/tinymce/plugins/paste/images',
+'wp-includes/js/tinymce/plugins/paste/jscripts',
+'wp-includes/js/tinymce/plugins/paste/langs',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/HttpClient.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyGoogleSpell.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspell.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/classes/TinyPspellShell.class.php',
+'wp-includes/js/tinymce/plugins/spellchecker/css/spellchecker.css',
+'wp-includes/js/tinymce/plugins/spellchecker/images',
+'wp-includes/js/tinymce/plugins/spellchecker/langs',
+'wp-includes/js/tinymce/plugins/spellchecker/tinyspell.php',
+'wp-includes/js/tinymce/plugins/wordpress/images',
+'wp-includes/js/tinymce/plugins/wordpress/langs',
+'wp-includes/js/tinymce/plugins/wordpress/popups.css',
+'wp-includes/js/tinymce/plugins/wordpress/wordpress.css',
+'wp-includes/js/tinymce/plugins/wphelp',
+'wp-includes/js/tinymce/themes/advanced/css',
+'wp-includes/js/tinymce/themes/advanced/images',
+'wp-includes/js/tinymce/themes/advanced/jscripts',
+'wp-includes/js/tinymce/themes/advanced/langs',
+'wp-includes/js/tinymce/tiny_mce_gzip.php',
+'wp-includes/js/wp-ajax.js',
+'wp-admin/admin-db.php',
+'wp-admin/cat.js',
+'wp-admin/categories.js',
+'wp-admin/custom-fields.js',
+'wp-admin/dbx-admin-key.js',
+'wp-admin/edit-comments.js',
+'wp-admin/install-rtl.css',
+'wp-admin/install.css',
+'wp-admin/upgrade-schema.php',
+'wp-admin/upload-functions.php',
+'wp-admin/upload-rtl.css',
+'wp-admin/upload.css',
+'wp-admin/upload.js',
+'wp-admin/users.js',
+'wp-admin/widgets-rtl.css',
+'wp-admin/widgets.css',
+'wp-admin/xfn.js',
+'wp-includes/js/tinymce/license.html',
+'wp-admin/cat-js.php',
+'wp-admin/edit-form-ajax-cat.php',
+'wp-admin/execute-pings.php',
+'wp-admin/import/b2.php',
+'wp-admin/inline-uploading.php',
+'wp-admin/link-categories.php',
+'wp-admin/list-manipulation.js',
+'wp-admin/list-manipulation.php',
+'wp-includes/comment-functions.php',
+'wp-includes/feed-functions.php',
+'wp-includes/functions-compat.php',
+'wp-includes/functions-formatting.php',
+'wp-includes/functions-post.php',
+'wp-includes/js/dbx-key.js',
+'wp-includes/js/tinymce/plugins/autosave/langs/cs.js',
+'wp-includes/js/tinymce/plugins/autosave/langs/sv.js',
+'wp-includes/js/tinymce/themes/advanced/editor_template_src.js',
+'wp-includes/links.php',
+'wp-includes/pluggable-functions.php',
+'wp-includes/template-functions-author.php',
+'wp-includes/template-functions-category.php',
+'wp-includes/template-functions-general.php',
+'wp-includes/template-functions-links.php',
+'wp-includes/template-functions-post.php',
+'wp-includes/wp-l10n.php',
+'wp-admin/import-b2.php',
+'wp-admin/import-blogger.php',
+'wp-admin/import-greymatter.php',
+'wp-admin/import-livejournal.php',
+'wp-admin/import-mt.php',
+'wp-admin/import-rss.php',
+'wp-admin/import-textpattern.php',
+'wp-admin/quicktags.js',
+'wp-images/fade-butt.png',
+'wp-images/get-firefox.png',
+'wp-images/header-shadow.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',
+);
+
+/**
+ * Upgrade the core of WordPress.
+ *
+ * This will create a .maintenance file at the base of the WordPress directory
+ * to ensure that people can not access the web site, when the files are being
+ * copied to their locations.
+ *
+ * The files in the {@link $_old_files} list will be removed and the new files
+ * copied from the zip file after the database is upgraded.
+ *
+ * The steps for the upgrader for after the new release is downloaded and
+ * unzipped is:
+ *   1. Test unzipped location for select files to ensure that unzipped worked.
+ *   2. Create the .maintenance file in current WordPress base.
+ *   3. Copy new WordPress directory over old WordPress files.
+ *   4. Upgrade WordPress to new version.
+ *   5. Delete new WordPress directory path.
+ *   6. Delete .maintenance file.
+ *   7. Remove old files.
+ *   8. Delete 'update_core' option.
+ *
+ * There are several areas of failure. For instance if PHP times out before step
+ * 6, then you will not be able to access any portion of your site. Also, since
+ * the upgrade will not continue where it left off, you will not be able to
+ * automatically remove old files and remove the 'update_core' option. This
+ * isn't that bad.
+ *
+ * If the copy of the new WordPress over the old fails, then the worse is that
+ * the new WordPress directory will remain.
+ *
+ * If it is assumed that every file will be copied over, including plugins and
+ * themes, then if you edit the default theme, you should rename it, so that
+ * your changes remain.
+ *
+ * @since 2.7.0
+ *
+ * @param string $from New release unzipped path.
+ * @param string $to Path to old WordPress installation.
+ * @return WP_Error|null WP_Error on failure, null on success.
+ */
+function update_core($from, $to) {
+       global $wp_filesystem, $_old_files;
+
+       @set_time_limit( 300 );
+
+       // Sanity check the unzipped distribution
+       apply_filters('update_feedback', __('Verifying the unpacked files'));
+       if ( !$wp_filesystem->exists($from . '/wordpress/wp-settings.php') || !$wp_filesystem->exists($from . '/wordpress/wp-admin/admin.php') ||
+               !$wp_filesystem->exists($from . '/wordpress/wp-includes/functions.php') ) {
+               $wp_filesystem->delete($from, true);
+               return new WP_Error('insane_distro', __('The update could not be unpacked') );
+       }
+
+       apply_filters('update_feedback', __('Installing the latest version'));
+
+       // Create maintenance file to signal that we are upgrading
+       $maintenance_string = '<?php $upgrading = ' . time() . '; ?>';
+       $maintenance_file = $to . '.maintenance';
+       $wp_filesystem->delete($maintenance_file);
+       $wp_filesystem->put_contents($maintenance_file, $maintenance_string, FS_CHMOD_FILE);
+
+       // Copy new versions of WP files into place.
+       $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.
+               return $result;
+       }
+
+       // Remove old files
+       foreach ( $_old_files as $old_file ) {
+               $old_file = $to . $old_file;
+               if ( !$wp_filesystem->exists($old_file) )
+                       continue;
+               $wp_filesystem->delete($old_file, true);
+       }
+
+       // Upgrade DB with separate request
+       apply_filters('update_feedback', __('Upgrading database'));
+       $db_upgrade_url = admin_url('upgrade.php?step=upgrade_db');
+       wp_remote_post($db_upgrade_url, array('timeout' => 60));
+
+       // Remove working directory
+       $wp_filesystem->delete($from, true);
+
+       // Force refresh of update information
+       delete_option('update_core');
+
+       // Remove maintenance file, we're done.
+       $wp_filesystem->delete($maintenance_file);
+}
+
+?>
index 7070bad8da6761bd93261f6f0c25bccc9b93366a..c90bd7aae615fd35038d6fa24be9d03ad477a568 100644 (file)
 <?php
 <?php
+/**
+ * WordPress Administration Update API
+ *
+ * @package WordPress
+ * @subpackage Admin
+ */
 
 // The admin side of our 1.1 update system
 
 
 // The admin side of our 1.1 update system
 
+/**
+ * Selects the first update version from the update_core option
+ *
+ * @return object the response from the API
+ */
+function get_preferred_from_update_core() {
+       $updates = get_core_updates();
+       if ( !is_array( $updates ) )
+               return false;
+       if ( empty( $updates ) )
+               return (object)array('response' => 'latest');
+       return $updates[0];
+}
+
+/**
+ * Get available core updates
+ *
+ * @param array $options Set $options['dismissed'] to true to show dismissed upgrades too,
+ *     set $options['available'] to false to skip not-dimissed updates.
+ * @return array Array of the update objects
+ */
+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();
+       $from_api = get_option( 'update_core' );
+       if ( empty($from_api) )
+               return false;
+       if ( !is_array( $from_api->updates ) ) return false;
+       $updates = $from_api->updates;
+       if ( !is_array( $updates ) ) return false;
+       $result = array();
+       foreach($updates as $update) {
+               if ( array_key_exists( $update->current.'|'.$update->locale, $dismissed ) ) {
+                       if ( $options['dismissed'] ) {
+                               $update->dismissed = true;
+                               $result[]= $update;
+                       }
+               } else {
+                       if ( $options['available'] ) {
+                               $update->dismissed = false;
+                               $result[]= $update;
+                       }
+               }
+       }
+       return $result;
+}
+
+function dismiss_core_update( $update ) {
+       $dismissed = get_option( 'dismissed_update_core' );
+       $dismissed[ $update->current.'|'.$update->locale ] = true;
+       return update_option( 'dismissed_update_core', $dismissed );
+}
+
+function undismiss_core_update( $version, $locale ) {
+       $dismissed = get_option( 'dismissed_update_core' );
+       $key = $version.'|'.$locale;
+       if ( !isset( $dismissed[$key] ) ) return false;
+       unset( $dismissed[$key] );
+       return update_option( 'dismissed_update_core', $dismissed );
+}
+
+function find_core_update( $version, $locale ) {
+       $from_api = get_option( 'update_core' );
+       if ( !is_array( $from_api->updates ) ) return false;
+       $updates = $from_api->updates;
+       foreach($updates as $update) {
+               if ( $update->current == $version && $update->locale == $locale )
+                       return $update;
+       }
+       return false;
+}
+
 function core_update_footer( $msg = '' ) {
        if ( !current_user_can('manage_options') )
                return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );
 
 function core_update_footer( $msg = '' ) {
        if ( !current_user_can('manage_options') )
                return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'] );
 
-       $cur = get_option( 'update_core' );
+       $cur = get_preferred_from_update_core();
+       if ( ! isset( $cur->current ) )
+               $cur->current = '';
+
+       if ( ! isset( $cur->url ) )
+               $cur->url = '';
+
+       if ( ! isset( $cur->response ) )
+               $cur->response = '';
 
        switch ( $cur->response ) {
        case 'development' :
 
        switch ( $cur->response ) {
        case 'development' :
-               return sprintf( '| '.__( 'You are using a development version (%s). Cool! Please <a href="%s">stay updated</a>.' ), $GLOBALS['wp_version'], $cur->url, $cur->current );
+               return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), $GLOBALS['wp_version'], 'update-core.php');
        break;
 
        case 'upgrade' :
                if ( current_user_can('manage_options') ) {
        break;
 
        case 'upgrade' :
                if ( current_user_can('manage_options') ) {
-                       return sprintf( '| <strong>'.__( '<a href="%2$s">Get Version %3$s</a>' ).'</strong>', $GLOBALS['wp_version'], $cur->url, $cur->current );
+                       return sprintf( '<strong>'.__( '<a href="%1$s">Get Version %2$s</a>' ).'</strong>', 'update-core.php', $cur->current);
                        break;
                }
 
        case 'latest' :
        default :
                        break;
                }
 
        case 'latest' :
        default :
-               return sprintf( '| '.__( 'Version %s' ), $GLOBALS['wp_version'], $cur->url, $cur->current );
+               return sprintf( __( 'Version %s' ), $GLOBALS['wp_version'] );
        break;
        }
 }
 add_filter( 'update_footer', 'core_update_footer' );
 
 function update_nag() {
        break;
        }
 }
 add_filter( 'update_footer', 'core_update_footer' );
 
 function update_nag() {
-       $cur = get_option( 'update_core' );
+       global $pagenow;
+
+       if ( 'update-core.php' == $pagenow )
+               return;
+
+       $cur = get_preferred_from_update_core();
 
        if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
                return false;
 
        if ( current_user_can('manage_options') )
 
        if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
                return false;
 
        if ( current_user_can('manage_options') )
-               $msg = sprintf( __('WordPress %2$s is available! <a href="%1$s">Please update now</a>.'), $cur->url, $cur->current );
+               $msg = sprintf( __('WordPress %1$s is available! <a href="%2$s">Please update now</a>.'), $cur->current, 'update-core.php' );
        else
        else
-               $msg = sprintf( __('WordPress %2$s is available! Please notify the site administrator.'), $cur->url, $cur->current );
+               $msg = sprintf( __('WordPress %1$s is available! Please notify the site administrator.'), $cur->current );
 
        echo "<div id='update-nag'>$msg</div>";
 }
 
        echo "<div id='update-nag'>$msg</div>";
 }
@@ -44,11 +136,11 @@ add_action( 'admin_notices', 'update_nag', 3 );
 
 // Called directly from dashboard
 function update_right_now_message() {
 
 // Called directly from dashboard
 function update_right_now_message() {
-       $cur = get_option( 'update_core' );
+       $cur = get_preferred_from_update_core();
 
 
-       $msg = sprintf( __('This is WordPress version %s.'), $GLOBALS['wp_version'] );
+       $msg = sprintf( __('You are using <span class="b">WordPress %s</span>.'), $GLOBALS['wp_version'] );
        if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') )
        if ( isset( $cur->response ) && $cur->response == 'upgrade' && current_user_can('manage_options') )
-               $msg .= " <a href='$cur->url' class='rbutton'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
+               $msg .= " <a href='update-core.php' class='button'>" . sprintf( __('Update to %s'), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a>';
 
        echo "<span id='wp-version-message'>$msg</span>";
 }
 
        echo "<span id='wp-version-message'>$msg</span>";
 }
@@ -60,14 +152,16 @@ function wp_plugin_update_row( $file, $plugin_data ) {
 
        $r = $current->response[ $file ];
 
 
        $r = $current->response[ $file ];
 
+       $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">';
        if ( ! current_user_can('update_plugins') )
        echo '<tr><td colspan="5" class="plugin-update">';
        if ( ! current_user_can('update_plugins') )
-               printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version);
+               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);
        else if ( empty($r->package) )
        else if ( empty($r->package) )
-               printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $r->url, $r->new_version);
+               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);
        else
        else
-               printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->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="%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) );
+
        echo '</td></tr>';
 }
 add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
        echo '</td></tr>';
 }
 add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
@@ -102,7 +196,7 @@ function wp_update_plugin($plugin, $feedback = '') {
        $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).'));
        $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 );
 
        $plugins_dir = trailingslashit( $plugins_dir );
        $content_dir = trailingslashit( $content_dir );
 
@@ -129,10 +223,10 @@ function wp_update_plugin($plugin, $feedback = '') {
        apply_filters('update_feedback', __('Unpacking the update'));
        // Unzip package to working directory
        $result = unzip_file($download_file, $working_dir);
        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);
        // Once extracted, delete the package
        unlink($download_file);
-       
+
        if ( is_wp_error($result) ) {
                $wp_filesystem->delete($working_dir, true);
                return $result;
        if ( is_wp_error($result) ) {
                $wp_filesystem->delete($working_dir, true);
                return $result;
@@ -147,7 +241,7 @@ function wp_update_plugin($plugin, $feedback = '') {
        // Remove the existing plugin.
        apply_filters('update_feedback', __('Removing the old version of the plugin'));
        $this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
        // 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);
        // 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);
@@ -163,7 +257,7 @@ function wp_update_plugin($plugin, $feedback = '') {
        // Copy new version of plugin into place.
        $result = copy_dir($working_dir, $plugins_dir);
        if ( is_wp_error($result) ) {
        // 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); //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;
        }
 
@@ -175,10 +269,10 @@ function wp_update_plugin($plugin, $feedback = '') {
 
        // Force refresh of plugin update information
        delete_option('update_plugins');
 
        // 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.
        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
        $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
@@ -186,4 +280,213 @@ function wp_update_plugin($plugin, $feedback = '') {
        return  $folder . '/' . $pluginfiles[0];
 }
 
        return  $folder . '/' . $pluginfiles[0];
 }
 
+function wp_update_theme($theme, $feedback = '') {
+       global $wp_filesystem;
+
+       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];*/
+}
+
+
+function wp_update_core($current, $feedback = '') {
+       global $wp_filesystem;
+
+       @set_time_limit( 300 );
+
+       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');
+
+       return update_core($working_dir, $wp_dir);
+}
+
+function maintenance_nag() {
+       global $upgrading;
+       if ( ! isset( $upgrading ) )
+               return false;
+
+       if ( current_user_can('manage_options') )
+               $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' );
+       else
+               $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
+
+       echo "<div id='update-nag'>$msg</div>";
+}
+add_action( 'admin_notices', 'maintenance_nag' );
+
 ?>
 ?>
index fc398ab44e4b183f09d7f62a20108524a2a85faa..4919fd4317c65e992c487466f80eedb1f4d43103 100644 (file)
@@ -1,11 +1,38 @@
 <?php
 <?php
+/**
+ * WordPress Upgrade API
+ *
+ * Most of the functions are pluggable and can be overwritten
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
+/** Include user install customize script. */
 if ( file_exists(WP_CONTENT_DIR . '/install.php') )
        require (WP_CONTENT_DIR . '/install.php');
 if ( file_exists(WP_CONTENT_DIR . '/install.php') )
        require (WP_CONTENT_DIR . '/install.php');
+
+/** WordPress Administration API */
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
 require_once(ABSPATH . 'wp-admin/includes/admin.php');
+
+/** WordPress Schema API */
 require_once(ABSPATH . 'wp-admin/includes/schema.php');
 
 if ( !function_exists('wp_install') ) :
 require_once(ABSPATH . 'wp-admin/includes/schema.php');
 
 if ( !function_exists('wp_install') ) :
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param string $blog_title Blog title.
+ * @param string $user_name User's username.
+ * @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'.
+ */
 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;
 
@@ -53,6 +80,15 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
 endif;
 
 if ( !function_exists('wp_install_defaults') ) :
 endif;
 
 if ( !function_exists('wp_install_defaults') ) :
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID.
+ */
 function wp_install_defaults($user_id) {
        global $wpdb;
 
 function wp_install_defaults($user_id) {
        global $wpdb;
 
@@ -107,6 +143,18 @@ function wp_install_defaults($user_id) {
 endif;
 
 if ( !function_exists('wp_new_blog_notification') ) :
 endif;
 
 if ( !function_exists('wp_new_blog_notification') ) :
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param string $blog_title Blog title.
+ * @param string $blog_url Blog url.
+ * @param int $user_id User ID.
+ * @param string $password User's Password.
+ */
 function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
        $user = new WP_User($user_id);
        $email = $user->user_email;
 function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
        $user = new WP_User($user_id);
        $email = $user->user_email;
@@ -132,6 +180,15 @@ http://wordpress.org/
 endif;
 
 if ( !function_exists('wp_upgrade') ) :
 endif;
 
 if ( !function_exists('wp_upgrade') ) :
+/**
+ * Run WordPress Upgrade functions.
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @return null
+ */
 function wp_upgrade() {
        global $wp_current_db_version, $wp_db_version;
 
 function wp_upgrade() {
        global $wp_current_db_version, $wp_db_version;
 
@@ -141,6 +198,9 @@ function wp_upgrade() {
        if ( $wp_db_version == $wp_current_db_version )
                return;
 
        if ( $wp_db_version == $wp_current_db_version )
                return;
 
+       if( ! is_blog_installed() )
+               return;
+
        wp_check_mysql_version();
        wp_cache_flush();
        make_db_current_silent();
        wp_check_mysql_version();
        wp_cache_flush();
        make_db_current_silent();
@@ -149,7 +209,13 @@ function wp_upgrade() {
 }
 endif;
 
 }
 endif;
 
-// Functions to be called in install and upgrade scripts
+/**
+ * Functions to be called in install and upgrade scripts.
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ */
 function upgrade_all() {
        global $wp_current_db_version, $wp_db_version, $wp_rewrite;
        $wp_current_db_version = __get_option('db_version');
 function upgrade_all() {
        global $wp_current_db_version, $wp_db_version, $wp_rewrite;
        $wp_current_db_version = __get_option('db_version');
@@ -207,6 +273,9 @@ function upgrade_all() {
        if ( $wp_current_db_version < 8201 )
                upgrade_260();
 
        if ( $wp_current_db_version < 8201 )
                upgrade_260();
 
+       if ( $wp_current_db_version < 8989 )
+               upgrade_270();
+
        maybe_disable_automattic_widgets();
 
        $wp_rewrite->flush_rules();
        maybe_disable_automattic_widgets();
 
        $wp_rewrite->flush_rules();
@@ -214,6 +283,11 @@ function upgrade_all() {
        update_option('db_version', $wp_db_version);
 }
 
        update_option('db_version', $wp_db_version);
 }
 
+/**
+ * Execute changes made in WordPress 1.0.
+ *
+ * @since 1.0.0
+ */
 function upgrade_100() {
        global $wpdb;
 
 function upgrade_100() {
        global $wpdb;
 
@@ -236,7 +310,6 @@ function upgrade_100() {
                }
        }
 
                }
        }
 
-
        $wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
        WHERE option_name LIKE 'links_rating_image%'
        AND option_value LIKE 'wp-links/links-images/%'");
        $wpdb->query("UPDATE $wpdb->options SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
        WHERE option_name LIKE 'links_rating_image%'
        AND option_value LIKE 'wp-links/links-images/%'");
@@ -266,6 +339,11 @@ function upgrade_100() {
        endif;
 }
 
        endif;
 }
 
+/**
+ * Execute changes made in WordPress 1.0.1.
+ *
+ * @since 1.0.1
+ */
 function upgrade_101() {
        global $wpdb;
 
 function upgrade_101() {
        global $wpdb;
 
@@ -279,7 +357,11 @@ function upgrade_101() {
        add_clean_index($wpdb->links , 'link_visible');
 }
 
        add_clean_index($wpdb->links , 'link_visible');
 }
 
-
+/**
+ * Execute changes made in WordPress 1.2.
+ *
+ * @since 1.2.0
+ */
 function upgrade_110() {
        global $wpdb;
 
 function upgrade_110() {
        global $wpdb;
 
@@ -299,7 +381,6 @@ function upgrade_110() {
                }
        }
 
                }
        }
 
-
        // Get the GMT offset, we'll use that later on
        $all_options = get_alloptions_110();
 
        // Get the GMT offset, we'll use that later on
        $all_options = get_alloptions_110();
 
@@ -336,6 +417,11 @@ function upgrade_110() {
 
 }
 
 
 }
 
+/**
+ * Execute changes made in WordPress 1.5.
+ *
+ * @since 1.5.0
+ */
 function upgrade_130() {
        global $wpdb;
 
 function upgrade_130() {
        global $wpdb;
 
@@ -413,6 +499,11 @@ function upgrade_130() {
        make_site_theme();
 }
 
        make_site_theme();
 }
 
+/**
+ * Execute changes made in WordPress 2.0.
+ *
+ * @since 2.0.0
+ */
 function upgrade_160() {
        global $wpdb, $wp_current_db_version;
 
 function upgrade_160() {
        global $wpdb, $wp_current_db_version;
 
@@ -491,6 +582,11 @@ function upgrade_160() {
        }
 }
 
        }
 }
 
+/**
+ * Execute changes made in WordPress 2.1.
+ *
+ * @since 2.1.0
+ */
 function upgrade_210() {
        global $wpdb, $wp_current_db_version;
 
 function upgrade_210() {
        global $wpdb, $wp_current_db_version;
 
@@ -530,6 +626,11 @@ function upgrade_210() {
        }
 }
 
        }
 }
 
+/**
+ * Execute changes made in WordPress 2.3.
+ *
+ * @since 2.3.0
+ */
 function upgrade_230() {
        global $wp_current_db_version, $wpdb;
 
 function upgrade_230() {
        global $wp_current_db_version, $wpdb;
 
@@ -568,7 +669,7 @@ function upgrade_230() {
                        }
                }
 
                        }
                }
 
-               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES 
+               $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES
                (%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );
 
                $count = 0;
                (%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );
 
                $count = 0;
@@ -700,6 +801,11 @@ function upgrade_230() {
        }
 }
 
        }
 }
 
+/**
+ * Remove old options from the database.
+ *
+ * @since 2.3.0
+ */
 function upgrade_230_options_table() {
        global $wpdb;
        $old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
 function upgrade_230_options_table() {
        global $wpdb;
        $old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
@@ -709,6 +815,11 @@ function upgrade_230_options_table() {
        $wpdb->show_errors();
 }
 
        $wpdb->show_errors();
 }
 
+/**
+ * Remove old categories, link2cat, and post2cat database tables.
+ *
+ * @since 2.3.0
+ */
 function upgrade_230_old_tables() {
        global $wpdb;
        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories');
 function upgrade_230_old_tables() {
        global $wpdb;
        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories');
@@ -716,22 +827,36 @@ function upgrade_230_old_tables() {
        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat');
 }
 
        $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat');
 }
 
+/**
+ * Upgrade old slugs made in version 2.2.
+ *
+ * @since 2.2.0
+ */
 function upgrade_old_slugs() {
        // upgrade people who were using the Redirect Old Slugs plugin
        global $wpdb;
        $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
 }
 
 function upgrade_old_slugs() {
        // upgrade people who were using the Redirect Old Slugs plugin
        global $wpdb;
        $wpdb->query("UPDATE $wpdb->postmeta SET meta_key = '_wp_old_slug' WHERE meta_key = 'old_slug'");
 }
 
-
+/**
+ * Execute changes made in WordPress 2.5.0.
+ *
+ * @since 2.5.0
+ */
 function upgrade_250() {
        global $wp_current_db_version;
 
        if ( $wp_current_db_version < 6689 ) {
                populate_roles_250();
        }
 function upgrade_250() {
        global $wp_current_db_version;
 
        if ( $wp_current_db_version < 6689 ) {
                populate_roles_250();
        }
-       
+
 }
 
 }
 
+/**
+ * Execute changes made in WordPress 2.5.1.
+ *
+ * @since 2.5.1
+ */
 function upgrade_251() {
        global $wp_current_db_version;
 
 function upgrade_251() {
        global $wp_current_db_version;
 
@@ -739,13 +864,25 @@ function upgrade_251() {
        update_option('secret', wp_generate_password(64));
 }
 
        update_option('secret', wp_generate_password(64));
 }
 
+/**
+ * Execute changes made in WordPress 2.5.2.
+ *
+ * @since 2.5.2
+ */
 function upgrade_252() {
        global $wpdb;
 
        $wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
 }
 
 function upgrade_252() {
        global $wpdb;
 
        $wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
 }
 
+/**
+ * Execute changes made in WordPress 2.6.
+ *
+ * @since 2.6.0
+ */
 function upgrade_260() {
 function upgrade_260() {
+       global $wp_current_db_version;
+
        if ( $wp_current_db_version < 8000 )
                populate_roles_260();
 
        if ( $wp_current_db_version < 8000 )
                populate_roles_260();
 
@@ -755,9 +892,38 @@ function upgrade_260() {
        }
 }
 
        }
 }
 
+/**
+ * Execute changes made in WordPress 2.7.
+ *
+ * @since 2.7.0
+ */
+function upgrade_270() {
+       global $wpdb, $wp_current_db_version;
+
+       if ( $wp_current_db_version < 8980 )
+               populate_roles_270();
+
+       // Update post_date for unpublished posts with empty timestamp
+       if ( $wp_current_db_version < 8921 )
+               $wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" );
+}
+
+
 // The functions we use to actually do stuff
 
 // General
 // The functions we use to actually do stuff
 
 // General
+
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param string $table_name Database table name to create.
+ * @param string $create_ddl SQL statement to create table.
+ * @return bool If table already exists or was created by function.
+ */
 function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
        foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
 function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
        foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
@@ -776,6 +942,17 @@ function maybe_create_table($table_name, $create_ddl) {
        return false;
 }
 
        return false;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param string $table Database table name.
+ * @param string $index Index name to drop.
+ * @return bool True, when finished.
+ */
 function drop_index($table, $index) {
        global $wpdb;
        $wpdb->hide_errors();
 function drop_index($table, $index) {
        global $wpdb;
        $wpdb->hide_errors();
@@ -788,6 +965,17 @@ function drop_index($table, $index) {
        return true;
 }
 
        return true;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param string $table Database table name.
+ * @param string $index Database table index column.
+ * @return bool True, when done with execution.
+ */
 function add_clean_index($table, $index) {
        global $wpdb;
        drop_index($table, $index);
 function add_clean_index($table, $index) {
        global $wpdb;
        drop_index($table, $index);
@@ -820,8 +1008,13 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
        return false;
 }
 
        return false;
 }
 
-
-// get_alloptions as it was for 1.2.
+/**
+ * Retrieve all options as it was for 1.2.
+ *
+ * @since 1.2.0
+ *
+ * @return array List of options.
+ */
 function get_alloptions_110() {
        global $wpdb;
        if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
 function get_alloptions_110() {
        global $wpdb;
        if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
@@ -837,7 +1030,15 @@ function get_alloptions_110() {
        return $all_options;
 }
 
        return $all_options;
 }
 
-// Version of get_option that is private to install/upgrade.
+/**
+ * Version of get_option that is private to install/upgrade.
+ *
+ * @since unknown
+ * @access private
+ *
+ * @param string $setting Option name.
+ * @return mixed
+ */
 function __get_option($setting) {
        global $wpdb;
 
 function __get_option($setting) {
        global $wpdb;
 
@@ -864,6 +1065,16 @@ function __get_option($setting) {
                return $option;
 }
 
                return $option;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param string $content
+ * @return string
+ */
 function deslash($content) {
        // Note: \\\ inside a regex denotes a single backslash.
 
 function deslash($content) {
        // Note: \\\ inside a regex denotes a single backslash.
 
@@ -881,6 +1092,17 @@ function deslash($content) {
        return $content;
 }
 
        return $content;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $queries
+ * @param unknown_type $execute
+ * @return unknown
+ */
 function dbDelta($queries, $execute = true) {
        global $wpdb;
 
 function dbDelta($queries, $execute = true) {
        global $wpdb;
 
@@ -1082,6 +1304,13 @@ function dbDelta($queries, $execute = true) {
        return $for_update;
 }
 
        return $for_update;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ */
 function make_db_current() {
        global $wp_queries;
 
 function make_db_current() {
        global $wp_queries;
 
@@ -1091,12 +1320,30 @@ function make_db_current() {
        echo "</ol>\n";
 }
 
        echo "</ol>\n";
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ */
 function make_db_current_silent() {
        global $wp_queries;
 
        $alterations = dbDelta($wp_queries);
 }
 
 function make_db_current_silent() {
        global $wp_queries;
 
        $alterations = dbDelta($wp_queries);
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $theme_name
+ * @param unknown_type $template
+ * @return unknown
+ */
 function make_site_theme_from_oldschool($theme_name, $template) {
        $home_path = get_home_path();
        $site_dir = WP_CONTENT_DIR . "/themes/$template";
 function make_site_theme_from_oldschool($theme_name, $template) {
        $home_path = get_home_path();
        $site_dir = WP_CONTENT_DIR . "/themes/$template";
@@ -1165,6 +1412,17 @@ function make_site_theme_from_oldschool($theme_name, $template) {
        return true;
 }
 
        return true;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param unknown_type $theme_name
+ * @param unknown_type $template
+ * @return unknown
+ */
 function make_site_theme_from_default($theme_name, $template) {
        $site_dir = WP_CONTENT_DIR . "/themes/$template";
        $default_dir = WP_CONTENT_DIR . '/themes/default';
 function make_site_theme_from_default($theme_name, $template) {
        $site_dir = WP_CONTENT_DIR . "/themes/$template";
        $default_dir = WP_CONTENT_DIR . '/themes/default';
@@ -1220,6 +1478,15 @@ function make_site_theme_from_default($theme_name, $template) {
 }
 
 // Create a site theme from the default theme.
 }
 
 // Create a site theme from the default theme.
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function make_site_theme() {
        // Name the theme after the blog.
        $theme_name = __get_option('blogname');
 function make_site_theme() {
        // Name the theme after the blog.
        $theme_name = __get_option('blogname');
@@ -1261,6 +1528,14 @@ function make_site_theme() {
        return $template;
 }
 
        return $template;
 }
 
+/**
+ * Translate user level to user role name.
+ *
+ * @since unknown
+ *
+ * @param int $level User level.
+ * @return string User role name.
+ */
 function translate_level_to_role($level) {
        switch ($level) {
        case 10:
 function translate_level_to_role($level) {
        switch ($level) {
        case 10:
@@ -1282,6 +1557,13 @@ function translate_level_to_role($level) {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ */
 function wp_check_mysql_version() {
        global $wpdb;
        $result = $wpdb->check_database_version();
 function wp_check_mysql_version() {
        global $wpdb;
        $result = $wpdb->check_database_version();
@@ -1289,6 +1571,13 @@ function wp_check_mysql_version() {
                die( $result->get_error_message() );
 }
 
                die( $result->get_error_message() );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ */
 function maybe_disable_automattic_widgets() {
        $plugins = __get_option( 'active_plugins' );
 
 function maybe_disable_automattic_widgets() {
        $plugins = __get_option( 'active_plugins' );
 
index a87535a80a081b40c9a1812337fabb7820dbe48b..5709cc18432a3b82f62778daa5e28b77dc87e50a 100644 (file)
@@ -1,6 +1,21 @@
 <?php
 <?php
-
-// Creates a new user from the "Users" form using $_POST information.
+/**
+ * WordPress user administration API.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Creates a new user from the "Users" form using $_POST information.
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @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.
+ */
 function add_user() {
        if ( func_num_args() ) { // The hackiest hack that ever did hack
                global $current_user, $wp_roles;
 function add_user() {
        if ( func_num_args() ) { // The hackiest hack that ever did hack
                global $current_user, $wp_roles;
@@ -18,6 +33,16 @@ function add_user() {
        }
 }
 
        }
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param int $user_id Optional. User ID.
+ * @return unknown
+ */
 function edit_user( $user_id = 0 ) {
        global $current_user, $wp_roles, $wpdb;
        if ( $user_id != 0 ) {
 function edit_user( $user_id = 0 ) {
        global $current_user, $wp_roles, $wpdb;
        if ( $user_id != 0 ) {
@@ -71,7 +96,13 @@ function edit_user( $user_id = 0 ) {
        else if ( isset( $_POST['rich_editing'] ) )
                $user->rich_editing = $_POST['rich_editing'];
        else
        else if ( isset( $_POST['rich_editing'] ) )
                $user->rich_editing = $_POST['rich_editing'];
        else
-               $user->rich_editing = 'false';
+               $user->rich_editing = 'true';
+
+       $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] )? $_POST['comment_shortcuts'] : '';
+
+       $user->use_ssl = 0;
+       if ( !empty($_POST['use_ssl']) )
+               $user->use_ssl = 1;
 
        if ( !$update )
                $user->admin_color = 'fresh';  // Default to fresh for new users.
 
        if ( !$update )
                $user->admin_color = 'fresh';  // Default to fresh for new users.
@@ -138,12 +169,31 @@ function edit_user( $user_id = 0 ) {
        return $user_id;
 }
 
        return $user_id;
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @return array List of user IDs.
+ */
 function get_author_user_ids() {
        global $wpdb;
        $level_key = $wpdb->prefix . 'user_level';
        return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
 }
 
 function get_author_user_ids() {
        global $wpdb;
        $level_key = $wpdb->prefix . 'user_level';
        return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID.
+ * @return array|bool List of editable authors. False if no editable users.
+ */
 function get_editable_authors( $user_id ) {
        global $wpdb;
 
 function get_editable_authors( $user_id ) {
        global $wpdb;
 
@@ -159,13 +209,24 @@ function get_editable_authors( $user_id ) {
        return apply_filters('get_editable_authors', $authors);
 }
 
        return apply_filters('get_editable_authors', $authors);
 }
 
-function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID.
+ * @param bool $exclude_zeros Optional, default is true. Whether to exclude zeros.
+ * @return unknown
+ */
+function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
        global $wpdb;
 
        $user = new WP_User( $user_id );
 
        global $wpdb;
 
        $user = new WP_User( $user_id );
 
-       if ( ! $user->has_cap('edit_others_posts') ) {
-               if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
+       if ( ! $user->has_cap("edit_others_{$post_type}s") ) {
+               if ( $user->has_cap("edit_{$post_type}s") || $exclude_zeros == false )
                        return array($user->id);
                else
                        return false;
                        return array($user->id);
                else
                        return false;
@@ -180,6 +241,15 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
        return $wpdb->get_col( $query );
 }
 
        return $wpdb->get_col( $query );
 }
 
+/**
+ * {@internal Missing Short Description}}
+ *
+ * {@internal Missing Long Description}}
+ *
+ * @since unknown
+ *
+ * @return unknown
+ */
 function get_nonauthor_user_ids() {
        global $wpdb;
        $level_key = $wpdb->prefix . 'user_level';
 function get_nonauthor_user_ids() {
        global $wpdb;
        $level_key = $wpdb->prefix . 'user_level';
@@ -187,6 +257,15 @@ function get_nonauthor_user_ids() {
        return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
 }
 
        return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
 }
 
+/**
+ * Retrieve editable posts from other users.
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID to not retrieve posts from.
+ * @param string $type Optional, defaults to 'any'. Post type to retrieve, can be 'draft' or 'pending'.
+ * @return array List of posts from others.
+ */
 function get_others_unpublished_posts($user_id, $type='any') {
        global $wpdb;
 
 function get_others_unpublished_posts($user_id, $type='any') {
        global $wpdb;
 
@@ -209,14 +288,38 @@ function get_others_unpublished_posts($user_id, $type='any') {
        return apply_filters('get_others_drafts', $other_unpubs);
 }
 
        return apply_filters('get_others_drafts', $other_unpubs);
 }
 
+/**
+ * Retrieve drafts from other users.
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID.
+ * @return array List of drafts from other users.
+ */
 function get_others_drafts($user_id) {
        return get_others_unpublished_posts($user_id, 'draft');
 }
 
 function get_others_drafts($user_id) {
        return get_others_unpublished_posts($user_id, 'draft');
 }
 
+/**
+ * Retrieve pending review posts from other users.
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID.
+ * @return array List of posts with pending review post type from other users.
+ */
 function get_others_pending($user_id) {
        return get_others_unpublished_posts($user_id, 'pending');
 }
 
 function get_others_pending($user_id) {
        return get_others_unpublished_posts($user_id, 'pending');
 }
 
+/**
+ * Retrieve user data and filter it.
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID.
+ * @return object WP_User object with user data.
+ */
 function get_user_to_edit( $user_id ) {
        $user = new WP_User( $user_id );
        $user->user_login   = attribute_escape($user->user_login);
 function get_user_to_edit( $user_id ) {
        $user = new WP_User( $user_id );
        $user->user_login   = attribute_escape($user->user_login);
@@ -226,14 +329,22 @@ function get_user_to_edit( $user_id ) {
        $user->last_name    = attribute_escape($user->last_name);
        $user->display_name = attribute_escape($user->display_name);
        $user->nickname     = attribute_escape($user->nickname);
        $user->last_name    = attribute_escape($user->last_name);
        $user->display_name = attribute_escape($user->display_name);
        $user->nickname     = attribute_escape($user->nickname);
-       $user->aim          = attribute_escape($user->aim);
-       $user->yim          = attribute_escape($user->yim);
-       $user->jabber       = attribute_escape($user->jabber);
-       $user->description  =  wp_specialchars($user->description);
+       $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) : '';
 
        return $user;
 }
 
 
        return $user;
 }
 
+/**
+ * Retrieve the user's drafts.
+ *
+ * @since unknown
+ *
+ * @param int $user_id User ID.
+ * @return array
+ */
 function get_users_drafts( $user_id ) {
        global $wpdb;
        $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
 function get_users_drafts( $user_id ) {
        global $wpdb;
        $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
@@ -241,6 +352,20 @@ function get_users_drafts( $user_id ) {
        return $wpdb->get_results( $query );
 }
 
        return $wpdb->get_results( $query );
 }
 
+/**
+ * Remove user and optionally reassign posts and links to another user.
+ *
+ * If the $reassign parameter is not assigned to an User ID, then all posts will
+ * be deleted of that user. The action 'delete_user' that is passed the User ID
+ * being deleted will be run after the posts are either reassigned or deleted.
+ * The user meta will also be deleted that are for that User ID.
+ *
+ * @since unknown
+ *
+ * @param int $id User ID.
+ * @param int $reassign Optional. Reassign posts and links to new User ID.
+ * @return bool True when finished.
+ */
 function wp_delete_user($id, $reassign = 'novalue') {
        global $wpdb;
 
 function wp_delete_user($id, $reassign = 'novalue') {
        global $wpdb;
 
@@ -275,6 +400,13 @@ function wp_delete_user($id, $reassign = 'novalue') {
        return true;
 }
 
        return true;
 }
 
+/**
+ * Remove all capabilities from user.
+ *
+ * @since unknown
+ *
+ * @param int $id User ID.
+ */
 function wp_revoke_user($id) {
        $id = (int) $id;
 
 function wp_revoke_user($id) {
        $id = (int) $id;
 
@@ -282,27 +414,161 @@ function wp_revoke_user($id) {
        $user->remove_all_caps();
 }
 
        $user->remove_all_caps();
 }
 
-// WP_User_Search class
-// by Mark Jaquith
-
 if ( !class_exists('WP_User_Search') ) :
 if ( !class_exists('WP_User_Search') ) :
+/**
+ * WordPress User Search class.
+ *
+ * @since unknown
+ * @author Mark Jaquith
+ */
 class WP_User_Search {
 class WP_User_Search {
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
        var $results;
        var $results;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
        var $search_term;
        var $search_term;
+
+       /**
+        * Page number.
+        *
+        * @since unknown
+        * @access private
+        * @var int
+        */
        var $page;
        var $page;
+
+       /**
+        * Role name that users have.
+        *
+        * @since unknown
+        * @access private
+        * @var string
+        */
        var $role;
        var $role;
+
+       /**
+        * Raw page number.
+        *
+        * @since unknown
+        * @access private
+        * @var int|bool
+        */
        var $raw_page;
        var $raw_page;
+
+       /**
+        * Amount of users to display per page.
+        *
+        * @since unknown
+        * @access public
+        * @var int
+        */
        var $users_per_page = 50;
        var $users_per_page = 50;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
        var $first_user;
        var $first_user;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var int
+        */
        var $last_user;
        var $last_user;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
        var $query_limit;
        var $query_limit;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
        var $query_sort;
        var $query_sort;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
        var $query_from_where;
        var $query_from_where;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var int
+        */
        var $total_users_for_query = 0;
        var $total_users_for_query = 0;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var bool
+        */
        var $too_many_total_users = false;
        var $too_many_total_users = false;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
        var $search_errors;
 
        var $search_errors;
 
-       function WP_User_Search ($search_term = '', $page = '', $role = '') { // constructor
+       /**
+        * {@internal Missing Description}}
+        *
+        * @since unknown
+        * @access private
+        * @var unknown_type
+        */
+       var $paging_text;
+
+       /**
+        * PHP4 Constructor - Sets up the object properties.
+        *
+        * @since unknown
+        *
+        * @param string $search_term Search terms string.
+        * @param int $page Optional. Page ID.
+        * @param string $role Role name.
+        * @return WP_User_Search
+        */
+       function WP_User_Search ($search_term = '', $page = '', $role = '') {
                $this->search_term = $search_term;
                $this->raw_page = ( '' == $page ) ? false : (int) $page;
                $this->page = (int) ( '' == $page ) ? 1 : $page;
                $this->search_term = $search_term;
                $this->raw_page = ( '' == $page ) ? false : (int) $page;
                $this->page = (int) ( '' == $page ) ? 1 : $page;
@@ -314,6 +580,14 @@ class WP_User_Search {
                $this->do_paging();
        }
 
                $this->do_paging();
        }
 
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * {@internal Missing Long Description}}
+        *
+        * @since unknown
+        * @access public
+        */
        function prepare_query() {
                global $wpdb;
                $this->first_user = ($this->page - 1) * $this->users_per_page;
        function prepare_query() {
                global $wpdb;
                $this->first_user = ($this->page - 1) * $this->users_per_page;
@@ -338,6 +612,14 @@ class WP_User_Search {
 
        }
 
 
        }
 
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * {@internal Missing Long Description}}
+        *
+        * @since unknown
+        * @access public
+        */
        function query() {
                global $wpdb;
                $this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_sort . $this->query_limit);
        function query() {
                global $wpdb;
                $this->results = $wpdb->get_col('SELECT ID ' . $this->query_from_where . $this->query_sort . $this->query_limit);
@@ -348,10 +630,26 @@ class WP_User_Search {
                        $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
        }
 
                        $this->search_errors = new WP_Error('no_matching_users_found', __('No matching users were found!'));
        }
 
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * {@internal Missing Long Description}}
+        *
+        * @since unknown
+        * @access public
+        */
        function prepare_vars_for_template_usage() {
                $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
        }
 
        function prepare_vars_for_template_usage() {
                $this->search_term = stripslashes($this->search_term); // done with DB, from now on we want slashes gone
        }
 
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * {@internal Missing Long Description}}
+        *
+        * @since unknown
+        * @access public
+        */
        function do_paging() {
                if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
                        $args = array();
        function do_paging() {
                if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
                        $args = array();
@@ -367,23 +665,67 @@ class WP_User_Search {
                                'format' => 'userspage=%#%',
                                'add_args' => $args
                        ) );
                                'format' => 'userspage=%#%',
                                'add_args' => $args
                        ) );
+                       if ( $this->paging_text ) {
+                               $this->paging_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
+                                       number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ),
+                                       number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ),
+                                       number_format_i18n( $this->total_users_for_query ),
+                                       $this->paging_text
+                               );
+                       }
                }
        }
 
                }
        }
 
+       /**
+        * {@internal Missing Short Description}}
+        *
+        * {@internal Missing Long Description}}
+        *
+        * @since unknown
+        * @access public
+        *
+        * @return unknown
+        */
        function get_results() {
                return (array) $this->results;
        }
 
        function get_results() {
                return (array) $this->results;
        }
 
+       /**
+        * Displaying paging text.
+        *
+        * @see do_paging() Builds paging text.
+        *
+        * @since unknown
+        * @access public
+        */
        function page_links() {
                echo $this->paging_text;
        }
 
        function page_links() {
                echo $this->paging_text;
        }
 
+       /**
+        * Whether paging is enabled.
+        *
+        * @see do_paging() Builds paging text.
+        *
+        * @since unknown
+        * @access public
+        *
+        * @return bool
+        */
        function results_are_paged() {
                if ( $this->paging_text )
                        return true;
                return false;
        }
 
        function results_are_paged() {
                if ( $this->paging_text )
                        return true;
                return false;
        }
 
+       /**
+        * Whether there are search terms.
+        *
+        * @since unknown
+        * @access public
+        *
+        * @return bool
+        */
        function is_search() {
                if ( $this->search_term )
                        return true;
        function is_search() {
                if ( $this->search_term )
                        return true;
index 52d1d7b1ca9f8d3171e11f4e66d344f42f7977ef..9e15d54855db2a22b3c1ec311cf9e0f030d93c40 100644 (file)
@@ -1,6 +1,21 @@
 <?php
 <?php
+/**
+ * WordPress Widgets Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
 
-// $_search is unsanitized
+/**
+ * Display list of widgets, either all or matching search.
+ *
+ * The search parameter are search terms separated by spaces.
+ *
+ * @since unknown
+ *
+ * @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 ) {
        global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
        if ( $_search ) {
 function wp_list_widgets( $show = 'all', $_search = false ) {
        global $wp_registered_widgets, $sidebars_widgets, $wp_registered_widget_controls;
        if ( $_search ) {
@@ -46,9 +61,11 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
                        if ( ( 'unused' == $show && $sidebar ) || ( 'used' == $show && !$sidebar ) )
                                continue;
 
                        if ( ( 'unused' == $show && $sidebar ) || ( 'used' == $show && !$sidebar ) )
                                continue;
 
+                       if ( ! isset( $widget['params'][0] ) )
+                               $widget['params'][0] = array();
                        ob_start();
                        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 );
+                       $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_control_template = ob_get_contents();
                        ob_end_clean();
 
@@ -84,7 +101,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
                                        'edit' => $widget['id'],
                                        'key' => array_search( $widget['id'], $sidebars_widgets[$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 = '<textarea rows="1" cols="1">' . htmlspecialchars( $widget_control_template ) . '</textarea>';
                        }
 
@@ -148,8 +165,13 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
 <?php
 }
 
 <?php
 }
 
-
-
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param string $sidebar
+ */
 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' );
 ?>
@@ -163,7 +185,14 @@ function wp_list_widget_controls( $sidebar ) {
 <?php
 }
 
 <?php
 }
 
-
+/**
+ * {@internal Missing Short Description}}
+ *
+ * @since unknown
+ *
+ * @param array $params
+ * @return array
+ */
 function wp_list_widget_controls_dynamic_sidebar( $params ) {
        global $wp_registered_widgets;
        static $i = 0;
 function wp_list_widget_controls_dynamic_sidebar( $params ) {
        global $wp_registered_widgets;
        static $i = 0;
@@ -182,15 +211,22 @@ function wp_list_widget_controls_dynamic_sidebar( $params ) {
        return $params;
 }
 
        return $params;
 }
 
-/*
- * Meta widget used to display the control form for a widget.  Called from dynamic_sidebar()
+/**
+ * Meta widget used to display the control form for a widget.
+ *
+ * Called from dynamic_sidebar().
+ *
+ * @since unknown
+ *
+ * @param array $sidebar_args
+ * @return array
  */
 function wp_widget_control( $sidebar_args ) {
        global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
        $widget_id = $sidebar_args['widget_id'];
        $sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
 
  */
 function wp_widget_control( $sidebar_args ) {
        global $wp_registered_widgets, $wp_registered_widget_controls, $sidebars_widgets, $edit_widget;
        $widget_id = $sidebar_args['widget_id'];
        $sidebar_id = isset($sidebar_args['id']) ? $sidebar_args['id'] : false;
 
-       $control = $wp_registered_widget_controls[$widget_id];
+       $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
        $widget  = $wp_registered_widgets[$widget_id];
 
        $key = $sidebar_id ? array_search( $widget_id, $sidebars_widgets[$sidebar_id] ) : 'no-key'; // position of widget in sidebar
@@ -198,6 +234,13 @@ function wp_widget_control( $sidebar_args ) {
        $edit = -1 <  $edit_widget && is_numeric($key) && $edit_widget === $key; // (bool) are we currently editing this widget
 
        $id_format = $widget['id'];
        $edit = -1 <  $edit_widget && is_numeric($key) && $edit_widget === $key; // (bool) are we currently editing this widget
 
        $id_format = $widget['id'];
+
+       if ( ! isset( $sidebar_args['_show'] ) )
+               $sidebar_args['_show'] = '';
+
+       if ( ! isset( $sidebar_args['_display'] ) )
+               $sidebar_args['_display'] = '';
+
        // 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%'
        // 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%'
@@ -262,11 +305,11 @@ function wp_widget_control( $sidebar_args ) {
 
                                <?php if ( $control ) : ?>
 
 
                                <?php if ( $control ) : ?>
 
-                               <a class="widget-action widget-control-save wp-no-js-hidden edit alignleft" href="#save:<?php echo $id_format; ?>"><?php _e('Change'); ?></a>
+                               <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; ?>
 
 
                                <?php endif; ?>
 
-                               <a class="widget-action widget-control-remove delete 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>
+                               <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>
                </div>
                                <br class="clear" />
                        </div>
                </div>
@@ -276,6 +319,14 @@ function wp_widget_control( $sidebar_args ) {
        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 '';
 function wp_widget_control_ob_filter( $string ) {
        if ( false === $beg = strpos( $string, '%BEG_OF_TITLE%' ) )
                return '';
@@ -286,4 +337,4 @@ function wp_widget_control_ob_filter( $string ) {
        return trim( wp_specialchars( strip_tags( $string ) ) );
 }
 
        return trim( wp_specialchars( strip_tags( $string ) ) );
 }
 
-?>
+?>
\ No newline at end of file
index 3b77d104bc060f634c5bcee0a629d52d0e35cd85..3218970733c167fa6c7a49cd6bcd794a1d85da0b 100644 (file)
@@ -1,28 +1,40 @@
 <?php
 <?php
+/**
+ * Handle default dashboard widgets options AJAX.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once('admin.php');
 require_once('admin.php');
+
+/** Load WordPress Administration Dashboard API */
 require( 'includes/dashboard.php' );
 require( 'includes/dashboard.php' );
+
+/** Load Magpie RSS API or custom RSS API */
 require_once (ABSPATH . WPINC . '/rss.php');
 
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 
 switch ( $_GET['jax'] ) {
 
 require_once (ABSPATH . WPINC . '/rss.php');
 
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 
 switch ( $_GET['jax'] ) {
 
-case 'incominglinks' :
+case 'dashboard_incoming_links' :
        wp_dashboard_incoming_links_output();
        break;
 
        wp_dashboard_incoming_links_output();
        break;
 
-case 'devnews' :
+case 'dashboard_primary' :
        wp_dashboard_rss_output( 'dashboard_primary' );
        break;
 
        wp_dashboard_rss_output( 'dashboard_primary' );
        break;
 
-case 'planetnews' :
+case 'dashboard_secondary' :
        wp_dashboard_secondary_output();
        break;
 
        wp_dashboard_secondary_output();
        break;
 
-case 'plugins' :
+case 'dashboard_plugins' :
        wp_dashboard_plugins_output();
        break;
 
 }
 
        wp_dashboard_plugins_output();
        break;
 
 }
 
-?>
+?>
\ No newline at end of file
index 2401ef9f941dbdcf4d115967db25d134458d4c58..59fd228c59cdb4e5b4b01326fe96f91470d01932 100644 (file)
@@ -1,33 +1,25 @@
 <?php
 <?php
-
+/**
+ * Dashboard Administration Panel
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
+/** Load WordPress dashboard API */
 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
 
 wp_dashboard_setup();
 
 require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
 
 wp_dashboard_setup();
 
-function index_js() {
-?>
-<script type="text/javascript">
-jQuery(function($) {
-       var ajaxWidgets = {
-               dashboard_incoming_links: 'incominglinks',
-               dashboard_primary: 'devnews',
-               dashboard_secondary: 'planetnews',
-               dashboard_plugins: 'plugins'
-       };
-       $.each( ajaxWidgets, function(i,a) {
-               var e = jQuery('#' + i + ' div.dashboard-widget-content').not('.dashboard-widget-control').find('.widget-loading');
-               if ( e.size() ) { e.parent().load('index-extra.php?jax=' + a); }
-       } );
-});
-</script>
-<?php
-}
-add_action( 'admin_head', 'index_js' );
-
-wp_enqueue_script( 'jquery' );
+wp_enqueue_script( 'dashboard' );
+wp_enqueue_script( 'plugin-install' );
+wp_enqueue_script( 'media-upload' );
 wp_admin_css( 'dashboard' );
 wp_admin_css( 'dashboard' );
+wp_admin_css( 'plugin-install' );
+add_thickbox();
 
 $title = __('Dashboard');
 $parent_file = 'index.php';
 
 $title = __('Dashboard');
 $parent_file = 'index.php';
@@ -37,109 +29,16 @@ $today = current_time('mysql', 1);
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-
-<h2><?php _e('Dashboard'); ?></h2>
-
-<div id="rightnow">
-<h3 class="reallynow">
-       <span><?php _e('Right Now'); ?></span>
-
-<?php if ( $can_edit_posts = current_user_can( 'edit_posts' ) ) : ?>
-       <a href="post-new.php" class="rbutton"><strong><?php _e('Write a New Post'); ?></strong></a>
-<?php endif; if ( $can_edit_pages = current_user_can( 'edit_pages' ) ) : ?>
-       <a href="page-new.php" class="rbutton"><?php _e('Write a New Page'); ?></a>
-<?php endif; ?>
-       <br class="clear" />
-</h3>
-
-<?php
-$num_posts = wp_count_posts( 'post' );
-$num_pages = wp_count_posts( 'page' );
-
-$num_cats  = wp_count_terms('category');
-
-$num_tags = wp_count_terms('post_tag');
-
-$num_comm = get_comment_count( );
-
-$post_type_texts = array();
-
-if ( !empty($num_posts->publish) ) { // with feeds, anyone can tell how many posts there are.  Just unlink if !current_user_can
-       $post_text = sprintf( __ngettext( '%s post', '%s posts', $num_posts->publish ), number_format_i18n( $num_posts->publish ) );
-       $post_type_texts[] = $can_edit_posts ? "<a href='edit.php'>$post_text</a>" : $post_text;
-}
-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>';
-}
-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>';
-}
-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>';
-}
-
-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 ) );
-} else {
-       $pending_text = '';
-}
-
-$cats_text = sprintf( __ngettext( '%s category', '%s categories', $num_cats ), number_format_i18n( $num_cats ) );
-$tags_text = sprintf( __ngettext( '%s tag', '%s tags', $num_tags ), number_format_i18n( $num_tags ) );
-if ( current_user_can( 'manage_categories' ) ) {
-       $cats_text = "<a href='categories.php'>$cats_text</a>";
-       $tags_text = "<a href='edit-tags.php'>$tags_text</a>";
-}
-
-$total_comments = sprintf( __ngettext( '%1$s total', '%1$s total', $num_comm['total_comments'] ), number_format_i18n($num_comm['total_comments']) );
-$approved_comments = sprintf( __ngettext( '%1$s approved', '%1$s approved', $num_comm['approved'] ), number_format_i18n($num_comm['approved']) );
-$spam_comments = sprintf( __ngettext( '%1$s spam', '%1$s spam', $num_comm['spam'] ), number_format_i18n($num_comm['spam']) );
-$moderated_comments = sprintf( __ngettext( '%1$s awaiting moderation', '%1$s awaiting moderation', $num_comm['awaiting_moderation'] ), number_format_i18n($num_comm['awaiting_moderation']) );
-
-if( current_user_can( 'moderate_comments' ) ) {
-       $total_comments = "<a href='edit-comments.php'>{$total_comments}</a>";
-       $approved_comments = "<a href='edit-comments.php?comment_status=approved'>{$approved_comments}</a>";
-       $moderated_comments = "<a href='edit-comments.php?comment_status=moderated'>{$moderated_comments}</a>";
-}
-
-$comm_text = sprintf( __ngettext( 'You have %1$s comment, %2$s, %3$s and %4$s.', 'You have %1$s comments, %2$s, %3$s and %4$s.', $num_comm['total_comments'] ), $total_comments, $approved_comments, $spam_comments, $moderated_comments );
-
-$post_type_text = implode(', ', $post_type_texts);
-
-// There is always a category
-$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s %5$s' ), $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
-$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
-
-?>
-<p class="youhave"><?php echo $sentence; ?></p>
-<?php
-$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 );
-$widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
-if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
-       $widgets_text = "<a href='widgets.php'>$widgets_text</a>";
-?>
-<p class="youare">
-       <?php printf( __( 'You are using the %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
-       <?php if ( $can_switch_themes ) : ?>
-               <a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a>
-       <?php endif; ?>
-       <?php update_right_now_message(); ?>
-</p>
-<?php do_action( 'rightnow_end' ); ?>
-<?php do_action( 'activity_box_end' ); ?>
-</div><!-- rightnow -->
-
-<br class="clear" />
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
 
 <div id="dashboard-widgets-wrap">
 
 <?php wp_dashboard(); ?>
 
 
 <div id="dashboard-widgets-wrap">
 
 <?php wp_dashboard(); ?>
 
-
+<div class="clear"></div>
 </div><!-- dashboard-widgets-wrap -->
 
 </div><!-- wrap -->
 
 </div><!-- dashboard-widgets-wrap -->
 
 </div><!-- wrap -->
 
-<?php require('./admin-footer.php'); ?>
+<?php require(ABSPATH . 'wp-admin/admin-footer.php'); ?>
index eebe0e3e9d6bdee994f163f6f252cc6e78a37703..cddbc26a5dd44b5b10106e2f264a37525326eb46 100644 (file)
@@ -1,15 +1,76 @@
 <?php
 <?php
+/**
+ * Plugins may load this file to gain access to special helper functions for
+ * plugin installation. This file is not included by WordPress and it is
+ * recommended, to prevent fatal errors, that this file is included using
+ * require_once().
+ *
+ * These functions are not optimized for speed, but they should only be used
+ * once in a while, so speed shouldn't be a concern. If it is and you are
+ * needing to use these functions a lot, you might experience time outs. If you
+ * do, then it is advised to just write the SQL code yourself.
+ *
+ * You can turn debugging on, by setting $debug to 1 after you include this
+ * file.
+ *
+ * <code>
+ * check_column('wp_links', 'link_description', 'mediumtext');
+ * if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
+ *     echo "ok\n";
+ *
+ * $error_count = 0;
+ * $tablename = $wpdb->links;
+ * // check the column
+ * if (!check_column($wpdb->links, 'link_description', 'varchar(255)')) {
+ *     $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
+ *     $q = $wpdb->query($ddl);
+ * }
+ *
+ * if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
+ *     $res .= $tablename . ' - ok <br />';
+ * } else {
+ *     $res .= 'There was a problem with ' . $tablename . '<br />';
+ *     ++$error_count;
+ * }
+ * </code>
+ *
+ * @package WordPress
+ * @subpackage Plugin
+ */
+
+/**
+ * @global bool $wp_only_load_config
+ * @name $wp_only_load_config
+ * @var bool
+ * @since unknown
+ */
 $wp_only_load_config = true;
 $wp_only_load_config = true;
+
+/** Load WordPress Bootstrap */
 require_once(dirname(dirname(__FILE__)).'/wp-load.php');
 require_once(dirname(dirname(__FILE__)).'/wp-load.php');
-$debug = 0;
 
 /**
 
 /**
- ** maybe_create_table()
- ** Create db table if it doesn't exist.
- ** Returns:  true if already exists or on successful completion
- **           false on error
+ * Turn debugging on or off.
+ * @global bool|int $debug
+ * @name $debug
+ * @var bool|int
+ * @since unknown
  */
  */
+$debug = 0;
+
 if ( ! function_exists('maybe_create_table') ) :
 if ( ! function_exists('maybe_create_table') ) :
+/**
+ * Create database table, if it doesn't already exist.
+ *
+ * @since unknown
+ * @package WordPress
+ * @subpackage Plugin
+ * @uses $wpdb
+ *
+ * @param string $table_name Database table name.
+ * @param string $create_ddl Create database table SQL.
+ * @return bool False on error, true if already exists or success.
+ */
 function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
        foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
 function maybe_create_table($table_name, $create_ddl) {
        global $wpdb;
        foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
@@ -29,20 +90,29 @@ function maybe_create_table($table_name, $create_ddl) {
 }
 endif;
 
 }
 endif;
 
+if ( ! function_exists('maybe_add_column') ) :
 /**
 /**
- ** maybe_add_column()
- ** Add column to db table if it doesn't exist.
- ** Returns:  true if already exists or on successful completion
- **           false on error
+ * Add column to database table, if column doesn't already exist in table.
+ *
+ * @since unknown
+ * @package WordPress
+ * @subpackage Plugin
+ * @uses $wpdb
+ * @uses $debug
+ *
+ * @param string $table_name Database table name
+ * @param string $column_name Table column name
+ * @param string $create_ddl SQL to add column to table.
+ * @return bool False on failure. True, if already exists or was successful.
  */
  */
-if ( ! function_exists('maybe_add_column') ) :
 function maybe_add_column($table_name, $column_name, $create_ddl) {
        global $wpdb, $debug;
        foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
                if ($debug) echo("checking $column == $column_name<br />");
 function maybe_add_column($table_name, $column_name, $create_ddl) {
        global $wpdb, $debug;
        foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
                if ($debug) echo("checking $column == $column_name<br />");
-                       if ($column == $column_name) {
-                               return true;
-                       }
+
+               if ($column == $column_name) {
+                       return true;
+               }
        }
        //didn't find it try to create it.
        $wpdb->query($create_ddl);
        }
        //didn't find it try to create it.
        $wpdb->query($create_ddl);
@@ -57,10 +127,17 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
 endif;
 
 /**
 endif;
 
 /**
- ** maybe_drop_column()
- ** Drop column from db table if it exists.
- ** Returns:  true if it doesn't already exist or on successful drop
- **           false on error
+ * Drop column from database table, if it exists.
+ *
+ * @since unknown
+ * @package WordPress
+ * @subpackage Plugin
+ * @uses $wpdb
+ *
+ * @param string $table_name Table name
+ * @param string $column_name Column name
+ * @param string $drop_ddl SQL statement to drop column.
+ * @return bool False on failure, true on success or doesn't exist.
  */
 function maybe_drop_column($table_name, $column_name, $drop_ddl) {
        global $wpdb;
  */
 function maybe_drop_column($table_name, $column_name, $drop_ddl) {
        global $wpdb;
@@ -80,20 +157,34 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
        return true;
 }
 
        return true;
 }
 
-
 /**
 /**
- ** check_column()
- ** Check column matches passed in criteria.
- ** Pass in null to skip checking that criteria
- ** Returns:  true if it matches
- **           false otherwise
- ** (case sensitive) Column names returned from DESC table are:
- **      Field
- **      Type
- **      Null
- **      Key
- **      Default
- **      Extra
+ * Check column matches criteria.
+ *
+ * Uses the SQL DESC for retrieving the table info for the column. It will help
+ * understand the parameters, if you do more research on what column information
+ * is returned by the SQL statement. Pass in null to skip checking that
+ * criteria.
+ *
+ * Column names returned from DESC table are case sensitive and are listed:
+ *      Field
+ *      Type
+ *      Null
+ *      Key
+ *      Default
+ *      Extra
+ *
+ * @since unknown
+ * @package WordPress
+ * @subpackage Plugin
+ *
+ * @param string $table_name Table name
+ * @param string $col_name Column name
+ * @param string $col_type Column type
+ * @param bool $is_null Optional. Check is null.
+ * @param mixed $key Optional. Key info.
+ * @param mixed $default Optional. Default value.
+ * @param mixed $extra Optional. Extra value.
+ * @return bool True, if matches. False, if not matching.
  */
 function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
        global $wpdb, $debug;
  */
 function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
        global $wpdb, $debug;
@@ -102,55 +193,33 @@ function check_column($table_name, $col_name, $col_type, $is_null = null, $key =
 
        foreach ($results as $row ) {
                if ($debug > 1) print_r($row);
 
        foreach ($results as $row ) {
                if ($debug > 1) print_r($row);
-                       if ($row->Field == $col_name) {
-                               // got our column, check the params
-                               if ($debug) echo ("checking $row->Type against $col_type\n");
-                               if (($col_type != null) && ($row->Type != $col_type)) {
-                                       ++$diffs;
-                               }
-                               if (($is_null != null) && ($row->Null != $is_null)) {
-                                       ++$diffs;
-                               }
-                               if (($key != null) && ($row->Key  != $key)) {
-                                       ++$diffs;
-                               }
-                               if (($default != null) && ($row->Default != $default)) {
-                                       ++$diffs;
-                               }
-                               if (($extra != null) && ($row->Extra != $extra)) {
-                                       ++$diffs;
-                               }
-                               if ($diffs > 0) {
-                                       if ($debug) echo ("diffs = $diffs returning false\n");
-                                       return false;
-                               }
-                               return true;
-                       } // end if found our column
+
+               if ($row->Field == $col_name) {
+                       // got our column, check the params
+                       if ($debug) echo ("checking $row->Type against $col_type\n");
+                       if (($col_type != null) && ($row->Type != $col_type)) {
+                               ++$diffs;
+                       }
+                       if (($is_null != null) && ($row->Null != $is_null)) {
+                               ++$diffs;
+                       }
+                       if (($key != null) && ($row->Key  != $key)) {
+                               ++$diffs;
+                       }
+                       if (($default != null) && ($row->Default != $default)) {
+                               ++$diffs;
+                       }
+                       if (($extra != null) && ($row->Extra != $extra)) {
+                               ++$diffs;
+                       }
+                       if ($diffs > 0) {
+                               if ($debug) echo ("diffs = $diffs returning false\n");
+                               return false;
+                       }
+                       return true;
+               } // end if found our column
        }
        return false;
 }
 
        }
        return false;
 }
 
-/*
-echo "<p>testing</p>";
-echo "<pre>";
-
-//check_column('wp_links', 'link_description', 'mediumtext');
-//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
-//    echo "ok\n";
-$error_count = 0;
-$tablename = $wpdb->links;
-// check the column
-if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
-{
-       $ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
-       $q = $wpdb->query($ddl);
-}
-if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
-       $res .= $tablename . ' - ok <br />';
-} else {
-       $res .= 'There was a problem with ' . $tablename . '<br />';
-       ++$error_count;
-}
-echo "</pre>";
-*/
 ?>
 ?>
index 32ef35dc4fd362225d97a8898938a62bcdf81003..de5b970d6db1c0bca454116245986b3f178bf222 100644 (file)
@@ -1,14 +1,38 @@
 <?php
 <?php
+/**
+ * WordPress Installer
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * We are installing WordPress.
+ *
+ * @since unknown
+ * @var bool
+ */
 define('WP_INSTALLING', true);
 
 define('WP_INSTALLING', true);
 
+/** Load WordPress Bootstrap */
 require_once('../wp-load.php');
 require_once('../wp-load.php');
+
+/** Load WordPress Administration Upgrade API */
 require_once('./includes/upgrade.php');
 
 if (isset($_GET['step']))
        $step = $_GET['step'];
 else
        $step = 0;
 require_once('./includes/upgrade.php');
 
 if (isset($_GET['step']))
        $step = $_GET['step'];
 else
        $step = 0;
-function display_header(){
+
+/**
+ * Display install header.
+ *
+ * @since unknown
+ * @package WordPress
+ * @subpackage Installer
+ */
+function display_header() {
 header( 'Content-Type: text/html; charset=utf-8' );
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 header( 'Content-Type: text/html; charset=utf-8' );
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -65,9 +89,9 @@ switch($step) {
 
                display_header();
                // Fill in the data we gathered
 
                display_header();
                // Fill in the data we gathered
-               $weblog_title = stripslashes($_POST['weblog_title']);
-               $admin_email = stripslashes($_POST['admin_email']);
-               $public = (int) $_POST['blog_public'];
+               $weblog_title = isset($_POST['weblog_title']) ? stripslashes($_POST['weblog_title']) : '';
+               $admin_email = isset($_POST['admin_email']) ? stripslashes($_POST['admin_email']) : '';
+               $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0;
                // check e-mail address
                if (empty($admin_email)) {
                        // TODO: poka-yoke
                // check e-mail address
                if (empty($admin_email)) {
                        // TODO: poka-yoke
index a327338025ee5e6869e3251fe253a84bb7c3cd82..fa23b226ae0f8392157a469c13c6d901f3e39bf6 100644 (file)
@@ -7,6 +7,14 @@ jQuery(function($) {
                var name = $("<span>" + $('name', r).text() + "</span>").html();
                var id = $('cat', r).attr('id');
                options[options.length] = new Option(name, id);
                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 delAfter = function( r, settings ) {
@@ -19,5 +27,11 @@ jQuery(function($) {
        if ( options )
                $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
        else
        if ( options )
                $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
        else
-               $('#the-list').wpList();
+               $('#the-list').wpList({ addAfter: addAfter2 });
+
+       if ( jQuery('#link-category-search-input').size() ) {
+               columns.init('edit-link-categories');
+       } else {
+               columns.init('categories');
+       }
 });
 });
index 11a362765cdaecc1b9d603ad51fedad1a488b8e1..7d5055255b2fdcbc38b15e832b12c1b27ec24408 100644 (file)
@@ -1,26 +1,39 @@
-jQuery(document).ready( function() {
-       add_postbox_toggles('comment');
-
-       // close postboxes that should be closed
-       jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
-
-       // show things that should be visible, hide what should be hidden
+jQuery(document).ready( function($) {
        jQuery('.hide-if-no-js').show();
        jQuery('.hide-if-js').hide();
 
        jQuery('.hide-if-no-js').show();
        jQuery('.hide-if-js').hide();
 
-       jQuery('.edit-timestamp').click(function () {
-               if (jQuery('#timestampdiv').is(":hidden")) {
-                       jQuery('#timestampdiv').slideDown("normal");
-                       jQuery('.edit-timestamp').text(commentL10n.cancel);
-               } else {
-                       jQuery('#timestampdiv').hide();
-                       jQuery('#mm').val(jQuery('#hidden_mm').val());
-                       jQuery('#jj').val(jQuery('#hidden_jj').val());
-                       jQuery('#aa').val(jQuery('#hidden_aa').val());
-                       jQuery('#hh').val(jQuery('#hidden_hh').val());
-                       jQuery('#mn').val(jQuery('#hidden_mn').val());
-                       jQuery('.edit-timestamp').text(commentL10n.edit);
+       var stamp = $('#timestamp').html();
+       $('.edit-timestamp').click(function () {
+               if ($('#timestampdiv').is(":hidden")) {
+                       $('#timestampdiv').slideDown("normal");
+                       $('.edit-timestamp').hide();
                }
                return false;
                }
                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
 });
\ No newline at end of file
index 6559d7d2c93e7ef4080f0b492e5d496b0ae89bb1..67e38d81acc58c29cf03cfb2fe5aea50589f471b 100644 (file)
-jQuery(document).ready( function() {
+
+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
        // pulse
-       jQuery('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
+       $('.fade').animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300).animate( { backgroundColor: '#ffffe0' }, 300).animate( { backgroundColor: '#fffbcc' }, 300);
 
 
-       // Reveal
-       jQuery('.wp-no-js-hidden').removeClass( 'wp-no-js-hidden' );
+       // 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
 
        // Basic form validation
-       if ( ( 'undefined' != typeof wpAjax ) && jQuery.isFunction( wpAjax.validateForm ) ) {
-               jQuery('form.validate').submit( function() { return wpAjax.validateForm( jQuery(this) ); } );
+       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 '';
+               });
+       });
 });
 
 });
 
-(function(JQ) {
-       JQ.fn.tTips = function() {
+var showNotice, adminMenu, columns;
 
 
-               JQ('body').append('<div id="tTips"><p id="tTips_inside"></p></div>');
-               var TT = JQ('#tTips');
+// stub for doing better warnings
+showNotice = {
+       warn : function(text) {
+               if ( confirm(text) )
+                       return true;
 
 
-               this.each(function() {
-                       var el = JQ(this), txt;
-                       
-                       if ( txt = el.attr('title') ) el.attr('tip', txt).removeAttr('title');
-                       else return;
-                       el.find('img').removeAttr('alt');
+               return false;
+       },
 
 
-                       el.mouseover(function(e) {
-                               txt = el.attr('tip'), o = el.offset();;
+       note : function(text) {
+               alert(text);
+       }
+};
+
+(function($){
+// sidebar admin menu
+adminMenu = {
 
 
-                               clearTimeout(TT.sD);
-                               TT.find('p').html(txt);
+       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');
+               });
+       },
 
 
-                               TT.css({'top': o.top - 43, 'left': o.left - 5});
-                               TT.sD = setTimeout(function(){TT.fadeIn(150);}, 100);
+       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
                        });
 
                        });
 
-                       el.mouseout(function() {
-                               clearTimeout(TT.sD);
-                               TT.css({display : 'none'});
-                       })
+               }
+       },
+
+       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);
+
 
 
-jQuery(function(){jQuery('#media-buttons a').tTips();});
+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();
+});
diff --git a/wp-admin/js/dashboard.js b/wp-admin/js/dashboard.js
new file mode 100644 (file)
index 0000000..c99163a
--- /dev/null
@@ -0,0 +1,52 @@
+
+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();
+
+} );
index f2bf8f82b51fdfdd15b441a4e9f471a749e12157..349a57d73dfdecceab0e7203e279a7a243bb4b87 100644 (file)
 var theList; var theExtraList;
 var theList; var theExtraList;
-jQuery(function($) {
-
-var dimAfter = function( r, settings ) {
-       $('li span.comment-count').each( function() {
-               var a = $(this);
-               var n = parseInt(a.html(),10);
-               n = n + ( $('#' + settings.element).is('.' + settings.dimClass) ? 1 : -1 );
-               if ( n < 0 ) { n = 0; }
-               a.html( n.toString() );
-               $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
-       });
-       $('.post-com-count span.comment-count').each( function() {
-               var a = $(this);
-               var n = parseInt(a.html(),10);
-               var t = parseInt(a.parent().attr('title'), 10);
-               if ( $('#' + settings.element).is('.unapproved') ) { // we unapproved a formerly approved comment
-                       n = n - 1;
-                       t = t + 1;
-               } else { // we approved a formerly unapproved comment
-                       n = n + 1;
-                       t = t - 1;
+(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;
                }
                }
-               if ( n < 0 ) { n = 0; }
-               if ( t < 0 ) { t = 0; }
-               if ( t >= 0 ) { a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) ); }
-               if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
-               a.html( n.toString() );
-       });
-}
-
-var delAfter = function( r, settings ) {
-       $('li span.comment-count').each( function() {
-               var a = $(this);
-               var n = parseInt(a.html(),10);
-               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;
+
+               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 ( n < 0 ) { n = 0; }
-               a.html( n.toString() );
-               $('#awaiting-mod')[ 0 == n ? 'addClass' : 'removeClass' ]('count-0');
-       });
-       $('.post-com-count span.comment-count').each( function() {
-               var a = $(this);
-               if ( $('#' + settings.element).is('.unapproved') ) { // we deleted a formerly unapproved comment
-                       var t = parseInt(a.parent().attr('title'), 10);
-                       if ( t < 1 ) { return; }
-                       t = t - 1;
-                       a.parent().attr('title', adminCommentsL10n.pending.replace( /%i%/, t.toString() ) );
-                       if ( 0 === t ) { a.parents('strong:first').replaceWith( a.parents('strong:first').html() ); }
-                       return;
+
+               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;
                }
                }
-               var n = parseInt(a.html(),10) - 1;
-               a.html( n.toString() );
-       });
 
 
-       if ( theExtraList.size() == 0 || theExtraList.children().size() == 0 ) {
-               return;
+               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();
 
 
-       theList.get(0).wpList.add( theExtraList.children(':eq(0)').remove().clone() );
-       $('#get-extra-comments').submit();
-}
+       if ( typeof QTags != 'undefined' )
+               ed_reply = new QTags('ed_reply', 'replycontent', 'replycontainer', 'more');
 
 
-theExtraList = $('#the-extra-comment-list').wpList( { alt: '', delColor: 'none', addColor: 'none' } );
-theList = $('#the-comment-list').wpList( { alt: '', dimAfter: dimAfter, delAfter: delAfter, addColor: 'none' } );
+       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);
index 4b32f1b101683fa62057e638ec46d226c9c3ccc1..935267a28666b95564483a905dbeb4b1c79697f3 100644 (file)
-wpEditorInit = function() {
-    // Activate tinyMCE if it's the user's default editor
-    if ( ( 'undefined' == typeof wpTinyMCEConfig ) || 'tinymce' == wpTinyMCEConfig.defaultEditor ) {
-        document.getElementById('editorcontainer').style.padding = '0px';
-        tinyMCE.execCommand("mceAddControl", false, "content");
-       } else {
-        var H;
-        if ( H = tinymce.util.Cookie.getHash("TinyMCE_content_size") )
-            document.getElementById('content').style.height = H.ch - 30 + 'px';
-    }
-};
 
 
-switchEditors = {
+var switchEditors = {
+
+       mode : '',
+
+       I : function(e) {
+               return document.getElementById(e);
+       },
 
 
-    saveCallback : function(el, content, body) {
+       edInit : function() {
+               var h = tinymce.util.Cookie.getHash("TinyMCE_content_size"), H = this.I('edButtonHTML'), P = this.I('edButtonPreview');
 
 
-        document.getElementById(el).style.color = '#fff';
-        if ( tinyMCE.activeEditor.isHidden() ) 
-            content = document.getElementById(el).value;
-        else
-            content = this.pre_wpautop(content);
+               // 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");
+               }
+       },
 
 
-        return content;
-    },
+       saveCallback : function(el, content, body) {
 
 
-    pre_wpautop : function(content) {
-        // We have a TON of cleanup to do. Line breaks are already stripped.
+               if ( tinyMCE.activeEditor.isHidden() )
+                       content = this.I(el).value;
+               else
+                       content = this.pre_wpautop(content);
 
 
-        // 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>');
-        });
+               return content;
+       },
 
 
-        // 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>');
+       pre_wpautop : function(content) {
+               // We have a TON of cleanup to do. Line breaks are already stripped.
 
 
-        // Mark </p> if it has any attributes.
-        content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
+               // 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>');
+               });
 
 
-        // Sepatate <div> containing <p>
-        content = content.replace(new RegExp('<div([^>]*)>\\s*<p>', 'mgi'), '<div$1>\n\n');
+               // 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>');
 
 
-        // 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');
+               // Mark </p> if it has any attributes.
+               content = content.replace(new RegExp('(<p [^>]+>.*?)</p>', 'mg'), '$1</p#>');
 
 
-        // 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');
+               // 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');
 
                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) {
-        var ed = tinyMCE.get(id);
-        var qt = document.getElementById('quicktags');
-        var H = document.getElementById('edButtonHTML');
-        var P = document.getElementById('edButtonPreview');
-        var ta = document.getElementById(id);
-        var ec = document.getElementById('editorcontainer');
-
-        if ( ! ed || ed.isHidden() ) {
-            ta.style.color = '#fff';
-
-            this.edToggle(P, H);
-            edCloseAllTags(); // :-(
-
-            qt.style.display = 'none';
-            ec.style.padding = '0px';
-            ta.style.padding = '0px';
-
-            ta.value = this.wpautop(ta.value);
-
-            if ( ed ) ed.show();
-            else tinyMCE.execCommand("mceAddControl", false, id);
-
-            this.wpSetDefaultEditor('tinymce');
-        } else {
-            this.edToggle(H, P);
-            ta.style.height = ed.getContentAreaContainer().offsetHeight + 6 + 'px';
-
-            ed.hide();
-            qt.style.display = 'block';
-
-            if ( tinymce.isIE6 ) {
-                               ta.style.width = '98%';
-                               ec.style.padding = '0px';
-                               ta.style.padding = '6px';
-                       } else {
-                               ta.style.width = '100%';
-                               ec.style.padding = '6px';
-            }
-
-            ta.style.color = '';
-            this.wpSetDefaultEditor('html');
-        }
-    },
-
-    edToggle : function(A, B) {
-        A.className = 'active';
-        B.className = '';
-
-        B.onclick = A.onclick;
-        A.onclick = null;
-    },
-
-    wpSetDefaultEditor : function(editor) {
-        try {
-            editor = escape( editor.toString() );
-        } catch(err) {
-            editor = 'tinymce';
-        }
-
-        var userID = document.getElementById('user-id');
-        var date = new Date();
-        date.setTime(date.getTime()+(10*365*24*60*60*1000));
-        document.cookie = "wordpress_editor_" + userID.value + "=" + editor + "; expires=" + date.toGMTString();
-    },
-
-    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) {
+               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');
                        a = a.replace(/<br ?\/?>[\r\n]*/g, '\n');
                        return a.replace(/<\/?p( [^>]*)?>[\r\n]*/g, '\n');
-        });
+               });
 
 
-           return pee;
-    }
-}
+               return pee;
+       }
+};
diff --git a/wp-admin/js/farbtastic.js b/wp-admin/js/farbtastic.js
new file mode 100644 (file)
index 0000000..9399d0c
--- /dev/null
@@ -0,0 +1,333 @@
+// $Id: farbtastic.js,v 1.2 2007/01/08 22:53:01 unconed Exp $
+// Farbtastic 1.2
+
+var farbtastic_click = false;
+
+jQuery.fn.farbtastic = function (callback) {
+  jQuery.farbtastic(this, callback);
+  return this;
+};
+
+jQuery.farbtastic = function (container, callback) {
+  var container = jQuery(container).get(0);
+  return container.farbtastic || (container.farbtastic = new jQuery._farbtastic(container, callback));
+}
+
+jQuery._farbtastic = function (container, callback) {
+  // Store farbtastic object
+  var fb = this;
+
+  // Insert markup
+  jQuery(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');
+  var e = jQuery('.farbtastic', container);
+  fb.wheel = jQuery('.wheel', container).get(0);
+  // Dimensions
+  fb.radius = 84;
+  fb.square = 100;
+  fb.width = 194;
+
+  // Fix background PNGs in IE6
+  if (navigator.appVersion.match(/MSIE [0-6]\./)) {
+    jQuery('*', e).each(function () {
+      if (this.currentStyle.backgroundImage != 'none') {
+        var image = this.currentStyle.backgroundImage;
+        image = this.currentStyle.backgroundImage.substring(5, image.length - 2);
+        jQuery(this).css({
+          'backgroundImage': 'none',
+          'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='" + image + "')"
+        });
+      }
+    });
+  }
+
+  /**
+   * Link to the given element(s) or callback.
+   */
+  fb.linkTo = function (callback) {
+    // Unbind previous nodes
+    if (typeof fb.callback == 'object') {
+      jQuery(fb.callback).unbind('keyup', fb.updateValue);
+    }
+
+    // Reset color
+    fb.color = null;
+
+    // Bind callback or elements
+    if (typeof callback == 'function') {
+      fb.callback = callback;
+    }
+    else if (typeof callback == 'object' || typeof callback == 'string') {
+      fb.callback = jQuery(callback);
+      fb.callback.bind('keyup', fb.updateValue);
+      if (fb.callback.get(0).value) {
+        fb.setColor(fb.callback.get(0).value);
+      }
+    }
+    return this;
+  }
+  fb.updateValue = function (event) {
+    if (this.value && this.value != fb.color) {
+      fb.setColor(this.value);
+    }
+  }
+
+  /**
+   * Change color with HTML syntax #123456
+   */
+  fb.setColor = function (color) {
+    var unpack = fb.unpack(color);
+    if (fb.color != color && unpack) {
+      fb.color = color;
+      fb.rgb = unpack;
+      fb.hsl = fb.RGBToHSL(fb.rgb);
+      fb.updateDisplay();
+    }
+    return this;
+  }
+
+  /**
+   * Change color with HSL triplet [0..1, 0..1, 0..1]
+   */
+  fb.setHSL = function (hsl) {
+    fb.hsl = hsl;
+    fb.rgb = fb.HSLToRGB(hsl);
+    fb.color = fb.pack(fb.rgb);
+    fb.updateDisplay();
+    return this;
+  }
+
+  /////////////////////////////////////////////////////
+
+  /**
+   * Retrieve the coordinates of the given event relative to the center
+   * of the widget.
+   */
+  fb.widgetCoords = function (event) {
+    var x, y;
+    var el = event.target || event.srcElement;
+    var reference = fb.wheel;
+
+    if (typeof event.offsetX != 'undefined') {
+      // Use offset coordinates and find common offsetParent
+      var pos = { x: event.offsetX, y: event.offsetY };
+
+      // Send the coordinates upwards through the offsetParent chain.
+      var e = el;
+      while (e) {
+        e.mouseX = pos.x;
+        e.mouseY = pos.y;
+        pos.x += e.offsetLeft;
+        pos.y += e.offsetTop;
+        e = e.offsetParent;
+      }
+
+      // Look for the coordinates starting from the wheel widget.
+      var e = reference;
+      var offset = { x: 0, y: 0 }
+      while (e) {
+        if (typeof e.mouseX != 'undefined') {
+          x = e.mouseX - offset.x;
+          y = e.mouseY - offset.y;
+          break;
+        }
+        offset.x += e.offsetLeft;
+        offset.y += e.offsetTop;
+        e = e.offsetParent;
+      }
+
+      // Reset stored coordinates
+      e = el;
+      while (e) {
+        e.mouseX = undefined;
+        e.mouseY = undefined;
+        e = e.offsetParent;
+      }
+    }
+    else {
+      // Use absolute coordinates
+      var pos = fb.absolutePosition(reference);
+      x = (event.pageX || 0*(event.clientX + jQuery('html').get(0).scrollLeft)) - pos.x;
+      y = (event.pageY || 0*(event.clientY + jQuery('html').get(0).scrollTop)) - pos.y;
+    }
+    // Subtract distance to middle
+    return { x: x - fb.width / 2, y: y - fb.width / 2 };
+  }
+
+  /**
+   * Mousedown handler
+   */
+  fb.mousedown = function (event) {
+       farbtastic_click = true;
+    // Capture mouse
+    if (!document.dragging) {
+      jQuery(document).bind('mousemove', fb.mousemove).bind('mouseup', fb.mouseup);
+      document.dragging = true;
+    }
+
+    // Check which area is being dragged
+    var pos = fb.widgetCoords(event);
+    fb.circleDrag = Math.max(Math.abs(pos.x), Math.abs(pos.y)) * 2 > fb.square;
+
+    // Process
+    fb.mousemove(event);
+    return false;
+  }
+
+  /**
+   * Mousemove handler
+   */
+  fb.mousemove = function (event) {
+    // Get coordinates relative to color picker center
+    var pos = fb.widgetCoords(event);
+
+    // Set new HSL parameters
+    if (fb.circleDrag) {
+      var hue = Math.atan2(pos.x, -pos.y) / 6.28;
+      if (hue < 0) hue += 1;
+      fb.setHSL([hue, fb.hsl[1], fb.hsl[2]]);
+    }
+    else {
+      var sat = Math.max(0, Math.min(1, -(pos.x / fb.square) + .5));
+      var lum = Math.max(0, Math.min(1, -(pos.y / fb.square) + .5));
+      fb.setHSL([fb.hsl[0], sat, lum]);
+    }
+    return false;
+  }
+
+  /**
+   * Mouseup handler
+   */
+  fb.mouseup = function () {
+    // Uncapture mouse
+       farbtastic_click = false;
+    jQuery(document).unbind('mousemove', fb.mousemove);
+    jQuery(document).unbind('mouseup', fb.mouseup);
+    document.dragging = false;
+  }
+
+  /**
+   * Update the markers and styles
+   */
+  fb.updateDisplay = function () {
+    // Markers
+    var angle = fb.hsl[0] * 6.28;
+    jQuery('.h-marker', e).css({
+      left: Math.round(Math.sin(angle) * fb.radius + fb.width / 2) + 'px',
+      top: Math.round(-Math.cos(angle) * fb.radius + fb.width / 2) + 'px'
+    });
+
+    jQuery('.sl-marker', e).css({
+      left: Math.round(fb.square * (.5 - fb.hsl[1]) + fb.width / 2) + 'px',
+      top: Math.round(fb.square * (.5 - fb.hsl[2]) + fb.width / 2) + 'px'
+    });
+
+    // Saturation/Luminance gradient
+    jQuery('.color', e).css('backgroundColor', fb.pack(fb.HSLToRGB([fb.hsl[0], 1, 0.5])));
+
+    // Linked elements or callback
+    if (typeof fb.callback == 'object') {
+      // Set background/foreground color
+      jQuery(fb.callback).css({
+        backgroundColor: fb.color,
+        color: fb.hsl[2] > 0.5 ? '#000' : '#fff'
+      });
+
+      // Change linked value
+      jQuery(fb.callback).each(function() {
+        if (this.value && this.value != fb.color) {
+          this.value = fb.color;
+        }
+      });
+    }
+    else if (typeof fb.callback == 'function') {
+      fb.callback.call(fb, fb.color);
+    }
+  }
+
+  /**
+   * Get absolute position of element
+   */
+  fb.absolutePosition = function (el) {
+    var r = { x: el.offsetLeft, y: el.offsetTop };
+    // Resolve relative to offsetParent
+    if (el.offsetParent) {
+      var tmp = fb.absolutePosition(el.offsetParent);
+      r.x += tmp.x;
+      r.y += tmp.y;
+    }
+    return r;
+  };
+
+  /* Various color utility functions */
+  fb.pack = function (rgb) {
+    var r = Math.round(rgb[0] * 255);
+    var g = Math.round(rgb[1] * 255);
+    var b = Math.round(rgb[2] * 255);
+    return '#' + (r < 16 ? '0' : '') + r.toString(16) +
+           (g < 16 ? '0' : '') + g.toString(16) +
+           (b < 16 ? '0' : '') + b.toString(16);
+  }
+
+  fb.unpack = function (color) {
+    if (color.length == 7) {
+      return [parseInt('0x' + color.substring(1, 3)) / 255,
+        parseInt('0x' + color.substring(3, 5)) / 255,
+        parseInt('0x' + color.substring(5, 7)) / 255];
+    }
+    else if (color.length == 4) {
+      return [parseInt('0x' + color.substring(1, 2)) / 15,
+        parseInt('0x' + color.substring(2, 3)) / 15,
+        parseInt('0x' + color.substring(3, 4)) / 15];
+    }
+  }
+
+  fb.HSLToRGB = function (hsl) {
+    var m1, m2, r, g, b;
+    var h = hsl[0], s = hsl[1], l = hsl[2];
+    m2 = (l <= 0.5) ? l * (s + 1) : l + s - l*s;
+    m1 = l * 2 - m2;
+    return [this.hueToRGB(m1, m2, h+0.33333),
+        this.hueToRGB(m1, m2, h),
+        this.hueToRGB(m1, m2, h-0.33333)];
+  }
+
+  fb.hueToRGB = function (m1, m2, h) {
+    h = (h < 0) ? h + 1 : ((h > 1) ? h - 1 : h);
+    if (h * 6 < 1) return m1 + (m2 - m1) * h * 6;
+    if (h * 2 < 1) return m2;
+    if (h * 3 < 2) return m1 + (m2 - m1) * (0.66666 - h) * 6;
+    return m1;
+  }
+
+  fb.RGBToHSL = function (rgb) {
+    var min, max, delta, h, s, l;
+    var r = rgb[0], g = rgb[1], b = rgb[2];
+    min = Math.min(r, Math.min(g, b));
+    max = Math.max(r, Math.max(g, b));
+    delta = max - min;
+    l = (min + max) / 2;
+    s = 0;
+    if (l > 0 && l < 1) {
+      s = delta / (l < 0.5 ? (2 * l) : (2 - 2 * l));
+    }
+    h = 0;
+    if (delta > 0) {
+      if (max == r && max != g) h += (g - b) / delta;
+      if (max == g && max != b) h += (2 + (b - r) / delta);
+      if (max == b && max != r) h += (4 + (r - g) / delta);
+      h /= 6;
+    }
+    return [h, s, l];
+  }
+
+  // Install mousedown handler (the others are set on the document on-demand)
+  jQuery('*', e).mousedown(fb.mousedown);
+
+    // Init color
+  fb.setColor('#000000');
+
+  // Set linked elements/callback
+  if (callback) {
+    fb.linkTo(callback);
+  }
+}
\ No newline at end of file
diff --git a/wp-admin/js/forms.js b/wp-admin/js/forms.js
deleted file mode 100644 (file)
index 9e493e5..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-function checkAll(jQ) { // use attr( checked, fn )
-       jQuery(jQ).find( 'tbody:visible :checkbox' ).attr( 'checked', function() {
-               return jQuery(this).attr( 'checked' ) ? '' : 'checked';
-       } );
-}
-
-jQuery( function($) {
-       var lastClicked = false;
-       $( 'tbody :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 );
-                       if ( 0 < first && 0 < last && first != last ) {
-                               checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
-                       }
-               }
-               lastClicked = this;
-               return true;
-       } );
-       $( 'thead :checkbox' ).click( function() {
-               checkAll( $(this).parents( 'form:first' ) );
-       } );
-} );
\ No newline at end of file
index ed988dc5c83a5fa70e592081c2120626ac9c534e..c0be92f8e55bb28ae43d04f20ed48899b00c8ed1 100644 (file)
@@ -25,4 +25,151 @@ jQuery(document).ready(function($){
        $('.menu_order_input').each(function(){
                if ( this.value == '0' ) this.value = '';
        });
        $('.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;
+       }
+};
diff --git a/wp-admin/js/inline-edit-post.js b/wp-admin/js/inline-edit-post.js
new file mode 100644 (file)
index 0000000..bda63eb
--- /dev/null
@@ -0,0 +1,266 @@
+
+(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);
diff --git a/wp-admin/js/inline-edit-tax.js b/wp-admin/js/inline-edit-tax.js
new file mode 100644 (file)
index 0000000..d5539cc
--- /dev/null
@@ -0,0 +1,152 @@
+
+(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);
index 2b3fa65cbabd7a3cce5be70735cf99a5f23e1679..716b34452ad192598b47a86edd142a0613c82e52 100644 (file)
@@ -1,17 +1,17 @@
-jQuery(document).ready( function() {
+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
        // close postboxes that should be closed
        jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
 
        jQuery('#link_name').focus();
        // postboxes
-       add_postbox_toggles('link');
+       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' ) } );
 
        // 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(); } );
+       jQuery('#category-add-submit').click( function() { newCat.focus(); } );
        var noSyncChecks = false; // prophylactic. necessary?
        var syncChecks = function() {
                if ( noSyncChecks )
        var noSyncChecks = false; // prophylactic. necessary?
        var syncChecks = function() {
                if ( noSyncChecks )
@@ -42,6 +42,12 @@ jQuery(document).ready( function() {
                response: 'category-ajax-response',
                addAfter: catAddAfter
        } );
                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 );
        jQuery('#category-add-toggle').click( function() {
                jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
                categoryTabs.tabsClick( 1 );
index 4d4065bc1a19f07cd3df22f6369544981cba5b04..beb8c96b7de223f626ba5c8a62ae34845a3fa43e 100644 (file)
@@ -5,12 +5,21 @@ function send_to_editor(h) {
                if (tinymce.isIE)
                        ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
 
                if (tinymce.isIE)
                        ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
 
-               if ( h.indexOf('[caption') != -1 )
-                       h = ed.plugins.wpeditimage._do_shcode(h);
-               
+               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);
                ed.execCommand('mceInsertContent', false, h);
-       } else
+
+       } else if ( typeof edInsertContent == 'function' ) {
                edInsertContent(edCanvas, h);
                edInsertContent(edCanvas, h);
+       } else {
+               jQuery( edCanvas ).val( jQuery( edCanvas ).val() + h );
+       }
 
        tb_remove();
 }
 
        tb_remove();
 }
@@ -40,7 +49,7 @@ jQuery(function($) {
                        $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
                });
        };
                        $(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();
        jQuery('a.thickbox').click(function(){
                if ( typeof tinyMCE != 'undefined' &&  tinyMCE.activeEditor ) {
                        tinyMCE.get('content').focus();
index 2a91e3397a0b6039fa19fab77d7e589ca71d80ce..943c1de96b44ed0c8d1ecef9889861b313abf09a 100644 (file)
-jQuery(document).ready( function() {
-       add_postbox_toggles('page');
+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');
 
        make_slugedit_clickable();
 
        // close postboxes that should be closed
        jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
 
-       // show things that should be visible, hide what should be hidden
-       jQuery('.hide-if-no-js').show();
-       jQuery('.hide-if-js').hide();
-
        jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
 
        jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
 
-       // hide advanced slug field
-       jQuery('#pageslugdiv').hide();
+       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> '
+                       );
+               }
 
 
-       jQuery('.edit-timestamp').click(function () {
-               if (jQuery('#timestampdiv').is(":hidden")) {
-                       jQuery('#timestampdiv').slideDown("normal");
-                       jQuery('.edit-timestamp').text(postL10n.cancel);
+               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 {
                } else {
-                       jQuery('#timestampdiv').hide();
-                       jQuery('#mm').val(jQuery('#hidden_mm').val());
-                       jQuery('#jj').val(jQuery('#hidden_jj').val());
-                       jQuery('#aa').val(jQuery('#hidden_aa').val());
-                       jQuery('#hh').val(jQuery('#hidden_hh').val());
-                       jQuery('#mn').val(jQuery('#hidden_mn').val());
-                       jQuery('.edit-timestamp').text(postL10n.edit);
+                       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;
                return false;
-    });
-});
\ No newline at end of file
+       });
+});
index e90c3e04a4758fa2362aad85d975b1c79cf20478..516a3e25110f269add2cca32fd907756eba1a023 100644 (file)
@@ -1,80 +1,23 @@
 // Password strength meter
 // Password strength meter
-// This jQuery plugin is written by firas kassem [2007.04.05]
-// Firas Kassem  phiras.wordpress.com || phiras at gmail {dot} com
-// for more information : http://phiras.wordpress.com/2007/04/08/password-strength-meter-a-jquery-plugin/
-
-var shortPass = pwsL10n.short
-var badPass = pwsL10n.bad
-var goodPass = pwsL10n.good
-var strongPass = pwsL10n.strong
-
 
 function passwordStrength(password,username) {
 
 function passwordStrength(password,username) {
-    score = 0
+    var shortPass = 1, badPass = 2, goodPass = 3, strongPass = 4;
 
 
-    //password < 4
-    if (password.length < 4 ) { return shortPass }
+       //password < 4
+    if (password.length < 4 ) { return shortPass };
 
     //password == username
 
     //password == username
-    if (password.toLowerCase()==username.toLowerCase()) return badPass
-
-    //password length
-    score += password.length * 4
-    score += ( checkRepetition(1,password).length - password.length ) * 1
-    score += ( checkRepetition(2,password).length - password.length ) * 1
-    score += ( checkRepetition(3,password).length - password.length ) * 1
-    score += ( checkRepetition(4,password).length - password.length ) * 1
-
-    //password has 3 numbers
-    if (password.match(/(.*[0-9].*[0-9].*[0-9])/))  score += 5
-
-    //password has 2 sybols
-    if (password.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) score += 5
-
-    //password has Upper and Lower chars
-    if (password.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))  score += 10
-
-    //password has number and chars
-    if (password.match(/([a-zA-Z])/) && password.match(/([0-9])/))  score += 15
-    //
-    //password has number and symbol
-    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([0-9])/))  score += 15
-
-    //password has char and symbol
-    if (password.match(/([!,@,#,$,%,^,&,*,?,_,~])/) && password.match(/([a-zA-Z])/))  score += 15
-
-    //password is just a nubers or chars
-    if (password.match(/^\w+$/) || password.match(/^\d+$/) )  score -= 10
-
-    //verifing 0 < score < 100
-    if ( score < 0 )  score = 0
-    if ( score > 100 )  score = 100
-
-    if (score < 34 )  return badPass
-    if (score < 68 )  return goodPass
-    return strongPass
-}
-
-
-// checkRepetition(1,'aaaaaaabcbc')   = 'abcbc'
-// checkRepetition(2,'aaaaaaabcbc')   = 'aabc'
-// checkRepetition(2,'aaaaaaabcdbcd') = 'aabcd'
-
-function checkRepetition(pLen,str) {
-    res = ""
-    for ( i=0; i<str.length ; i++ ) {
-        repeated=true
-        for (j=0;j < pLen && (j+i+pLen) < str.length;j++)
-            repeated=repeated && (str.charAt(j+i)==str.charAt(j+i+pLen))
-        if (j<pLen) repeated=false
-        if (repeated) {
-            i+=pLen-1
-            repeated=false
-        }
-        else {
-            res+=str.charAt(i)
-        }
-    }
-    return res
-}
-
+    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
diff --git a/wp-admin/js/plugin-install.js b/wp-admin/js/plugin-install.js
new file mode 100644 (file)
index 0000000..fb6be93
--- /dev/null
@@ -0,0 +1,51 @@
+/* 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
index 8f786d21663cd78c663af47fe8673f3797bb3c2e..eb9ae4372b25d882f6b28e0dfd717e0e57094a96 100644 (file)
@@ -37,14 +37,27 @@ function tag_update_quickclicks() {
                jQuery( '#tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />' );
 }
 
                jQuery( '#tagchecklist' ).prepend( '<strong>'+postL10n.tagsUsed+'</strong><br />' );
 }
 
-function tag_flush_to_text() {
-       var newtags = jQuery('#tags-input').val() + ',' + jQuery('#newtag').val();
+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();
        // 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();
-       jQuery('#newtag').val('');
-       jQuery('#newtag').focus();
+       if ( ! a ) {
+               jQuery('#newtag').val('');
+               jQuery('#newtag').focus();
+       }
        return false;
 }
 
        return false;
 }
 
@@ -58,25 +71,42 @@ function tag_press_key( e ) {
                tag_flush_to_text();
                return false;
        }
                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();
 
 
-jQuery(document).ready( function() {
        // close postboxes that should be closed
        jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
 
        // close postboxes that should be closed
        jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
 
-       // show things that should be visible, hide what should be hidden
-       jQuery('.hide-if-no-js').show();
-       jQuery('.hide-if-js').hide();
-
        // postboxes
        // postboxes
-       add_postbox_toggles('post');
+       postboxes.add_postbox_toggles('post');
 
        // Editable slugs
        make_slugedit_clickable();
 
 
        // Editable slugs
        make_slugedit_clickable();
 
-       // hide advanced slug field
-       jQuery('#slugdiv').hide();
-
        jQuery('#tags-input').hide();
        tag_update_quickclicks();
        // add the quickadd form
        jQuery('#tags-input').hide();
        tag_update_quickclicks();
        // add the quickadd form
@@ -157,27 +187,191 @@ jQuery(document).ready( function() {
                jQuery('#newcat').focus();
                return false;
        } );
                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();
        jQuery('.categorychecklist .popular-category :checkbox').change( syncChecks ).filter( ':checked' ).change();
+       var stamp = $('#timestamp').html();
+       var visibility = $('#post-visibility-display').html();
+       var sticky = '';
 
 
-       jQuery('.edit-timestamp').click(function () {
-               if (jQuery('#timestampdiv').is(":hidden")) {
-                       jQuery('#timestampdiv').slideDown("normal");
-                       jQuery('.edit-timestamp').text(postL10n.cancel);
+       function updateVisibility() {
+               if ( $('#post-visibility-select input:radio:checked').val() != 'public' ) {
+                       $('#sticky').attr('checked', false);
+                       $('#sticky-span').hide();
                } else {
                } else {
-                       jQuery('#timestampdiv').hide();
-                       jQuery('#mm').val(jQuery('#hidden_mm').val());
-                       jQuery('#jj').val(jQuery('#hidden_jj').val());
-                       jQuery('#aa').val(jQuery('#hidden_aa').val());
-                       jQuery('#hh').val(jQuery('#hidden_hh').val());
-                       jQuery('#mn').val(jQuery('#hidden_mn').val());
-                       jQuery('.edit-timestamp').text(postL10n.edit);
+                       $('#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;
                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 ) {
        });
 
        // 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);
                }
                if ( jQuery.isFunction( autosave_update_post_ID ) ) {
                        autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
                }
@@ -186,4 +380,76 @@ jQuery(document).ready( function() {
                return s;
        }
        });
                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);
+
index a512f4bcefccffe2848f2808776b1fe0c42f854b..07f4df941c10625c74641fcb506b38be98ca6357 100644 (file)
-function add_postbox_toggles(page) {
-       jQuery('.postbox h3').prepend('<a class="togbox">+</a> ');
-       jQuery('.postbox h3').click( function() { jQuery(jQuery(this).parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } );
-}
-
-function save_postboxes_state(page) {
-       var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(',');
-       jQuery.post(postboxL10n.requestFile, {
-               action: 'closed-postboxes',
-               closed: closed,
-               closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(),
-               page: page
-       });
-}
+(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));
index 3ecc1247d771db71df5616d1cb88171feb1791ce..ecba762154f3cfc2e52b7231163f1f637a2027a7 100644 (file)
@@ -1,14 +1,16 @@
 <?php
 <?php
+
 if ( !defined( 'ABSPATH' ) )
        exit;
 
 if ( !defined( 'ABSPATH' ) )
        exit;
 
+/** @ignore */
 function dvortr( $str ) {
        return strtr(
                $str,
                '\',.pyfgcrl/=\\aoeuidhtns-;qjkxbmwvz"<>PYFGCRL?+|AOEUIDHTNS_:QJKXBMWVZ[]',
                'qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?-='
        );
 function dvortr( $str ) {
        return strtr(
                $str,
                '\',.pyfgcrl/=\\aoeuidhtns-;qjkxbmwvz"<>PYFGCRL?+|AOEUIDHTNS_:QJKXBMWVZ[]',
                'qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?-='
        );
-}      
+}
 
 $j = clean_url( site_url( '/wp-includes/js/jquery/jquery.js' ) );
 $n = wp_specialchars( $GLOBALS['current_user']->data->display_name );
 
 $j = clean_url( site_url( '/wp-includes/js/jquery/jquery.js' ) );
 $n = wp_specialchars( $GLOBALS['current_user']->data->display_name );
index f26a5f202ef015494e693259ff4f956e0c1a6314..cfd5ce4077f05fd4e3887305f2554f2b912bf001 100644 (file)
@@ -8,7 +8,7 @@ function edit_permalink(post_id) {
        var revert_b = b.html();
        var full = jQuery('#editable-post-name-full').html();
 
        var revert_b = b.html();
        var full = jQuery('#editable-post-name-full').html();
 
-       b.html('<a href="" class="save">'+slugL10n.save+'</a> <a class="cancel" href="">'+slugL10n.cancel+'</a>');
+       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, {
        b.children('.save').click(function() {
                var new_slug = e.children('input').val();
                jQuery.post(slugL10n.requestFile, {
index 37182dfca4eca274c4d8c974777947e597a47826..c5b2d6f28ac7bf5537f63fc2c93fd80004cdebe2 100644 (file)
@@ -5,6 +5,13 @@ jQuery(function($) {
                var name = $("<span>" + $('name', r).text() + "</span>").html();
                var id = $('tag', r).attr('id');
                options[options.length] = new Option(name, id);
                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 delAfter = function( r, settings ) {
@@ -17,5 +24,7 @@ jQuery(function($) {
        if ( options )
                $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
        else
        if ( options )
                $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } );
        else
-               $('#the-list').wpList();
-});
+               $('#the-list').wpList({ addAfter: addAfter2 });
+
+       columns.init('edit-tags');
+});
\ No newline at end of file
diff --git a/wp-admin/js/upload.js b/wp-admin/js/upload.js
deleted file mode 100644 (file)
index f60f113..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
-jQuery(document).ready( function() {
-       theFileList = {
-               currentImage: {ID: 0},
-               nonce: '',
-               tab: '',
-               postID: 0,
-
-               // cookie create and read functions adapted from http://www.quirksmode.org/js/cookies.html
-               createCookie: function(name,value,days) {
-                       if (days) {
-                               var date = new Date();
-                               date.setTime(date.getTime()+(days*24*60*60*1000));
-                               var expires = "; expires="+date.toGMTString();
-                       }
-                       else var expires = "";
-                       document.cookie = name+"="+value+expires+"; path=/";
-               },
-
-               readCookie: function(name) {
-                       var nameEQ = name + "=";
-                       var ca = document.cookie.split(';');
-                       for(var i=0;i < ca.length;i++) {
-                               var c = ca[i];
-                               while (c.charAt(0)==' ') c = c.substring(1,c.length);
-                               if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
-                       }
-                       return null;
-               },
-
-               assignCookieOnChange: function() {
-                       jQuery(this).bind("change", function(){
-                               theFileList.createCookie(jQuery(this).attr('name'),jQuery(this).attr('id'),365);
-                       });
-               },
-
-               checkCookieSetting: function(name, defaultSetting) {
-                       return this.readCookie(name) ? this.readCookie(name) : defaultSetting;
-               },
-
-               toQueryParams: 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 ) {
-                               var p = pp[i].split('=');
-                               r[p[0]] = p[1];
-                       }
-                       return r;
-               },
-
-               toQueryString: function(params) {
-                       var qryStr = '';
-                       for ( var key in params )
-                               qryStr += key + '=' + params[key] + '&';
-                       return qryStr;
-               },
-
-               initializeVars: function() {
-                       this.urlData  = document.location.href.split('?');
-                       this.params = this.toQueryParams(this.urlData[1]);
-                       this.postID = this.params['post_id'];
-                       this.tab = this.params['tab'];
-                       this.style = this.params['style'];
-                       this.ID = this.params['ID'];
-                       if ( !this.style )
-                               this.style = 'default';
-                       var nonceEl = jQuery('#nonce-value');
-                       if ( nonceEl )
-                               this.nonce = jQuery(nonceEl).val();
-                       if ( this.ID ) {
-                               this.grabImageData( this.ID );
-                               this.imageView( this.ID );
-                       }
-               },
-
-               initializeLinks: function() {
-                       if ( this.ID )
-                               return;
-                       jQuery('a.file-link').each(function() {
-                               var id = jQuery(this).attr('id').split('-').pop();
-                               jQuery(this).attr('href','javascript:void(0)').click(function(e) {
-                                       theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e);
-                               });
-                       });
-               },
-
-               grabImageData: function(id) {
-                       if ( id == this.currentImage.ID )
-                               return;
-                       var thumbEl = jQuery('#attachment-thumb-url-' + id);
-                       if ( thumbEl ) {
-                               this.currentImage.thumb = ( 0 == id ? '' : jQuery(thumbEl).val() );
-                               this.currentImage.thumbBase = ( 0 == id ? '' : jQuery('#attachment-thumb-url-base-' + id).val() );
-                       } else {
-                               this.currentImage.thumb = false;
-                       }
-                       this.currentImage.src = ( 0 == id ? '' : jQuery('#attachment-url-' + id).val() );
-                       this.currentImage.srcBase = ( 0 == id ? '' : jQuery('#attachment-url-base-' + id).val() );
-                       this.currentImage.page = ( 0 == id ? '' : jQuery('#attachment-page-url-' + id).val() );
-                       this.currentImage.title = ( 0 == id ? '' : jQuery('#attachment-title-' + id).val() );
-                       this.currentImage.description = ( 0 == id ? '' : jQuery('#attachment-description-' + id).val() );
-                       var widthEl = jQuery('#attachment-width-' + id);
-                       if ( widthEl ) {
-                               this.currentImage.width = ( 0 == id ? '' : jQuery(widthEl).val() );
-                               this.currentImage.height = ( 0 == id ? '' : jQuery('#attachment-height-' + id).val() );
-                       } else {
-                               this.currentImage.width = false;
-                               this.currentImage.height = false;
-                       }
-                       this.currentImage.isImage = ( 0 == id ? 0 : jQuery('#attachment-is-image-' + id).val() );
-                       this.currentImage.ID = id;
-               },
-
-               imageView: function(id, e) {
-                       this.prepView(id);
-                       var h = '';
-
-                       h += "<div id='upload-file'>"
-                       if ( this.ID ) {
-                               var params = this.params;
-                               params.ID = '';
-                               params.action = '';
-                               h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
-                       } else {
-                               h += "<a href='#' onclick='return theFileList.cancelView();'";
-                       }
-                       h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
-                       h += "<div id='file-title'>"
-                       if ( 0 == this.currentImage.isImage )
-                               h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
-                       else
-                               h += "<h2>" + this.currentImage.title + "</h2>";
-                       h += " &#8212; <span>";
-                       h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>"
-                       h += "</span>";
-                       h += '</div>'
-                       h += "<div id='upload-file-view' class='alignleft'>";
-                       if ( 1 == this.currentImage.isImage ) {
-                               h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
-                               h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
-                               h += "</a>";
-                       } else
-                               h += '&nbsp;';
-                       h += "</div>";
-
-                       h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>";
-                       h += "<table>";
-                       var display = [];
-                       var checkedDisplay = 'display-title';
-                       if ( 1 == this.currentImage.isImage ) {
-                               checkedDisplay = 'display-full';
-                               if ( this.currentImage.thumb ) {
-                                       display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />");
-                                       checkedDisplay = 'display-thumb';
-                               }
-                               display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>");
-                       } else if ( this.currentImage.thumb ) {
-                               display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>");
-                       }
-                       if ( display.length ) {
-                               display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>");
-                               h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>";
-                               jQuery(display).each( function() { h += this; } );
-                               h += "</td></tr>";
-                       }
-
-                       var checkedLink = 'link-file';
-                       h += "<tr><th>" + this.link + "</th><td>";
-                       h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' /> " + this.file + "</label><br />";                   h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />";
-                       h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>";
-                       h += "</td></tr>";
-
-                       h += "<tr><td colspan='2'><p class='submit'>";
-                       h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />";
-                       h += "</p></td></tr></table>";
-                       h += "</form>";
-
-                       h += "</div>";
-
-                       jQuery(h).prependTo('#upload-content');
-                       jQuery("input[@name='display']").each(theFileList.assignCookieOnChange);
-                       jQuery("input[@name='link']").each(theFileList.assignCookieOnChange);
-                       checkedDisplay = this.checkCookieSetting('display', checkedDisplay);
-                       checkedLink = this.checkCookieSetting('link', checkedLink);
-                       jQuery('#' + checkedDisplay).attr('checked','checked');
-                       jQuery('#' + checkedLink).attr('checked','checked');
-                       if (e) return e.stopPropagation();
-                       return false;
-               },
-
-               editView: function(id, e) {
-                       this.prepView(id);
-                       var h = '';
-
-                       var action = 'upload.php?style=' + this.style + '&amp;tab=upload';
-                       if ( this.postID )
-                               action += '&amp;post_id=' + this.postID;
-
-                       h += "<form id='upload-file' method='post' action='" + action + "'>";
-                       if ( this.ID ) {
-                               var params = this.params;
-                               params.ID = '';
-                               params.action = '';
-                               h += "<a href='" + this.urlData[0] + '?' + this.toQueryString(params) + "'";
-                       } else {
-                               h += "<a href='#' onclick='return theFileList.cancelView();'";
-                       }
-                       h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
-                       h += "<div id='file-title'>"
-                       if ( 0 == this.currentImage.isImage )
-                               h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
-                       else
-                               h += "<h2>" + this.currentImage.title + "</h2>";
-                       h += " &#8212; <span>";
-                       h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>";
-                       h += "</span>";
-                       h += '</div>'
-                       h += "<div id='upload-file-view' class='alignleft'>";
-                       if ( 1 == this.currentImage.isImage ) {
-                               h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
-                               h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
-                               h += "</a>";
-                       } else
-                               h += '&nbsp;';
-                       h += "</div>";
-
-
-                       h += "<table><col /><col class='widefat' /><tr>";
-                       h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>";
-                       h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
-                       h += "</tr><tr>";
-                       h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>";
-                       h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
-                       h += "</tr><tr>";
-                       h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>";
-                       h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
-                       h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />";
-                       h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
-                       h += "<input type='hidden' name='post_parent' value='" + parseInt(this.postID,10) + "' />";
-                       h += "<input type='hidden' name='action' id='action-value' value='save' />";
-                       h += "<input type='hidden' name='ID' value='" + id + "' />";
-                       h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
-                       h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>";
-                       h += "</td></tr></table></form>";
-
-                       jQuery(h).prependTo('#upload-content');
-                       if (e) e.stopPropagation();
-                       return false;
-               },
-
-               prepView: function(id) {
-                       this.cancelView( true );
-                       var filesEl = jQuery('#upload-files');
-                       if ( filesEl )
-                               filesEl.hide();
-                       var navEl = jQuery('#current-tab-nav');
-                       if ( navEl )
-                               navEl.hide();
-                       this.grabImageData(id);
-               },
-
-               cancelView: function( prep ) {
-                       if ( !prep ) {
-                               var filesEl = jQuery('#upload-files');
-                               if ( filesEl )
-                                       jQuery(filesEl).show();
-                               var navEl = jQuery('#current-tab-nav');
-                               if ( navEl )
-                                       jQuery(navEl).show();
-                       }
-                       if ( !this.ID )
-                               this.grabImageData(0);
-                       var div = jQuery('#upload-file');
-                       if ( div )
-                               jQuery(div).remove();
-                       return false;
-               },
-
-               sendToEditor: function(id) {
-                       this.grabImageData(id);
-                       var link = '';
-                       var display = '';
-                       var h = '';
-
-                       link = jQuery('input[@type=radio][@name="link"][@checked]','#uploadoptions').val();
-                       displayEl = jQuery('input[@type=radio][@name="display"][@checked]','#uploadoptions');
-                       if ( displayEl )
-                               display = jQuery(displayEl).val();
-                       else if ( 1 == this.currentImage.isImage )
-                               display = 'full';
-
-                       if ( 'none' != link )
-                               h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>";
-                       if ( display && 'title' != display )
-                               h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />";
-                       else
-                               h += this.currentImage.title;
-                       if ( 'none' != link )
-                               h += "</a>";
-
-                       var win = window.opener ? window.opener : window.dialogArguments;
-                       if ( !win )
-                               win = top;
-                       tinyMCE = win.tinyMCE;
-                       if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) {
-                               tinyMCE.selectedInstance.getWin().focus();
-                               tinyMCE.execCommand('mceInsertContent', false, h);
-                       } else
-                               win.edInsertContent(win.edCanvas, h);
-                       if ( !this.ID )
-                               this.cancelView();
-                       return false;
-               },
-
-               deleteFile: function(id) {
-                       if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) {
-                               jQuery('#action-value').attr('value','delete');
-                               jQuery('#upload-file').submit();
-                               return true;
-                       }
-                       return false;
-               }
-
-       };
-
-       for ( var property in uploadL10n )
-               theFileList[property] = uploadL10n[property];
-       theFileList.initializeVars();
-       theFileList.initializeLinks();
-} );
index 522cbadf6d9275b9f6b32fac752217522e466259..db7d5c6b30bbbfcdc7c915f3f8886024c3ce112f 100644 (file)
@@ -1 +1,5 @@
-jQuery( function($) { $('#users').wpList(); } );
+jQuery( function($) {
+       $('#users').wpList();
+
+       columns.init('users');
+});
index b42812f3f627a15a8c9c53430d34957bdac2d1bd..1d2cca32ef007274aad2c0957f1b08cff844f2a6 100644 (file)
@@ -1,6 +1,18 @@
 jQuery(function($) {
        $('.noscript-action').remove();
 
 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 increment = 1;
 
        // Open or close widget control form
@@ -84,6 +96,7 @@ jQuery(function($) {
                var n = parseInt( $('#widget-count').text(), 10 ) + 1;
                $('#widget-count').text( n.toString() )
 
                var n = parseInt( $('#widget-count').text(), 10 ) + 1;
                $('#widget-count').text( n.toString() )
 
+               lameWidgetReminder();
                return false;
        };
 
                return false;
        };
 
@@ -96,6 +109,7 @@ jQuery(function($) {
 
                // onclick for save links
                $('a.widget-control-save', context).click( function() {
 
                // onclick for save links
                $('a.widget-control-save', context).click( function() {
+                       lameWidgetReminder();
                        toggleWidget( $(this).parents('li:first'), false ).blur()
                        return false;
                } );
                        toggleWidget( $(this).parents('li:first'), false ).blur()
                        return false;
                } );
index 9e3c1dff745a04026570ec771587d1afcdfe4c0d..474056e990ae4d90e71f3e21b661f70ea2ef6326 100644 (file)
@@ -8,7 +8,7 @@
                        JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
                        t.block = 0;
                        t.wc(co.val());
                        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) { 
+                       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;
                                if ( e.keyCode == last ) return true;
                                if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
                                last = e.keyCode;
@@ -33,7 +33,7 @@
                                setTimeout( function() { t.block = 0; }, 2000 );
                        }, 1 );
                }
                                setTimeout( function() { t.block = 0; }, 2000 );
                        }, 1 );
                }
-       } 
+       }
 }(jQuery));
 
 jQuery(document).ready( function(){ wpWordCount.init(); } );
 }(jQuery));
 
 jQuery(document).ready( function(){ wpWordCount.init(); } );
index 20c8aa232ab7d75888b908d9ad9fad22d0949b63..0509373ef12b2abe269c14a9a64b5ce4ebf4bca2 100644 (file)
@@ -4,23 +4,26 @@ wpGears = {
        createStore : function() {
                if ( 'undefined' == typeof google || ! google.gears ) return;
 
        createStore : function() {
                if ( 'undefined' == typeof google || ! google.gears ) return;
 
-               if ( 'undefined' == typeof localServer ) 
+               if ( 'undefined' == typeof localServer )
                        localServer = google.gears.factory.create("beta.localserver");
 
                store = localServer.createManagedStore(this.storeName());
                store.manifestUrl = "gears-manifest.php";
                store.checkForUpdate();
                        localServer = google.gears.factory.create("beta.localserver");
 
                store = localServer.createManagedStore(this.storeName());
                store.manifestUrl = "gears-manifest.php";
                store.checkForUpdate();
-               this.message();
+               this.message(3);
        },
 
        getPermission : function() {
        },
 
        getPermission : function() {
+               var perm = true;
+
                if ( 'undefined' != typeof google && google.gears ) {
                        if ( ! google.gears.factory.hasPermission )
                if ( 'undefined' != typeof google && google.gears ) {
                        if ( ! google.gears.factory.hasPermission )
-                               google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
+                               perm = google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
 
 
-                       try {
-                               this.createStore();
-                       } catch(e) {} // silence if canceled
+                       if ( perm )
+                               try { this.createStore(); } catch(e) { this.message(); } // silence if canceled
+                       else
+                               this.message(4);
                }
        },
 
                }
        },
 
@@ -34,13 +37,16 @@ wpGears = {
        },
 
        message : function(show) {
        },
 
        message : function(show) {
-               var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
+               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 ( ! msg1 ) return;
 
                if ( 'undefined' != typeof google && google.gears ) {
-                       if ( google.gears.factory.hasPermission ) {
-                               msg1.style.display = msg2.style.display = 'none';
+                       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 )
                                msg3.style.display = 'block';
 
                                if ( 'undefined' == typeof store )
@@ -50,12 +56,10 @@ wpGears = {
                                store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
                                store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
                        } else {
                                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 = 'none';
+                               msg1.style.display = msg3.style.display = msg4.style.display = 'none';
                                msg2.style.display = 'block';
                        }
                }
                                msg2.style.display = 'block';
                        }
                }
-
-               if ( show ) t.I('gears-info-box').style.display = 'block';
        },
 
        I : function(id) {
        },
 
        I : function(id) {
index 4b6493b548f55821c75145fb86ba52c10df6fa70..e7d861bff99b6c8fcbc751fa0ff6257b4a9b942f 100644 (file)
@@ -1,10 +1,16 @@
 <?php
 <?php
+/**
+ * Add Link Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-$title = __('Add Link');
-$this_file = 'link-manager.php';
-$parent_file = 'post-new.php';
-
+$title = __('Add New Link');
+$parent_file = 'link-manager.php';
 
 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
        'description', 'visible', 'target', 'category', 'link_id',
 
 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
        'description', 'visible', 'target', 'category', 'link_id',
@@ -14,14 +20,6 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
 wp_enqueue_script('link');
 wp_enqueue_script('xfn');
 
 wp_enqueue_script('link');
 wp_enqueue_script('xfn');
 
-require('admin-header.php');
-?>
-
-<?php if ($_GET['added'] && '' != $_POST['link_name']) : ?>
-<div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
-<?php endif; ?>
-
-<?php
 $link = get_default_link_to_edit();
 include('edit-link-form.php');
 
 $link = get_default_link_to_edit();
 include('edit-link-form.php');
 
index ea6479138a86003309ad7199e920c36254eb76be..bcfbf2e8785dc1ccf0e2d1c05e6b2a835b647c52 100644 (file)
@@ -1,4 +1,15 @@
 <?php
 <?php
+/**
+ * Manage link category administration actions.
+ *
+ * This page is accessed by the link management pages and handles the forms and
+ * AJAX processes for category actions.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once('admin.php');
 
 wp_reset_vars(array('action', 'cat'));
 require_once('admin.php');
 
 wp_reset_vars(array('action', 'cat'));
@@ -31,7 +42,7 @@ case 'delete':
        $default_cat_id = get_option('default_link_category');
 
        // Don't delete the default cats.
        $default_cat_id = get_option('default_link_category');
 
        // Don't delete the default cats.
-    if ( $cat_ID == $default_cat_id )
+       if ( $cat_ID == $default_cat_id )
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
        wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
                wp_die(sprintf(__("Can&#8217;t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
 
        wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
@@ -50,8 +61,8 @@ case 'delete':
 break;
 
 case 'edit':
 break;
 
 case 'edit':
-       $title = __('Categories');
-       $parent_file = 'edit.php';
+       $title = __('Edit Category');
+       $parent_file = 'link-manager.php';
        $submenu_file = 'edit-link-categories.php';
        require_once ('admin-header.php');
        $cat_ID = (int) $_GET['cat_ID'];
        $submenu_file = 'edit-link-categories.php';
        require_once ('admin-header.php');
        $cat_ID = (int) $_GET['cat_ID'];
index 48f59f25229d91cc59659931526984ee45370ae2..7638ece93bdb41ba82901a08fdca670e188b924d 100644 (file)
@@ -1,41 +1,47 @@
 <?php
 <?php
-
+/**
+ * Link Management Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once ('admin.php');
 
 // Handle bulk deletes
 require_once ('admin.php');
 
 // Handle bulk deletes
-if ( isset($_GET['deleteit']) && isset($_GET['linkcheck']) ) {
+if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) {
        check_admin_referer('bulk-bookmarks');
        check_admin_referer('bulk-bookmarks');
+       $doaction = $_GET['action'] ? $_GET['action'] : $_GET['action2'];
 
        if ( ! current_user_can('manage_links') )
                wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
 
 
        if ( ! current_user_can('manage_links') )
                wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
 
-       foreach ( (array) $_GET['linkcheck'] as $link_id) {
-               $link_id = (int) $link_id;
+       if ( 'delete' == $doaction ) {
+               foreach ( (array) $_GET['linkcheck'] as $link_id ) {
+                       $link_id = (int) $link_id;
 
 
-               wp_delete_link($link_id);
-       }
+                       wp_delete_link($link_id);
+               }
 
 
-       $sendback = wp_get_referer();
-       $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
-       wp_redirect($sendback);
-       exit;
-} elseif ( !empty($_GET['_wp_http_referer']) ) {
-        wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
+               wp_redirect( wp_get_referer() );
+               exit;
+       }
+} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
         exit;
 }
 
         exit;
 }
 
-wp_enqueue_script('admin-forms');
-
 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
 
 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
 
-if (empty ($cat_id))
+if ( empty($cat_id) )
        $cat_id = 'all';
 
        $cat_id = 'all';
 
-if (empty ($order_by))
+if ( empty($order_by) )
        $order_by = 'order_name';
 
        $order_by = 'order_name';
 
-$title = __('Manage Links');
-$this_file = $parent_file = 'edit.php';
+$title = __('Edit Links');
+$this_file = $parent_file = 'link-manager.php';
 include_once ("./admin-header.php");
 
 if (!current_user_can('manage_links'))
 include_once ("./admin-header.php");
 
 if (!current_user_can('manage_links'))
@@ -61,10 +67,18 @@ switch ($order_by) {
        default :
                $sqlorderby = 'name';
                break;
        default :
                $sqlorderby = 'name';
                break;
-}
+} ?>
+
+<div class="wrap nosubsub">
+<?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( stripslashes($_GET['s']) ) ); ?>
+</h2>
 
 
+<?php
 if ( isset($_GET['deleted']) ) {
 if ( isset($_GET['deleted']) ) {
-       echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>';
+       echo '<div id="message" class="updated fade"><p>';
        $deleted = (int) $_GET['deleted'];
        printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
        echo '</p></div>';
        $deleted = (int) $_GET['deleted'];
        printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted);
        echo '</p></div>';
@@ -72,23 +86,25 @@ if ( isset($_GET['deleted']) ) {
 }
 ?>
 
 }
 ?>
 
-<div class="wrap">
-
-<form id="posts-filter" action="" method="get">
-<h2><?php printf( __( 'Manage Links (<a href="%s">add new</a>)' ), 'link-add.php' ); ?></h2>
-
-<p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Links' ); ?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
+<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" />
 </p>
        <input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" />
 </p>
-
+</form>
 <br class="clear" />
 
 <br class="clear" />
 
+<form id="posts-filter" action="" method="get">
 <div class="tablenav">
 
 <div class="tablenav">
 
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+<div class="alignleft actions">
+<select name="action">
+<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" />
+
 <?php
 $categories = get_terms('link_category', "hide_empty=1");
 $select_cat = "<select name=\"cat_id\">\n";
 <?php
 $categories = get_terms('link_category', "hide_empty=1");
 $select_cat = "<select name=\"cat_id\">\n";
@@ -115,18 +131,7 @@ echo $select_order;
 <br class="clear" />
 </div>
 
 <br class="clear" />
 </div>
 
-<br class="clear" />
-
-<?php
-$link_columns = array(
-       'name'       => '<th style="width: 15%;">' . __('Name') . '</th>',
-       'url'       => '<th>' . __('URL') . '</th>',
-       'categories' => '<th>' . __('Categories') . '</th>',
-       'rel'      => '<th style="text-align: center">' . __('rel') . '</th>',
-       'visible'   => '<th style="text-align: center">' . __('Visible') . '</th>',
-);
-$link_columns = apply_filters('manage_link_columns', $link_columns);
-?>
+<div class="clear"></div>
 
 <?php
 if ( 'all' == $cat_id )
 
 <?php
 if ( 'all' == $cat_id )
@@ -136,48 +141,79 @@ if ( !empty($_GET['s']) )
        $args['search'] = $_GET['s'];
 $links = get_bookmarks( $args );
 if ( $links ) {
        $args['search'] = $_GET['s'];
 $links = get_bookmarks( $args );
 if ( $links ) {
+       $link_columns = get_column_headers('link-manager');
+       $hidden = get_hidden_columns('link-manager');
 ?>
 
 <?php wp_nonce_field('bulk-bookmarks') ?>
 ?>
 
 <?php wp_nonce_field('bulk-bookmarks') ?>
-<table class="widefat">
+<table class="widefat fixed" cellspacing="0">
        <thead>
        <tr>
        <thead>
        <tr>
-       <th scope="col" class="check-column"><input type="checkbox" /></th>
-<?php foreach($link_columns as $column_display_name) {
-       echo $column_display_name;
-} ?>
+<?php print_column_headers('link-manager'); ?>
        </tr>
        </thead>
        </tr>
        </thead>
+
+       <tfoot>
+       <tr>
+<?php print_column_headers('link-manager', false); ?>
+       </tr>
+       </tfoot>
+
        <tbody>
 <?php
        <tbody>
 <?php
+       $alt = 0;
+
        foreach ($links as $link) {
                $link = sanitize_bookmark($link);
                $link->link_name = attribute_escape($link->link_name);
                $link->link_category = wp_get_link_cats($link->link_id);
                $short_url = str_replace('http://', '', $link->link_url);
        foreach ($links as $link) {
                $link = sanitize_bookmark($link);
                $link->link_name = attribute_escape($link->link_name);
                $link->link_category = wp_get_link_cats($link->link_id);
                $short_url = str_replace('http://', '', $link->link_url);
-               $short_url = str_replace('www.', '', $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).'...';
                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');
                $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
-               ++ $i;
-               $style = ($i % 2) ? '' : ' class="alternate"';
+               $style = ($alt % 2) ? '' : ' class="alternate"';
+               ++ $alt;
+               $edit_link = get_edit_bookmark_link();
                ?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
                ?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
-               echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></th>';
                foreach($link_columns as $column_name=>$column_display_name) {
                foreach($link_columns as $column_name=>$column_display_name) {
+                       $class = "class=\"column-$column_name\"";
+
+                       $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) {
                        switch($column_name) {
+                               case 'cb':
+                                       echo '<th scope="row" class="check-column"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></th>';
+                                       break;
                                case 'name':
 
                                case 'name':
 
-                                       echo "<td><strong><a class='row-title' href='link.php?link_id=$link->link_id&amp;action=edit' title='" . attribute_escape(sprintf(__('Edit "%s"'), $link->link_name)) . "' class='edit'>$link->link_name</a></strong><br />";
-                                       echo $link->link_description . "</td>";
+                                       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 />";
+                                       $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>";
+                                       $action_count = count($actions);
+                                       $i = 0;
+                                       echo '<div class="row-actions">';
+                                       foreach ( $actions as $action => $linkaction ) {
+                                               ++$i;
+                                               ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                                               echo "<span class='$action'>$linkaction$sep</span>";
+                                       }
+                                       echo '</div>';
+                                       echo '</td>';
                                        break;
                                case 'url':
                                        break;
                                case 'url':
-                                       echo "<td><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
+                                       echo "<td $attributes><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
                                        break;
                                case 'categories':
                                        break;
                                case 'categories':
-                                       ?><td><?php
+                                       ?><td <?php echo $attributes ?>><?php
                                        $cat_names = array();
                                        foreach ($link->link_category as $category) {
                                                $cat = get_term($category, 'link_category', OBJECT, 'display');
                                        $cat_names = array();
                                        foreach ($link->link_category as $category) {
                                                $cat = get_term($category, 'link_category', OBJECT, 'display');
@@ -189,13 +225,13 @@ if ( $links ) {
                                                $cat_names[] = $cat_name;
                                        }
                                        echo implode(', ', $cat_names);
                                                $cat_names[] = $cat_name;
                                        }
                                        echo implode(', ', $cat_names);
-                                       ?> </td><?php
+                                       ?></td><?php
                                        break;
                                case 'rel':
                                        break;
                                case 'rel':
-                                       ?><td><?php echo $link->link_rel; ?></td><?php
+                                       ?><td <?php echo $attributes ?>><?php echo $link->link_rel; ?></td><?php
                                        break;
                                case 'visible':
                                        break;
                                case 'visible':
-                                       ?><td style='text-align: center;'><?php echo $visible; ?></td><?php
+                                       ?><td <?php echo $attributes ?>><?php echo $visible; ?></td><?php
                                        break;
                                default:
                                        ?>
                                        break;
                                default:
                                        ?>
@@ -214,15 +250,40 @@ if ( $links ) {
 <?php } else { ?>
 <p><?php _e('No links found.') ?></p>
 <?php } ?>
 <?php } else { ?>
 <p><?php _e('No links found.') ?></p>
 <?php } ?>
-</form>
-
-<div id="ajax-response"></div>
 
 <div class="tablenav">
 
 <div class="tablenav">
+
+<div class="alignleft actions">
+<select name="action2">
+<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" />
+</div>
+
 <br class="clear" />
 </div>
 
 <br class="clear" />
 </div>
 
+</form>
+
+<div id="ajax-response"></div>
 
 </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'); ?>
index 1cd27d0aa3fd25bef7a6456b00160f72c6018478..7d03a15382adf64d5899d20608aaabea62364456 100644 (file)
@@ -1,6 +1,16 @@
 <?php
 <?php
+/**
+ * Parse OPML XML files and store in globals.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once('../wp-load.php');
 
 require_once('../wp-load.php');
 
+global $opml, $map;
+
 // columns we wish to find are:  link_url, link_name, link_target, link_description
 // we need to map XML attribute names to our columns
 $opml_map = array('URL'         => 'link_url',
 // columns we wish to find are:  link_url, link_name, link_target, link_description
 // we need to map XML attribute names to our columns
 $opml_map = array('URL'         => 'link_url',
@@ -15,9 +25,24 @@ $opml_map = array('URL'         => 'link_url',
 $map = $opml_map;
 
 /**
 $map = $opml_map;
 
 /**
- ** startElement()
- ** Callback function. Called at the start of a new xml tag.
- **/
+ * XML callback function for the start of a new XML tag.
+ *
+ * @since unknown
+ * @access private
+ *
+ * @uses $updated_timestamp Not used inside function.
+ * @uses $all_links Not used inside function.
+ * @uses $map Stores names of attributes to use.
+ * @global array $names
+ * @global array $urls
+ * @global array $targets
+ * @global array $descriptions
+ * @global array $feeds
+ *
+ * @param mixed $parser XML Parser resource.
+ * @param string $tagName XML element name.
+ * @param array $attrs XML element attributes.
+ */
 function startElement($parser, $tagName, $attrs) {
        global $updated_timestamp, $all_links, $map;
        global $names, $urls, $targets, $descriptions, $feeds;
 function startElement($parser, $tagName, $attrs) {
        global $updated_timestamp, $all_links, $map;
        global $names, $urls, $targets, $descriptions, $feeds;
@@ -41,9 +66,16 @@ function startElement($parser, $tagName, $attrs) {
 }
 
 /**
 }
 
 /**
- ** endElement()
- ** Callback function. Called at the end of an xml tag.
- **/
+ * XML callback function that is called at the end of a XML tag.
+ *
+ * @since unknown
+ * @access private
+ * @package WordPress
+ * @subpackage Dummy
+ *
+ * @param mixed $parser XML Parser resource.
+ * @param string $tagName XML tag name.
+ */
 function endElement($parser, $tagName) {
        // nothing to do.
 }
 function endElement($parser, $tagName) {
        // nothing to do.
 }
index c387a87646290973c2dcfdee0faa7da892fd1a61..73ba281492a50b24e59ce1fcac9ce73b2527e6a9 100644 (file)
@@ -1,4 +1,15 @@
 <?php
 <?php
+/**
+ * Manage link administration actions.
+ *
+ * This page is accessed by the link management pages and handles the forms and
+ * AJAX processes for link actions.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once ('admin.php');
 
 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
 require_once ('admin.php');
 
 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]'));
@@ -6,12 +17,12 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description
 if ( ! current_user_can('manage_links') )
        wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
 
 if ( ! current_user_can('manage_links') )
        wp_die( __('You do not have sufficient permissions to edit the links for this blog.') );
 
-if ('' != $_POST['deletebookmarks'])
+if ( !empty($_POST['deletebookmarks']) )
        $action = 'deletebookmarks';
        $action = 'deletebookmarks';
-if ('' != $_POST['move'])
+if ( !empty($_POST['move']) )
        $action = 'move';
        $action = 'move';
-if ('' != $_POST['linkcheck'])
-       $linkcheck = $_POST[linkcheck];
+if ( !empty($_POST['linkcheck']) )
+       $linkcheck = $_POST['linkcheck'];
 
 $this_file = 'link-manager.php';
 
 
 $this_file = 'link-manager.php';
 
@@ -86,7 +97,7 @@ switch ($action) {
                wp_enqueue_script('link');
                wp_enqueue_script('xfn');
 
                wp_enqueue_script('link');
                wp_enqueue_script('xfn');
 
-               $parent_file = 'edit.php';
+               $parent_file = 'link-manager.php';
                $submenu_file = 'link-manager.php';
                $title = __('Edit Link');
 
                $submenu_file = 'link-manager.php';
                $title = __('Edit Link');
 
@@ -95,7 +106,6 @@ switch ($action) {
                if (!$link = get_link_to_edit($link_id))
                        wp_die(__('Link not found.'));
 
                if (!$link = get_link_to_edit($link_id))
                        wp_die(__('Link not found.'));
 
-               include_once ('admin-header.php');
                include ('edit-link-form.php');
                include ('admin-footer.php');
                break;
                include ('edit-link-form.php');
                include ('admin-footer.php');
                break;
@@ -103,4 +113,4 @@ switch ($action) {
        default :
                break;
 }
        default :
                break;
 }
-?>
\ No newline at end of file
+?>
diff --git a/wp-admin/media-new.php b/wp-admin/media-new.php
new file mode 100644 (file)
index 0000000..4cba71f
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Upload new media Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+$_GET['inline'] = 'true';
+/** Administration bootstrap */
+require_once('admin.php');
+require_once('media-upload.php');
+
+?>
\ No newline at end of file
index e756166950d548e3076a6b953e3ae76e17fa2145..9ba2268f7055a0da18afbf8b1cd93ffe71b7cdc8 100644 (file)
 <?php
 <?php
+/**
+ * Manage media uploaded file.
+ *
+ * There are many filters in here for media. Plugins can extend functionality
+ * by hooking into the filters.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once('admin.php');
 require_once('admin.php');
+
+if (!current_user_can('upload_files'))
+       wp_die(__('You do not have permission to upload files.'));
+
 wp_enqueue_script('swfupload');
 wp_enqueue_script('swfupload');
-wp_enqueue_script('swfupload-degrade');
+wp_enqueue_script('swfupload-swfobject');
 wp_enqueue_script('swfupload-queue');
 wp_enqueue_script('swfupload-handlers');
 
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 
 wp_enqueue_script('swfupload-queue');
 wp_enqueue_script('swfupload-handlers');
 
 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
 
-if (!current_user_can('upload_files'))
-       wp_die(__('You do not have permission to upload files.'));
-
 // IDs should be integers
 // IDs should be integers
-$ID = isset($ID)? (int) $ID : 0;
+$ID = isset($ID) ? (int) $ID : 0;
 $post_id = isset($post_id)? (int) $post_id : 0;
 
 // Require an ID for the edit screen
 if ( isset($action) && $action == 'edit' && !$ID )
        wp_die(__("You are not allowed to be here"));
 
 $post_id = isset($post_id)? (int) $post_id : 0;
 
 // Require an ID for the edit screen
 if ( isset($action) && $action == 'edit' && !$ID )
        wp_die(__("You are not allowed to be here"));
 
-// upload type: image, video, file, ..?
-if ( isset($_GET['type']) )
-       $type = strval($_GET['type']);
-else
-       $type = apply_filters('media_upload_default_type', 'file');
+if ( isset($_GET['inline']) ) {
+
+       if ( isset($_GET['upload-page-form']) ) {
+               $errors = media_upload_form_handler();
+
+               $location = 'upload.php';
+               if ( $errors )
+                       $location .= '?message=3';
+
+               wp_redirect( admin_url($location) );
+       }
+
+       if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
+               // Upload File button was clicked
+               $id = media_handle_upload('async-upload', $_REQUEST['post_id']);
+               unset($_FILES);
+               if ( is_wp_error($id) ) {
+                       $errors['upload_error'] = $id;
+                       $id = false;
+               }
+       }
+
+       $title = __('Upload New Media');
+       $parent_file = 'upload.php';
+       require_once('admin-header.php'); ?>
+       <div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php echo wp_specialchars( $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">
+
+       <?php media_upload_form(); ?>
+
+       <script type="text/javascript">
+       jQuery(function($){
+               var preloaded = $(".media-item.preloaded");
+               if ( preloaded.length > 0 ) {
+                       preloaded.each(function(){prepareMediaItem({id:this.id.replace(/[^0-9]/g, '')},'');});
+               }
+               updateMediaForm();
+               post_id = 0;
+               shortform = 1;
+       });
+       </script>
+       <input type="hidden" name="post_id" id="post_id" value="0" />
+       <?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' ) ); ?>" />
+       </p>
+       </form>
+       </div>
+
+<?php
+       include('admin-footer.php');
+
+} else {
 
 
-// tab: gallery, library, or type-specific
-if ( isset($_GET['tab']) )
-       $tab = strval($_GET['tab']);
-else
-       $tab = apply_filters('media_upload_default_tab', 'type');
+       // upload type: image, video, file, ..?
+       if ( isset($_GET['type']) )
+               $type = strval($_GET['type']);
+       else
+               $type = apply_filters('media_upload_default_type', 'file');
 
 
-$body_id = 'media-upload';
+       // tab: gallery, library, or type-specific
+       if ( isset($_GET['tab']) )
+               $tab = strval($_GET['tab']);
+       else
+               $tab = apply_filters('media_upload_default_tab', 'type');
 
 
-// let the action code decide how to handle the request
-if ( $tab == 'type' )
-       do_action("media_upload_$type");
-else
-       do_action("media_upload_$tab");
+       $body_id = 'media-upload';
 
 
+       // let the action code decide how to handle the request
+       if ( $tab == 'type' || $tab == 'type_url' )
+               do_action("media_upload_$type");
+       else
+               do_action("media_upload_$tab");
+}
 ?>
 ?>
index 150dea75de2d5bd1efd6119f5021a88f985d6c78..906238f7d0bcc8694900685f2df79fe25ab78a2c 100644 (file)
@@ -1,8 +1,15 @@
 <?php
 <?php
-
+/**
+ * Media management action handler.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-$parent_file = 'edit.php';
+$parent_file = 'upload.php';
 $submenu_file = 'upload.php';
 
 wp_reset_vars(array('action'));
 $submenu_file = 'upload.php';
 
 wp_reset_vars(array('action'));
@@ -17,12 +24,6 @@ case 'editattachment' :
 
        $errors = media_upload_form_handler();
 
 
        $errors = media_upload_form_handler();
 
-
-       check_admin_referer('media-form');
-
-       if ( !current_user_can('edit_post', $attachment_id) )
-               wp_die ( __('You are not allowed to edit this attachment.') );
-
        if ( empty($errors) ) {
                $location = 'media.php';
                if ( $referer = wp_get_original_referer() ) {
        if ( empty($errors) ) {
                $location = 'media.php';
                if ( $referer = wp_get_original_referer() ) {
@@ -60,11 +61,11 @@ 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' );
-
+//     wp_admin_css( 'media' );
 
        require( 'admin-header.php' );
 
 
        require( 'admin-header.php' );
 
+       $parent_file = 'upload.php';
        $message = '';
        $class = '';
        if ( isset($_GET['message']) ) {
        $message = '';
        $class = '';
        if ( isset($_GET['message']) ) {
@@ -81,18 +82,18 @@ case 'edit' :
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-
+<?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">
 <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">
-<div id="media-items" class="media-single">
+<div class="media-single">
 <div id='media-item-<?php echo $att_id; ?>' class='media-item'>
 <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, 'errors' => $errors ) ); ?>
+<?php echo get_media_item( $att_id, array( 'toggle' => false, 'send' => false, 'delete' => false, 'show_title' => false, 'errors' => $errors ) ); ?>
 </div>
 </div>
 
 <p class="submit">
 </div>
 </div>
 
 <p class="submit">
-<input type="submit" class="button" name="save" value="<?php _e('Save Changes'); ?>" />
+<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="hidden" name="action" value="editattachment" />
 <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="hidden" name="action" value="editattachment" />
index 90b629695786ea68428f3f7ccf1cf46c00fc2e9d..c6482ce152c459373e3d2b7bd0d7627597210c78 100644 (file)
@@ -1,4 +1,18 @@
 <?php
 <?php
+/**
+ * Displays Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * The current page.
+ *
+ * @global string $self
+ * @name $self
+ * @var string
+ */
 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
 $self = preg_replace('|^.*/plugins/|i', '', $self);
 
 $self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
 $self = preg_replace('|^.*/plugins/|i', '', $self);
 
@@ -6,165 +20,128 @@ global $menu, $submenu, $parent_file; //For when admin-header is included from w
 
 get_admin_page_parent();
 
 
 get_admin_page_parent();
 
-// We're going to do this loop three times
-?>
-
-<ul id="dashmenu">
-<?php
-foreach ( $menu as $key => $item ) {
-       if ( 3 < $key ) // get each menu item before 3
-               continue;
-       $class = '';
-       // 0 = name, 1 = capability, 2 = file
-       if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
-
-       if ( !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]}") || !empty($menu_hook))
-                       echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
-               else
-                       echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
-       } 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) )
-                       echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
-               else
-                       echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
+/**
+ * Display menu.
+ *
+ * @access private
+ * @since 2.7.0
+ *
+ * @param array $menu
+ * @param array $submenu
+ * @param bool $submenu_as_parent
+ */
+function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
+       global $self, $parent_file, $submenu_file, $plugin_page, $pagenow;
+
+       $first = true;
+       // 0 = name, 1 = capability, 2 = file, 3 = class, 4 = id, 5 = icon src
+       foreach ( $menu as $key => $item ) {
+               $admin_is_parent = false;
+               $class = array();
+               if ( $first ) {
+                       $class[] = 'wp-first-item';
+                       $first = false;
+               }
+               if ( !empty($submenu[$item[2]]) )
+                       $class[] = 'wp-has-submenu';
+
+               if ( ( $parent_file && $item[2] == $parent_file ) || strcmp($self, $item[2]) == 0 ) {
+                       if ( !empty($submenu[$item[2]]) )
+                               $class[] = 'wp-has-current-submenu wp-menu-open';
+                       else
+                               $class[] = 'current';
+               }
+
+               if ( isset($item[4]) && ! empty($item[4]) )
+                       $class[] = $item[4];
+
+               $class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
+               $tabindex = ' tabindex="1"';
+               $id = isset($item[5]) && ! empty($item[5]) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : '';
+               $img = '';
+               if ( isset($item[6]) && ! empty($item[6]) ) {
+                       if ( 'div' === $item[6] )
+                               $img = '<div class="wp-menu-image"><br /></div>';
+                       else
+                               $img = '<img class="wp-menu-image" 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') ) {
+                       echo '<br />';
+               } 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)) {
+                               $admin_is_parent = true;
+                               echo "$img$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
+                       } else {
+                               echo "\n\t$img$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');
+                       if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
+                               $admin_is_parent = true;
+                               echo "\n\t$img$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
+                       } else {
+                               echo "\n\t$img$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";
+                       }
+               }
+
+               if ( !empty($submenu[$item[2]]) ) {
+                       echo "\n\t<div class='wp-submenu'><div class='wp-submenu-head'>{$item[0]}</div><ul>";
+                       $first = true;
+                       foreach ( $submenu[$item[2]] as $sub_key => $sub_item ) {
+                               if ( !current_user_can($sub_item[1]) )
+                                       continue;
+
+                               $class = array();
+                               if ( $first ) {
+                                       $class[] = 'wp-first-item';
+                                       $first = false;
+                               }
+                               if ( isset($submenu_file) ) {
+                                       if ( $submenu_file == $sub_item[2] )
+                                               $class[] = 'current';
+                               // If plugin_page is set the parent must either match the current page or not physically exist.
+                               // This allows plugin pages with the same hook to exist under different parents.
+                               } else if ( (isset($plugin_page) && $plugin_page == $sub_item[2] && (!file_exists($item[2]) || ($item[2] == $self))) || (!isset($plugin_page) && $self == $sub_item[2]) ) {
+                                       $class[] = 'current';
+                               }
+
+                               $class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
+
+                               $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 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 )
+                                               echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+                                       elseif ( 'admin.php' == $pagenow || !$parent_exists )
+                                               echo "<li$class><a href='admin.php?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+                                       else
+                                               echo "<li$class><a href='{$item[2]}?page={$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+                               } else {
+                                       echo "<li$class><a href='{$sub_item[2]}'$class$tabindex>{$sub_item[0]}</a></li>";
+                               }
+                       }
+                       echo "</ul></div>";
+               }
+               echo "</li>";
        }
 }
        }
 }
-do_action( 'dashmenu' );
+
 ?>
 ?>
-</ul>
 
 <ul id="adminmenu">
 
 <ul id="adminmenu">
-<?php
-foreach ( $menu as $key => $item ) {
-       if ( 5 > $key || $key > 25 ) // get each menu item before 3
-               continue;
-
-       $class = '';
-
-       // 0 = name, 1 = capability, 2 = file
-       if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
-
-       if ( !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]}") || !empty($menu_hook))
-                       echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
-               else
-                       echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
-       } 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) )
-                       echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
-               else
-                       echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
-       }
-}
 
 
-foreach ( $menu as $key => $item ) {
-       if ( $key < 41 ) // there is a more efficient way to do this!
-               continue;
-
-       $class = '';
-
-       // 0 = name, 1 = capability, 2 = file
-       if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
-
-       if ( !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]}") || !empty($menu_hook))
-                       echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
-               else
-                       echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
-       } 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) )
-                       echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
-               else
-                       echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
-       }
-}
-
-do_action( 'adminmenu' );
-?>
-</ul>
-
-<ul id="sidemenu">
 <?php
 <?php
-$side_items = array();
-foreach ( $menu as $key => $item ) {
-       if ( 26 > $key || $key > 40 )
-               continue;
-
-       $class = '';
-
-       // 0 = name, 1 = capability, 2 = file
-       if (( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file))) $class = ' class="current"';
-
-       if ( !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]}") || !empty($menu_hook))
-                       $side_items[] = "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
-               else
-                       $side_items[] = "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
-       } 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) )
-                       $side_items[] = "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a>";
-               else
-                       $side_items[] = "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a>";
-       }
-}
-echo implode(' </li>', $side_items) . '</li>';
-unset($side_items);
-do_action( 'sidemenu' );
-?>
-</ul>
 
 
+_wp_menu_output( $menu, $submenu );
+do_action( 'adminmenu' );
 
 
-<?php
-// Sub-menu
-if ( isset($submenu["$parent_file"]) ) :
-?>
-<ul id="submenu">
-<?php
-foreach ($submenu["$parent_file"] as $item) :
-        if ( !current_user_can($item[1]) )
-                continue;
-
-if ( isset($submenu_file) ) {
-       if ( $submenu_file == $item[2] ) $class = ' class="current"';
-       else $class = '';
-} else if ( (isset($plugin_page) && $plugin_page == $item[2]) || (!isset($plugin_page) && $self == $item[2]) ) $class = ' class="current"';
-else $class = '';
-
-$menu_hook = get_plugin_page_hook($item[2], $parent_file);
-
-if (file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || ! empty($menu_hook)) {
-       if ( 'admin.php' == $pagenow )
-               echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
-       else
-               echo "\n\t<li><a href='{$parent_file}?page={$item[2]}'$class>{$item[0]}</a></li>";
- } else {
-       echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
- }
-endforeach;
-?>
-
-</ul>
-<?php
-else :
 ?>
 ?>
-<div id="minisub"></div>
-<?php
-
-endif;
-
-do_action('admin_notices');
-
-?>
\ No newline at end of file
+</ul>
\ No newline at end of file
index cad05c8701cc02b4c986c2f3ac0298ded9a8f465..209eb5870f98dcf211d22a4abda65c5a8f3ab8be 100644 (file)
 <?php
 <?php
-// This array constructs the admin menu bar.
-//
-// Menu item name
-// The minimum level the user needs to access the item: between 0 and 10
-// The URL of the item's file
-$menu[0] = array(__('Dashboard'), 'read', 'index.php');
-
-if (strpos($_SERVER['REQUEST_URI'], 'edit-pages.php') !== false)
-       $menu[5] = array(__('Write'), 'edit_pages', 'page-new.php');
-elseif (strpos($_SERVER['REQUEST_URI'], 'link-manager.php') !== false)
-       $menu[5] = array(__('Write'), 'manage_links', 'link-add.php');
-else
-       $menu[5] = array(__('Write'), 'edit_posts', 'post-new.php');
-
-if (strpos($_SERVER['REQUEST_URI'], 'page-new.php') !== false)
-       $menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php');
-elseif (strpos($_SERVER['REQUEST_URI'], 'link-add.php') !== false)
-       $menu[10] = array(__('Manage'), 'manage_links', 'link-manager.php');
-else
-       $menu[10] = array(__('Manage'), 'edit_posts', 'edit.php');
+/**
+ * Build Administration Menu.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * Constructs the admin menu bar.
+ *
+ * The elements in the array are :
+ *     0: Menu item name
+ *     1: Minimum level or capability required.
+ *     2: The URL of the item's file
+ *     3: Class
+ *     4: ID
+ *     5: Icon for top level menu
+ *
+ * @global array $menu
+ * @name $menu
+ * @var array
+ */
 
 $awaiting_mod = wp_count_comments();
 $awaiting_mod = $awaiting_mod->moderated;
 
 $awaiting_mod = wp_count_comments();
 $awaiting_mod = $awaiting_mod->moderated;
-$menu[15] = array(__('Design'), 'switch_themes', 'themes.php');
-$menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php');
-$menu[30] = array(__('Settings'), 'manage_options', 'options-general.php');
 
 
-$update_plugins = get_option( 'update_plugins' );
-$update_count = count( $update_plugins->response );
-$menu[35] = array( sprintf( __('Plugins %s'), "<span id='update-plugins' class='count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php');
-if ( current_user_can('edit_users') )
-       $menu[40] = array(__('Users'), 'edit_users', 'users.php');
-else
-       $menu[40] = array(__('Profile'), 'read', 'profile.php');
+$menu[0] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top', 'menu-dashboard', 'div' );
+
+$menu[4] = array( '', 'read', '', '', 'wp-menu-separator' );
+
+$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'wp-menu-open menu-top', 'menu-posts', 'div' );
+       $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' );
+
+$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');
+
+$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' );
+       $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' );
+
+$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_real_parent_file['post.php'] = 'post-new.php'; // Back-compat
-$submenu['post-new.php'][5] = array(__('Post'), 'edit_posts', 'post-new.php');
-$submenu['post-new.php'][10] = array(__('Page'), 'edit_pages', 'page-new.php');
-$submenu['post-new.php'][15] = array(__('Link'), 'manage_links', 'link-add.php');
+$_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
 
 
-$submenu['edit-comments.php'][5] = array(__('Comments'), 'edit_posts', 'edit-comments.php');
+$menu[39] = array( '', 'read', '', '', 'wp-menu-separator' );
 
 
-$submenu['edit.php'][5] = array(__('Posts'), 'edit_posts', 'edit.php');
-$submenu['edit.php'][10] = array(__('Pages'), 'edit_pages', 'edit-pages.php');
-$submenu['edit.php'][15] = array(__('Links'), 'manage_links', 'link-manager.php');
-$submenu['edit.php'][20] = array(__('Categories'), 'manage_categories', 'categories.php');
-$submenu['edit.php'][25] = array(__('Tags'), 'manage_categories', 'edit-tags.php');
-$submenu['edit.php'][30] = array(__('Link Categories'), 'manage_categories', 'edit-link-categories.php');
-$submenu['edit.php'][35] = array(__('Media Library'), 'upload_files', 'upload.php');
-$submenu['edit.php'][40] = array(__('Import'), 'import', 'import.php');
-$submenu['edit.php'][45] = array(__('Export'), 'import', 'export.php');
+$menu[40] = 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');
+
+$update_plugins = get_option( 'update_plugins' );
+$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' );
+       $submenu['plugins.php'][5]  = array( __('Installed'), 'activate_plugins', 'plugins.php' );
+       $submenu['plugins.php'][10] = array(_c('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') )
+       $menu[50] = array( __('Users'), 'edit_users', 'users.php', '', 'menu-top', 'menu-users', 'div' );
+else
+       $menu[50] = 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.
        $submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
 
 if ( current_user_can('edit_users') ) {
        $_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
        $submenu['users.php'][5] = array(__('Authors &amp; Users'), 'edit_users', 'users.php');
-       $submenu['users.php'][10] = array(__('Your Profile'), 'read', 'profile.php');
+       $submenu['users.php'][10] = array(__('Add New'), 'create_users', 'user-new.php');
+       $submenu['users.php'][15] = array(__('Your Profile'), 'read', 'profile.php');
 } else {
        $_wp_real_parent_file['users.php'] = 'profile.php';
        $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
 }
 
 } else {
        $_wp_real_parent_file['users.php'] = 'profile.php';
        $submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.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');
-$submenu['options-general.php'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
-$submenu['options-general.php'][30] = array(__('Privacy'), 'manage_options', 'options-privacy.php');
-$submenu['options-general.php'][35] = array(__('Permalinks'), 'manage_options', 'options-permalink.php');
-$submenu['options-general.php'][40] = array(__('Miscellaneous'), 'manage_options', 'options-misc.php');
+$menu[55] = 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['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
-$submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin-editor.php');
+$menu[60] = 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'][25] = array(__('Discussion'), 'manage_options', 'options-discussion.php');
+       $submenu['options-general.php'][30] = array(__('Media'), 'manage_options', 'options-media.php');
+       $submenu['options-general.php'][35] = array(__('Privacy'), 'manage_options', 'options-privacy.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['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
-$submenu['themes.php'][10] = array(__('Theme Editor'), 'edit_themes', 'theme-editor.php');
+$_wp_last_utility_menu = 60; // The index of the last top-level menu in the utility menu group
+
+$menu[79] = array( '', 'read', '', '', 'wp-menu-separator-last' );
+
+// Back-compat for old top-levels
+$_wp_real_parent_file['post.php'] = 'edit.php';
+$_wp_real_parent_file['post-new.php'] = 'edit.php';
+$_wp_real_parent_file['page-new.php'] = 'edit-pages.php';
 
 do_action('_admin_menu');
 
 
 do_action('_admin_menu');
 
@@ -84,16 +118,18 @@ foreach ($menu as $menu_page) {
 $_wp_submenu_nopriv = array();
 $_wp_menu_nopriv = array();
 // Loop over submenus and remove pages for which the user does not have privs.
 $_wp_submenu_nopriv = array();
 $_wp_menu_nopriv = array();
 // Loop over submenus and remove pages for which the user does not have privs.
-foreach ($submenu as $parent => $sub) {
-       foreach ($sub as $index => $data) {
-               if ( ! current_user_can($data[1]) ) {
-                       unset($submenu[$parent][$index]);
-                       $_wp_submenu_nopriv[$parent][$data[2]] = true;
+foreach ( array( 'submenu' ) as $sub_loop ) {
+       foreach ($$sub_loop as $parent => $sub) {
+               foreach ($sub as $index => $data) {
+                       if ( ! current_user_can($data[1]) ) {
+                               unset(${$sub_loop}[$parent][$index]);
+                               $_wp_submenu_nopriv[$parent][$data[2]] = true;
+                       }
                }
                }
-       }
 
 
-       if ( empty($submenu[$parent]) )
-               unset($submenu[$parent]);
+               if ( empty(${$sub_loop}[$parent]) )
+                       unset(${$sub_loop}[$parent]);
+       }
 }
 
 // Loop over the top-level menu.
 }
 
 // Loop over the top-level menu.
@@ -117,7 +153,9 @@ foreach ( $menu as $id => $data ) {
                        unset($submenu[$old_parent][$index]);
                }
                unset($submenu[$old_parent]);
                        unset($submenu[$old_parent][$index]);
                }
                unset($submenu[$old_parent]);
-               $_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
+
+               if ( isset($_wp_submenu_nopriv[$old_parent]) )
+                       $_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
        }
 }
 
        }
 }
 
@@ -136,10 +174,71 @@ foreach ( $menu as $id => $data ) {
        }
 }
 
        }
 }
 
+// Remove any duplicated seperators
+$seperator_found = false;
+foreach ( $menu as $id => $data ) {
+       if ( 0 == strcmp('wp-menu-separator', $data[4] ) ) {
+               if (false == $seperator_found) {
+                       $seperator_found = true;
+               } else {
+                       unset($menu[$id]);
+                       $seperator_found = false;
+               }
+       } else {
+               $seperator_found = false;
+       }
+}
+
 unset($id);
 
 unset($id);
 
+function add_cssclass($add, $class) {
+       $class = empty($class) ? $add : $class .= ' ' . $add;
+       return $class;
+}
+
+function add_menu_classes($menu) {
+
+       $first = $lastorder = false;
+       $i = 0;
+       $mc = count($menu);
+       foreach ( $menu as $order => $top ) {
+               $i++;
+
+               if ( 0 == $order ) { // dashboard is always shown/single
+                       $menu[0][4] = add_cssclass('menu-top-first menu-top-last', $top[4]);
+                       continue;
+               }
+
+               if ( empty($top[2]) ) { // if separator
+                       $first = true;
+                       if ( $lastorder ) {
+                               $c = $menu[$lastorder][4];
+                               $menu[$lastorder][4] = add_cssclass('menu-top-last', $c);
+                       }
+                       continue;
+               }
+
+               if ( $first ) {
+                       $c = $menu[$order][4];
+                       $menu[$order][4] = add_cssclass('menu-top-first', $c);
+                       $first = false;
+               }
+
+               if ( $mc == $i ) { // last item
+                       $c = $menu[$order][4];
+                       $menu[$order][4] = add_cssclass('menu-top-last', $c);
+               }
+
+               $lastorder = $order;
+       }
+
+       return apply_filters( 'add_menu_classes', $menu );
+}
+
 uksort($menu, "strnatcasecmp"); // make it all pretty
 
 uksort($menu, "strnatcasecmp"); // make it all pretty
 
+$menu = add_menu_classes($menu);
+
 if (! user_can_access_admin_page()) {
        do_action('admin_page_access_denied');
        wp_die( __('You do not have sufficient permissions to access this page.') );
 if (! user_can_access_admin_page()) {
        do_action('admin_page_access_denied');
        wp_die( __('You do not have sufficient permissions to access this page.') );
index 46cda95fc72090e67e9b8b66e3ca7f63bda2c8fe..6a26f23e0876fed4984baa82b197e450a08cb364 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Comment Moderation Administration Panel.
+ *
+ * Redirects to edit-comments.php?comment_status=moderated.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 require_once('../wp-load.php');
 wp_redirect('edit-comments.php?comment_status=moderated');
 ?>
 require_once('../wp-load.php');
 wp_redirect('edit-comments.php?comment_status=moderated');
 ?>
index e676dc82d691c1341157a8858eb62369aabc7616..f267db22512eccb4ae6ef1fcc1dacc6c1e011641 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Discussion settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __('Discussion Settings');
 require_once('admin.php');
 
 $title = __('Discussion Settings');
@@ -8,9 +16,12 @@ include('admin-header.php');
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Discussion Settings') ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
 <form method="post" action="options.php">
 <form method="post" action="options.php">
-<?php wp_nonce_field('update-options') ?>
+<?php settings_fields('discussion'); ?>
+
 <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>
@@ -31,6 +42,65 @@ include('admin-header.php');
 </fieldset></td>
 </tr>
 <tr valign="top">
 </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>
+<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">
+<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
+<?php _e('Users must be registered and logged in to comment') ?>
+</label>
+<br />
+
+<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" />') ?>
+<br />
+<label for="thread_comments">
+<input name="thread_comments" type="checkbox" id="thread_comments" value="1" <?php checked('1', get_option('thread_comments')); ?> />
+<?php
+
+$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 .= "<option value='$i'";
+       if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
+       $thread_comments_depth .= ">$i</option>";
+}
+$thread_comments_depth .= '</select>';
+
+printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
+
+?><br />
+<label for="page_comments">
+<input name="page_comments" type="checkbox" id="page_comments" value="1" <?php checked('1', get_option('page_comments')); ?> />
+<?php
+
+$default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
+if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
+$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>';
+
+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 );
+
+?></label>
+<br />
+<label for="comment_order"><?php
+
+$comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
+if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
+$comment_order .= '>' . __('older') . '</option><option value="desc"';
+if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
+$comment_order .= '>' . __('newer') . '</option></select>';
+
+printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
+
+?></label>
+</fieldset></td>
+</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>
 <label for="comments_notify">
 <th scope="row"><?php _e('E-mail me whenever') ?></th>
 <td><fieldset><legend class="hidden"><?php _e('E-mail me whenever') ?></legend>
 <label for="comments_notify">
@@ -49,19 +119,17 @@ include('admin-header.php');
 <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>
 <br />
 <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>
 <br />
-<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_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
 </fieldset></td>
 </tr>
 <tr valign="top">
 <th scope="row"><?php _e('Comment Moderation') ?></th>
 <td><fieldset><legend class="hidden"><?php _e('Comment Moderation') ?></legend>
 <label for="comment_whitelist"><input type="checkbox" name="comment_whitelist" id="comment_whitelist" value="1" <?php checked('1', get_option('comment_whitelist')); ?> /> <?php _e('Comment author must have a previously approved comment') ?></label>
 </fieldset></td>
 </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" size="3" value="' . get_option('comment_max_links'). '" />' ) ?></label></p>
+<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>
 
 <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>
 
 <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>
-<textarea name="moderation_keys" cols="60" rows="10" id="moderation_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('moderation_keys'); ?></textarea>
+<textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php form_option('moderation_keys'); ?></textarea>
 </p>
 </fieldset></td>
 </tr>
 </p>
 </fieldset></td>
 </tr>
@@ -70,10 +138,11 @@ include('admin-header.php');
 <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>
 <p>
 <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>
 <p>
-<textarea name="blacklist_keys" cols="60" rows="10" id="blacklist_keys" style="width: 98%; font-size: 12px;" class="code"><?php form_option('blacklist_keys'); ?></textarea>
+<textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php form_option('blacklist_keys'); ?></textarea>
 </p>
 </fieldset></td>
 </tr>
 </p>
 </fieldset></td>
 </tr>
+<?php do_settings_fields('discussion', 'default'); ?>
 </table>
 
 <h3><?php _e('Avatars') ?></h3>
 </table>
 
 <h3><?php _e('Avatars') ?></h3>
@@ -145,14 +214,13 @@ echo apply_filters('default_avatar_select', $avatar_list);
 
 </fieldset></td>
 </tr>
 
 </fieldset></td>
 </tr>
-
+<?php do_settings_fields('discussion', 'avatars'); ?>
 </table>
 
 </table>
 
+<?php do_settings_sections('discussion'); ?>
 
 <p class="submit">
 
 <p class="submit">
-<input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="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" />
-<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
+<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
 </div>
 </p>
 </form>
 </div>
index aec47d05accac1cd982ca8bab6f2c2cb3c1069f3..f302e5fbefa21fec63956f502a28b75257448e31 100644 (file)
@@ -1,50 +1,89 @@
 <?php
 <?php
+/**
+ * General settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('./admin.php');
 
 $title = __('General Settings');
 $parent_file = 'options-general.php';
 
 require_once('./admin.php');
 
 $title = __('General Settings');
 $parent_file = 'options-general.php';
 
+/**
+ * Display JavaScript on the page.
+ *
+ * @package WordPress
+ * @subpackage General_Settings_Panel
+ */
+function add_js() {
+?>
+<script type="text/javascript">
+//<![CDATA[
+       jQuery(document).ready(function($){
+               $("input[name='date_format']").click(function(){
+                       if ( "date_format_custom_radio" != $(this).attr("id") )
+                               $("input[name='date_format_custom']").val( $(this).val() );
+               });
+               $("input[name='date_format_custom']").focus(function(){
+                       $("#date_format_custom_radio").attr("checked", "checked");
+               });
+
+               $("input[name='time_format']").click(function(){
+                       if ( "time_format_custom_radio" != $(this).attr("id") )
+                               $("input[name='time_format_custom']").val( $(this).val() );
+               });
+               $("input[name='time_format_custom']").focus(function(){
+                       $("#time_format_custom_radio").attr("checked", "checked");
+               });
+       });
+//]]>
+</script>
+<?php
+}
+add_filter('admin_head', 'add_js');
+
 include('./admin-header.php');
 ?>
 
 <div class="wrap">
 include('./admin-header.php');
 ?>
 
 <div class="wrap">
-<h2><?php _e('General Settings') ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
 <form method="post" action="options.php">
 <form method="post" action="options.php">
-<?php wp_nonce_field('update-options') ?>
+<?php settings_fields('general'); ?>
+
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="blogname"><?php _e('Blog Title') ?></label></th>
-<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" size="40" /></td>
+<td><input name="blogname" type="text" id="blogname" value="<?php form_option('blogname'); ?>" class="regular-text" /></td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="blogdescription"><?php _e('Tagline') ?></label></th>
-<td><input name="blogdescription" type="text" id="blogdescription" style="width: 95%" value="<?php form_option('blogdescription'); ?>" size="45" />
-<br />
-<?php _e('In a few words, explain what this blog is about.') ?></td>
+<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>
 </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>
-<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" size="40" class="code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
+<td><input name="siteurl" type="text" id="siteurl" value="<?php form_option('siteurl'); ?>" class="regular-text code<?php if ( defined( 'WP_SITEURL' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /></td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="home"><?php _e('Blog address (URL)') ?></label></th>
 </tr>
 <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'); ?>" size="40" class="code<?php if ( defined( 'WP_HOME' ) ) : ?> disabled" disabled="disabled"<?php else: ?>"<?php endif; ?> /><br /><?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.'); ?></td>
+<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>
 </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'); ?>" size="40" class="code" />
-<br />
-<?php _e('This address is used for admin purposes, like new user notification.') ?></td>
+<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>
 </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">
 <input name="users_can_register" type="checkbox" id="users_can_register" value="1" <?php checked('1', get_option('users_can_register')); ?> />
 </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">
 <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><br />
-<label for="comment_registration">
-<input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
-<?php _e('Users must be registered and logged in to comment') ?>
-</label>
+<?php _e('Anyone can register') ?></label>
 </fieldset></td>
 </tr>
 <tr valign="top">
 </fieldset></td>
 </tr>
 <tr valign="top">
@@ -80,22 +119,77 @@ foreach ( $offset_range as $offset ) {
 }
 ?>
 </select>
 }
 ?>
 </select>
-<?php _e('hours') ?><br />
-<?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), gmdate(__('Y-m-d G:i:s'))); ?><br />
-<?php if ($current_offset) printf(__('UTC %1$s is <code>%2$s</code>'), $current_offset_name, gmdate(__('Y-m-d G:i:s'), current_time('timestamp'))); ?><br />
-<?php _e('Unfortunately, you have to manually update this for Daylight Savings Time. Lame, we know, but will be fixed in the future.'); ?>
+<?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 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>
+<?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>
 </td>
 </tr>
 <tr>
 </td>
 </tr>
 <tr>
-<th scope="row"><label for="date_format"><?php _e('Date Format') ?></label></th>
-<td><input name="date_format" type="text" id="date_format" size="30" value="<?php form_option('date_format'); ?>" /><br />
-<?php _e('Output:') ?> <strong><?php echo mysql2date(get_option('date_format'), current_time('mysql')); ?></strong></td>
+<th scope="row"><?php _e('Date Format') ?></th>
+<td>
+       <fieldset><legend class="hidden"><?php _e('Date Format') ?></legend>
+<?php
+
+       $date_formats = apply_filters( 'date_formats', array(
+               __('F j, Y'),
+               'Y/m/d',
+               'm/d/Y',
+               'd/m/Y',
+       ) );
+
+       $custom = TRUE;
+
+       foreach ( $date_formats as $format ) {
+               echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='date_format' value='" . attribute_escape($format) . "'";
+               if ( get_option('date_format') === $format ) { // checked() uses "==" rather than "==="
+                       echo " checked='checked'";
+                       $custom = FALSE;
+               }
+               echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
+       }
+
+       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";
+
+       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";
+?>
+       </fieldset>
+</td>
 </tr>
 <tr>
 </tr>
 <tr>
-<th scope="row"><label for="time_format"><?php _e('Time Format') ?></label></th>
-<td><input name="time_format" type="text" id="time_format" size="30" value="<?php form_option('time_format'); ?>" /><br />
-<?php _e('Output:') ?> <strong><?php echo gmdate(get_option('time_format'), current_time('timestamp')); ?></strong><br />
-<?php _e('<a href="http://codex.wordpress.org/Formatting_Date_and_Time">Documentation on date formatting</a>. Click "Save Changes" to update sample output.') ?></td>
+<th scope="row"><?php _e('Time Format') ?></th>
+<td>
+       <fieldset><legend class="hidden"><?php _e('Time Format') ?></legend>
+<?php
+
+       $time_formats = apply_filters( 'time_formats', array(
+               __('g:i a'),
+               'g:i A',
+               'H:i',
+       ) );
+
+       $custom = TRUE;
+
+       foreach ( $time_formats as $format ) {
+               echo "\t<label title='" . attribute_escape($format) . "'><input type='radio' name='time_format' value='" . attribute_escape($format) . "'";
+               if ( get_option('time_format') === $format ) { // checked() uses "==" rather than "==="
+                       echo " checked='checked'";
+                       $custom = FALSE;
+               }
+               echo ' /> ' . date_i18n( $format ) . "</label><br />\n";
+       }
+
+       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";
+?>
+       </fieldset>
+</td>
 </tr>
 <tr>
 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
 </tr>
 <tr>
 <th scope="row"><label for="start_of_week"><?php _e('Week Starts On') ?></label></th>
@@ -108,11 +202,13 @@ endfor;
 ?>
 </select></td>
 </tr>
 ?>
 </select></td>
 </tr>
+<?php do_settings_fields('general', 'default'); ?>
 </table>
 
 </table>
 
-<p class="submit"><input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
-<input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="<?php if ( ! defined( 'WP_SITEURL' ) ) echo 'siteurl,'; if ( ! defined( 'WP_HOME' ) ) echo 'home,'; ?>blogname,blogdescription,admin_email,users_can_register,gmt_offset,date_format,time_format,start_of_week,comment_registration,default_role" />
+<?php do_settings_sections('general'); ?>
+
+<p class="submit">
+<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
 
 </p>
 </form>
 
index 779edca44774e0ca23d63667f89a4006a7b8ff3e..14a177c3c42abdf4e5b68ed3e77472dd661bf8ad 100644 (file)
@@ -1,4 +1,16 @@
-<?php wp_reset_vars(array('action', 'standalone', 'option_group_id')); ?>
+<?php
+/**
+ * WordPress Options Header.
+ *
+ * Resets variables: 'action', 'standalone', and 'option_group_id'. Displays
+ * updated message, if updated variable is part of the URL query.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+wp_reset_vars(array('action', 'standalone', 'option_group_id'));
+?>
 
 <?php if (isset($_GET['updated'])) : ?>
 <div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div>
 
 <?php if (isset($_GET['updated'])) : ?>
 <div id="message" class="updated fade"><p><strong><?php _e('Settings saved.') ?></strong></p></div>
diff --git a/wp-admin/options-media.php b/wp-admin/options-media.php
new file mode 100644 (file)
index 0000000..87a6d0c
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/**
+ * Media settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once('admin.php');
+
+$title = __('Media Settings');
+$parent_file = 'options-general.php';
+
+include('admin-header.php');
+
+?>
+
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
+<form action="options.php" method="post">
+<?php settings_fields('media'); ?>
+
+<h3><?php _e('Image sizes') ?></h3>
+<p><?php _e('The sizes listed below determine the maximum dimensions in pixels to use when inserting an image into the body of a post.'); ?></p>
+
+<table class="form-table">
+<tr valign="top">
+<th scope="row"><?php _e('Thumbnail size') ?></th>
+<td>
+<label for="thumbnail_size_w"><?php _e('Width'); ?></label>
+<input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" />
+<label for="thumbnail_size_h"><?php _e('Height'); ?></label>
+<input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" /><br />
+<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
+<label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
+</td>
+</tr>
+
+<tr valign="top">
+<th scope="row"><?php _e('Medium size') ?></th>
+<td><fieldset><legend class="hidden"><?php _e('Medium size') ?></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>
+<input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" />
+</fieldset></td>
+</tr>
+
+<tr valign="top">
+<th scope="row"><?php _e('Large size') ?></th>
+<td><fieldset><legend class="hidden"><?php _e('Large size') ?></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>
+<input name="large_size_h" type="text" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" />
+</fieldset></td>
+</tr>
+
+<?php do_settings_fields('media', 'default'); ?>
+</table>
+
+<?php do_settings_sections('media'); ?>
+
+<p class="submit">
+       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+</p>
+
+</form>
+
+</div>
+
+<?php include('./admin-footer.php'); ?>
index 7497a1c02a0e2c61f4e564a0653ec5c2119af407..8109c2f8d8f1547bcd7492bcd791c2ee5dc795b5 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Miscellaneous settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __('Miscellaneous Settings');
 require_once('admin.php');
 
 $title = __('Miscellaneous Settings');
@@ -9,69 +17,45 @@ include('admin-header.php');
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Miscellaneous Settings') ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
 <form method="post" action="options.php">
 <form method="post" action="options.php">
-<?php wp_nonce_field('update-options') ?>
-<h3><?php _e('Uploading'); ?></h3>
+<?php settings_fields('misc'); ?>
+
+<h3><?php _e('Uploading Files'); ?></h3>
 <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" class="code" value="<?php echo attribute_escape(str_replace(ABSPATH, '', get_option('upload_path'))); ?>" size="40" />
-<br />
-<?php _e('Default is <code>wp-content/uploads</code>'); ?>
+<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>
 </tr>
 
 <tr valign="top">
 </td>
 </tr>
 
 <tr valign="top">
-<th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files (optional)'); ?></label></th>
-<td><input name="upload_url_path" type="text" id="upload_url_path" class="code" value="<?php echo attribute_escape( get_option('upload_url_path')); ?>" size="40" />
+<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>
 </tr>
 
 <tr>
 <th scope="row" colspan="2" class="th-full">
 <label for="uploads_use_yearmonth_folders">
 </td>
 </tr>
 
 <tr>
 <th scope="row" colspan="2" class="th-full">
 <label for="uploads_use_yearmonth_folders">
-<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1" <?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
+<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
 <?php _e('Organize my uploads into month- and year-based folders'); ?>
 </label>
 </th>
 </tr>
 <?php _e('Organize my uploads into month- and year-based folders'); ?>
 </label>
 </th>
 </tr>
+<?php do_settings_fields('misc', 'default'); ?>
 </table>
 
 </table>
 
-<h3><?php _e('Image sizes') ?></h3>
-<p><?php _e('The sizes listed below determine the maximum dimensions to use when inserting an image into the body of a post.'); ?></p>
-
-<table class="form-table">
-<tr valign="top">
-<th scope="row"><?php _e('Thumbnail size') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Thumbnail size') ?></legend>
-<label for="thumbnail_size_w"><?php _e('Width'); ?></label>
-<input name="thumbnail_size_w" type="text" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" size="6" />
-<label for="thumbnail_size_h"><?php _e('Height'); ?></label>
-<input name="thumbnail_size_h" type="text" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" size="6" /><br />
-<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
-<label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
-</fieldset></td>
-</tr>
-<tr valign="top">
-<th scope="row"><?php _e('Medium size') ?></th>
-<td><fieldset><legend class="hidden"><?php _e('Medium size') ?></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'); ?>" size="6" />
-<label for="medium_size_h"><?php _e('Max Height'); ?></label>
-<input name="medium_size_h" type="text" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" size="6" />
-</fieldset></td>
-</tr>
-</table>
-
-
-
 <table class="form-table">
 
 <tr>
 <th scope="row" class="th-full">
 <label for="use_linksupdate">
 <table class="form-table">
 
 <tr>
 <th scope="row" class="th-full">
 <label for="use_linksupdate">
-<input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_option('use_linksupdate')); ?> />
+<input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1"<?php checked('1', get_option('use_linksupdate')); ?> />
 <?php _e('Track Links&#8217; Update Times') ?>
 </label>
 </th>
 <?php _e('Track Links&#8217; Update Times') ?>
 </label>
 </th>
@@ -80,7 +64,7 @@ include('admin-header.php');
 
 <th scope="row" class="th-full">
 <label for="hack_file">
 
 <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')); ?> />
+<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>
 <?php _e('Use legacy <code>my-hacks.php</code> file support') ?>
 </label>
 </th>
@@ -88,12 +72,13 @@ include('admin-header.php');
 
 </table>
 
 
 </table>
 
+<?php do_settings_sections('misc'); ?>
+
 <p class="submit">
 <p class="submit">
-<input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path,upload_url_path,thumbnail_size_w,thumbnail_size_h,thumbnail_crop,medium_size_w,medium_size_h" />
-<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" class="button" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
 </p>
 </p>
+
 </form>
 </div>
 
 </form>
 </div>
 
-<?php include('./admin-footer.php'); ?>
\ No newline at end of file
+<?php include('./admin-footer.php'); ?>
index b2d05d3694e926c4364b2b2f558896435f19b359..93f1619f839f59997253c3b259fa9d457b38fff0 100644 (file)
@@ -1,9 +1,23 @@
 <?php
 <?php
+/**
+ * Permalink settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __('Permalink Settings');
 $parent_file = 'options-general.php';
 
 require_once('admin.php');
 
 $title = __('Permalink Settings');
 $parent_file = 'options-general.php';
 
+/**
+ * Display JavaScript on the page.
+ *
+ * @package WordPress
+ * @subpackage Permalink_Settings_Panel
+ */
 function add_js() {
 ?>
 <script type="text/javascript">
 function add_js() {
 ?>
 <script type="text/javascript">
@@ -109,9 +123,12 @@ else
 <?php endif; ?>
 
 <div class="wrap">
 <?php endif; ?>
 
 <div class="wrap">
-  <h2><?php _e('Customize Permalink Structure') ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $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') ?>
+
   <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
 
 <?php
   <p><?php _e('By default WordPress uses web <abbr title="Universal Resource Locator">URL</abbr>s which have question marks and lots of numbers in them, however WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="http://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
 
 <?php
@@ -156,14 +173,14 @@ $structures = array(
                        </label>
                </th>
                <td>
                        </label>
                </th>
                <td>
-                       <input name="permalink_structure" id="permalink_structure" type="text" class="code" style="width: 60%;" value="<?php echo attribute_escape($permalink_structure); ?>" size="50" />
+                       <input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo attribute_escape($permalink_structure); ?>" class="regular-text code" />
                </td>
        </tr>
 </table>
 
 <h3><?php _e('Optional'); ?></h3>
 <?php if ($is_apache) : ?>
                </td>
        </tr>
 </table>
 
 <h3><?php _e('Optional'); ?></h3>
 <?php if ($is_apache) : ?>
-       <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/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>
 <?php endif; ?>
 <?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>
 <?php endif; ?>
@@ -171,20 +188,26 @@ $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" class="code"  value="<?php echo attribute_escape($category_base); ?>" size="30" /></td>
+               <td><input name="category_base" id="category_base" type="text" value="<?php echo attribute_escape($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" class="code"  value="<?php echo attribute_escape($tag_base); ?>" size="30" /></td>
+               <td><input name="tag_base" id="tag_base" type="text" value="<?php echo attribute_escape($tag_base); ?>" class="regular-text code" /></td>
        </tr>
        </tr>
+       <?php do_settings_fields('permalink', 'optional'); ?>
 </table>
 </table>
-<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Save Changes') ?>" /></p>
+
+<?php do_settings_sections('permalink'); ?>
+
+<p class="submit">
+       <input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
+</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>
 <form action="options-permalink.php" method="post">
 <?php wp_nonce_field('update-permalink') ?>
   </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>
 <form action="options-permalink.php" method="post">
 <?php wp_nonce_field('update-permalink') ?>
-       <p><textarea rows="5" style="width: 98%;" name="rules" id="rules"><?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 wp_specialchars($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
 </form>
 <?php endif; ?>
 
 </form>
 <?php endif; ?>
 
index 3d9d140fc98494b10330d24204c4ba789c7865fa..c46b72083105e12cd3114f6407bafbc47424b4db 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Privacy Options Settings Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once('./admin.php');
 
 $title = __('Privacy Settings');
 require_once('./admin.php');
 
 $title = __('Privacy Settings');
@@ -8,9 +16,12 @@ include('./admin-header.php');
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Privacy Settings') ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
 <form method="post" action="options.php">
 <form method="post" action="options.php">
-<?php wp_nonce_field('update-options') ?>
+<?php settings_fields('privacy'); ?>
+
 <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>
@@ -22,11 +33,13 @@ include('./admin-header.php');
 <?php do_action('blog_privacy_selector'); ?>
 </fieldset></td>
 </tr>
 <?php do_action('blog_privacy_selector'); ?>
 </fieldset></td>
 </tr>
+<?php do_settings_fields('privacy', 'default'); ?>
 </table>
 
 </table>
 
-<p class="submit"><input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
-<input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="blog_public" />
+<?php do_settings_sections('privacy'); ?>
+
+<p class="submit">
+       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
 
 </p>
 </form>
 
index b49f88b86dcb2bf7d8b46c472db6153093334eb7..ff0fa4b6026e0a2d586c6e35497b663c7eec184c 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Reading settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __('Reading Settings');
 require_once('admin.php');
 
 $title = __('Reading Settings');
@@ -8,9 +16,12 @@ include('admin-header.php');
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Reading Settings') ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
 <form name="form1" method="post" action="options.php">
 <form name="form1" method="post" action="options.php">
-<?php wp_nonce_field('update-options') ?>
+<?php settings_fields('reading'); ?>
+
 <table class="form-table">
 <?php if ( get_pages() ): ?>
 <tr valign="top">
 <table class="form-table">
 <?php if ( get_pages() ): ?>
 <tr valign="top">
@@ -43,12 +54,12 @@ include('admin-header.php');
 <tr valign="top">
 <th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most') ?></label></th>
 <td>
 <tr valign="top">
 <th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most') ?></label></th>
 <td>
-<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" size="3" /> <?php _e('posts') ?>
+<input name="posts_per_page" type="text" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" class="small-text" /> <?php _e('posts') ?>
 </td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent') ?></label></th>
 </td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent') ?></label></th>
-<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" size="3" /> <?php _e('posts') ?></td>
+<td><input name="posts_per_rss" type="text" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" class="small-text" /> <?php _e('posts') ?></td>
 </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>
@@ -60,14 +71,16 @@ 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'); ?>" size="20" class="code" /><br />
-<?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>)') ?></td>
+<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>
 </tr>
 </tr>
+<?php do_settings_fields('reading', 'default'); ?>
 </table>
 </table>
+
+<?php do_settings_sections('reading'); ?>
+
 <p class="submit">
 <p class="submit">
-<input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="posts_per_page,posts_per_rss,rss_use_excerpt,blog_charset,gzipcompression,show_on_front,page_on_front,page_for_posts" />
-<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
 </div>
 </p>
 </form>
 </div>
index 03379a42ec41082614461dba5f981eba861170d8..7220a45e4e61f7ef50a6be9ea3991971fd6638d0 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Writing settings administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __('Writing Settings');
 require_once('admin.php');
 
 $title = __('Writing Settings');
@@ -8,14 +16,16 @@ include('admin-header.php');
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Writing Settings') ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
 <form method="post" action="options.php">
 <form method="post" action="options.php">
-<?php wp_nonce_field('update-options') ?>
+<?php settings_fields('writing'); ?>
 
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="default_post_edit_rows"> <?php _e('Size of the post box') ?></label></th>
 
 <table class="form-table">
 <tr valign="top">
 <th scope="row"><label for="default_post_edit_rows"> <?php _e('Size of the post box') ?></label></th>
-<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" size="2" style="width: 1.5em;" />
+<td><input name="default_post_edit_rows" type="text" id="default_post_edit_rows" value="<?php form_option('default_post_edit_rows'); ?>" class="small-text" />
 <?php _e('lines') ?></td>
 </tr>
 <tr valign="top">
 <?php _e('lines') ?></td>
 </tr>
 <tr valign="top">
@@ -29,32 +39,21 @@ include('admin-header.php');
 </tr>
 <tr valign="top">
 <th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="default_category"><?php _e('Default Post Category') ?></label></th>
-<td><select name="default_category" id="default_category">
+<td>
 <?php
 <?php
-$categories = get_categories('get=all');
-foreach ($categories as $category) :
-$category = sanitize_category($category);
-if ($category->term_id == get_option('default_category')) $selected = " selected='selected'";
-else $selected = '';
-echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
-endforeach;
+wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_category', 'orderby' => 'name', 'selected' => get_option('default_category'), 'hierarchical' => true));
 ?>
 ?>
-</select></td>
+</td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th>
-<td><select name="default_link_category" id="default_link_category">
+<td>
 <?php
 <?php
-$link_categories = get_terms('link_category', 'get=all');
-foreach ($link_categories as $category) :
-$category = sanitize_term($category, 'link_category');
-if ($category->term_id == get_option('default_link_category')) $selected = " selected='selected'";
-else $selected = '';
-echo "\n\t<option value='$category->term_id' $selected>$category->name</option>";
-endforeach;
+wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_link_category', 'orderby' => 'name', 'selected' => get_option('default_link_category'), 'hierarchical' => true, 'type' => 'link'));
 ?>
 ?>
-</select></td>
+</td>
 </tr>
 </tr>
+<?php do_settings_fields('writing', 'default'); ?>
 </table>
 
 <h3><?php _e('Remote Publishing') ?></h3>
 </table>
 
 <h3><?php _e('Remote Publishing') ?></h3>
@@ -75,43 +74,40 @@ endforeach;
 <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 />
 </fieldset></td>
 <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 />
 </fieldset></td>
-</tr></table>
+</tr>
+<?php do_settings_fields('writing', 'remote_publishing'); ?>
+</table>
 
 <h3><?php _e('Post via e-mail') ?></h3>
 
 <h3><?php _e('Post via e-mail') ?></h3>
-<p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <code>%s</code>, <code>%s</code>, <code>%s</code>.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?></p>
+<p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it&#8217;s a good idea to keep this address very secret. Here are three random strings you could use: <kbd>%s</kbd>, <kbd>%s</kbd>, <kbd>%s</kbd>.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?></p>
 
 <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'); ?>" size="40" />
+<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" class="regular-text" />
 <label for="mailserver_port"><?php _e('Port') ?></label>
 <label for="mailserver_port"><?php _e('Port') ?></label>
-<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" />
+<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" class="small-text" />
 </td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="mailserver_login"><?php _e('Login Name') ?></label></th>
 </td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="mailserver_login"><?php _e('Login Name') ?></label></th>
-<td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option('mailserver_login'); ?>" size="40" /></td>
+<td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option('mailserver_login'); ?>" class="regular-text" /></td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="mailserver_pass"><?php _e('Password') ?></label></th>
 <td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="mailserver_pass"><?php _e('Password') ?></label></th>
 <td>
-<input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" size="40" />
+<input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option('mailserver_pass'); ?>" class="regular-text" />
 </td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="default_email_category"><?php _e('Default Mail Category') ?></label></th>
 </td>
 </tr>
 <tr valign="top">
 <th scope="row"><label for="default_email_category"><?php _e('Default Mail Category') ?></label></th>
-<td><select name="default_email_category" id="default_email_category">
+<td>
 <?php
 <?php
-//Alreay have $categories from default_category
-foreach ($categories as $category) :
-$category = sanitize_category($category);
-if ($category->cat_ID == get_option('default_email_category')) $selected = " selected='selected'";
-else $selected = '';
-echo "\n\t<option value='$category->cat_ID' $selected>$category->cat_name</option>";
-endforeach;
+wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'default_email_category', 'orderby' => 'name', 'selected' => get_option('default_email_category'), 'hierarchical' => true));
 ?>
 ?>
-</select></td>
+</td>
 </tr>
 </tr>
+<?php do_settings_fields('writing', 'post_via_email'); ?>
 </table>
 
 <h3><?php _e('Update Services') ?></h3>
 </table>
 
 <h3><?php _e('Update Services') ?></h3>
@@ -120,7 +116,7 @@ endforeach;
 
 <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" style="width: 98%;" rows="3" cols="50"><?php form_option('ping_sites'); ?></textarea>
+<textarea name="ping_sites" id="ping_sites" class="large-text" rows="3"><?php form_option('ping_sites'); ?></textarea>
 
 <?php else : ?>
 
 
 <?php else : ?>
 
@@ -128,10 +124,10 @@ endforeach;
 
 <?php endif; ?>
 
 
 <?php endif; ?>
 
+<?php do_settings_sections('writing'); ?>
+
 <p class="submit">
 <p class="submit">
-<input type="hidden" name="action" value="update" />
-<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category,enable_app,enable_xmlrpc" />
-<input type="submit" name="Submit" value="<?php _e('Save Changes') ?>" />
+       <input type="submit" name="Submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
 </p>
 </form>
 </div>
 </p>
 </form>
 </div>
index 7f158db4d6fda600c6ef1804eed54b529828219f..ad048ca889a4f847b69704efa48422ed15499f1c 100644 (file)
@@ -1,4 +1,18 @@
 <?php
 <?php
+/**
+ * Options Management Administration Panel.
+ *
+ * Just allows for displaying of options.
+ *
+ * This isn't referenced or linked to, but will show all of the options and
+ * allow editing. The issue is that serialized data is not supported to be
+ * modified. Options can not be removed.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __('Settings');
 require_once('admin.php');
 
 $title = __('Settings');
@@ -7,47 +21,78 @@ $parent_file = 'options-general.php';
 
 wp_reset_vars(array('action'));
 
 
 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' ),
+       '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' ),
+       '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' ),
+       'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),
+       'options' => array( '' ) );
+if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl';
+if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home';
+
+$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
+
 if ( !current_user_can('manage_options') )
        wp_die(__('Cheatin&#8217; uh?'));
 
 switch($action) {
 
 case 'update':
 if ( !current_user_can('manage_options') )
        wp_die(__('Cheatin&#8217; uh?'));
 
 switch($action) {
 
 case 'update':
-       $any_changed = 0;
+       if ( isset($_POST[ 'option_page' ]) ) {
+               $option_page = $_POST[ 'option_page' ];
+               check_admin_referer( $option_page . '-options' );
+       } else {
+               // This is for back compat and will eventually be removed.
+               $option_page = 'options';
+               check_admin_referer( 'update-options' );
+       }
 
 
-       check_admin_referer('update-options');
+       if ( !isset( $whitelist_options[ $option_page ] ) )
+               wp_die( __( 'Error! Options page not found.' ) );
 
 
-       if ( !$_POST['page_options'] ) {
-               foreach ( (array) $_POST as $key => $value) {
-                       if ( !in_array($key, array('_wpnonce', '_wp_http_referer')) )
-                               $options[] = $key;
-               }
+       if ( 'options' == $option_page ) {
+               $options = explode(',', stripslashes( $_POST[ 'page_options' ] ));
        } else {
        } else {
-               $options = explode(',', stripslashes($_POST['page_options']));
+               $options = $whitelist_options[ $option_page ];
+       }
+
+       // Handle custom date/time formats
+       if ( 'general' == $option_page ) {
+               if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['date_format'] ) )
+                       $_POST['date_format'] = $_POST['date_format_custom'];
+               if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == stripslashes( $_POST['time_format'] ) )
+                       $_POST['time_format'] = $_POST['time_format_custom'];
        }
 
        }
 
-       if ($options) {
-               foreach ($options as $option) {
+       if ( $options ) {
+               foreach ( $options as $option ) {
                        $option = trim($option);
                        $option = trim($option);
-                       $value = $_POST[$option];
-                       if(!is_array($value))   $value = trim($value);
+                       $value = null;
+                       if ( isset($_POST[$option]) )
+                               $value = $_POST[$option];
+                       if ( !is_array($value) ) $value = trim($value);
                        $value = stripslashes_deep($value);
                        update_option($option, $value);
                }
        }
 
                        $value = stripslashes_deep($value);
                        update_option($option, $value);
                }
        }
 
-       $goback = add_query_arg('updated', 'true', wp_get_referer());
-       wp_redirect($goback);
-    break;
+       $goback = add_query_arg( 'updated', 'true', wp_get_referer() );
+       wp_redirect( $goback );
+       break;
 
 default:
        include('admin-header.php'); ?>
 
 <div class="wrap">
 
 default:
        include('admin-header.php'); ?>
 
 <div class="wrap">
+<?php screen_icon(); ?>
   <h2><?php _e('All Settings'); ?></h2>
   <form name="form" action="options.php" method="post" id="all-options">
   <h2><?php _e('All Settings'); ?></h2>
   <form name="form" action="options.php" method="post" id="all-options">
-  <?php wp_nonce_field('update-options') ?>
+  <?php wp_nonce_field('options-options') ?>
   <input type="hidden" name="action" value="update" />
   <input type="hidden" name="action" value="update" />
+  <input type='hidden' name='option_page' value='options' />
   <table class="form-table">
 <?php
 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
   <table class="form-table">
 <?php
 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
@@ -77,7 +122,7 @@ foreach ( (array) $options as $option) :
 <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>";
 <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='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . attribute_escape($value) . "'$disabled />";
+       else echo "<input class='regular-text $class' type='text' name='$option->option_name' id='$option->option_name' value='" . attribute_escape($value) . "'$disabled />";
 
        echo "</td>
 </tr>";
 
        echo "</td>
 </tr>";
@@ -85,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') ?>" /></p>
+<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>
   </form>
 </div>
 
   </form>
 </div>
 
index f324c3d10faf8fbcc684b4cbc3dcb0e2f356cb6c..05ad92107349cf8dfcd9c87de4462e8f6d2ca5de 100644 (file)
@@ -1,7 +1,15 @@
 <?php
 <?php
+/**
+ * New page administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 require_once('admin.php');
-$title = __('New Page');
-$parent_file = 'post-new.php';
+$title = __('Add New Page');
+$parent_file = 'edit-pages.php';
 $editing = true;
 wp_enqueue_script('autosave');
 wp_enqueue_script('page');
 $editing = true;
 wp_enqueue_script('autosave');
 wp_enqueue_script('page');
@@ -11,20 +19,13 @@ add_thickbox();
 wp_enqueue_script('media-upload');
 wp_enqueue_script('word-count');
 
 wp_enqueue_script('media-upload');
 wp_enqueue_script('word-count');
 
-require_once('admin-header.php');
-?>
-
-<?php if ( (isset($_GET['posted']) && $_GET['posted'])  || isset($_GET['saved'])  ) : ?>
-<div id="message" class="updated fade"><p><strong><?php _e('Page saved.') ?></strong> <a href="edit-pages.php"><?php _e('Manage pages'); ?></a> | <a href="<?php echo get_page_link( isset($_GET['posted']) ? $_GET['posted'] : $_GET['saved'] ); ?>"><?php _e('View page') ; ?></a></p></div>
-<?php endif; ?>
-
-<?php
 if ( current_user_can('edit_pages') ) {
        $action = 'post';
        $post = get_default_page_to_edit();
 
        include('edit-page-form.php');
 }
 if ( current_user_can('edit_pages') ) {
        $action = 'post';
        $post = get_default_page_to_edit();
 
        include('edit-page-form.php');
 }
-?>
 
 
-<?php include('admin-footer.php'); ?>
+include('admin-footer.php');
+
+?>
index 3e8ae30a6586db4524c9c6452b012639a2a4a68b..91918b55969dba2e94a419d10558cbc7811db633 100644 (file)
@@ -1,12 +1,29 @@
 <?php
 <?php
+/**
+ * Edit page administration panel.
+ *
+ * Manage edit page: post, edit, delete, etc.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-$parent_file = 'edit.php';
+$parent_file = 'edit-pages.php';
 $submenu_file = 'edit-pages.php';
 
 wp_reset_vars(array('action'));
 
 $submenu_file = 'edit-pages.php';
 
 wp_reset_vars(array('action'));
 
+/**
+ * Redirect to previous page.
+ *
+ * @param int $page_ID Page ID.
+ */
 function redirect_page($page_ID) {
 function redirect_page($page_ID) {
+       global $action;
+
        $referredby = '';
        if ( !empty($_POST['referredby']) ) {
                $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
        $referredby = '';
        if ( !empty($_POST['referredby']) ) {
                $referredby = preg_replace('|https?://[^/]+|i', '', $_POST['referredby']);
@@ -18,16 +35,27 @@ 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']) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
-               if ( $_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( '_wp_original_http_referer', urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), "page.php?action=edit&post=$page_ID&message=1" );
-               else
-                       $location = "page.php?action=edit&post=$page_ID&message=4";
-       } elseif ($_POST['addmeta']) {
+       } 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['addmeta']) ) {
                $location = add_query_arg( 'message', 2, wp_get_referer() );
                $location = explode('#', $location);
                $location = $location[0] . '#postcustom';
                $location = add_query_arg( 'message', 2, wp_get_referer() );
                $location = explode('#', $location);
                $location = $location[0] . '#postcustom';
-       } elseif ($_POST['deletemeta']) {
+       } elseif ( isset($_POST['deletemeta']) ) {
                $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';
@@ -43,15 +71,16 @@ function redirect_page($page_ID) {
        } elseif ($action == 'editattachment') {
                $location = 'attachments.php';
        } else {
        } elseif ($action == 'editattachment') {
                $location = 'attachments.php';
        } else {
-               $location = "page.php?action=edit&post=$page_ID&message=4";
+               $location = add_query_arg( 'message', 4, get_edit_post_link( $page_ID, 'url' ) );
        }
 
        wp_redirect($location);
 }
 
        }
 
        wp_redirect($location);
 }
 
-if (isset($_POST['deletepost'])) {
-$action = "delete";
-}
+if (isset($_POST['deletepost']))
+       $action = "delete";
+elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
+       $action = 'preview';
 
 switch($action) {
 case 'post':
 
 switch($action) {
 case 'post':
@@ -64,7 +93,7 @@ case 'post':
        break;
 
 case 'edit':
        break;
 
 case 'edit':
-       $title = __('Edit');
+       $title = __('Edit Page');
        $editing = true;
        $page_ID = $post_ID = $p = (int) $_GET['post'];
        $post = get_post_to_edit($page_ID);
        $editing = true;
        $page_ID = $post_ID = $p = (int) $_GET['post'];
        $post = get_post_to_edit($page_ID);
@@ -96,8 +125,6 @@ case 'edit':
                }
        }
 
                }
        }
 
-       require_once('admin-header.php');
-
        if ( !current_user_can('edit_page', $page_ID) )
                die ( __('You are not allowed to edit this page.') );
 
        if ( !current_user_can('edit_page', $page_ID) )
                die ( __('You are not allowed to edit this page.') );
 
@@ -147,13 +174,22 @@ case 'delete':
        }
 
        $sendback = wp_get_referer();
        }
 
        $sendback = wp_get_referer();
-       if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page.php');
+       if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('edit-pages.php?deleted=1');
        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
-       $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
+       else $sendback = add_query_arg('deleted', 1, $sendback);
        wp_redirect($sendback);
        exit();
        break;
 
        wp_redirect($sendback);
        exit();
        break;
 
+case 'preview':
+       check_admin_referer( 'autosave', 'autosavenonce' );
+
+       $url = post_preview();
+
+       wp_redirect($url);
+       exit();
+       break;
+
 default:
        wp_redirect('edit-pages.php');
        exit();
 default:
        wp_redirect('edit-pages.php');
        exit();
index ea87bea0b328c932b2863e7f6665f013fad73c3b..b807de895b7b777363de6cf4a0d1ae74a907fda2 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Edit plugin editor administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __("Edit Plugins");
 require_once('admin.php');
 
 $title = __("Edit Plugins");
@@ -87,13 +95,13 @@ default:
        <?php } ?>
 </div>
 <?php endif; ?>
        <?php } ?>
 </div>
 <?php endif; ?>
- <div class="wrap">
-<div class="bordertitle">
-       <h2><?php _e('Plugin Editor'); ?></h2>
-</div>
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
 <div class="tablenav">
 <div class="alignleft">
 <div class="tablenav">
 <div class="alignleft">
-<big><strong><?php
+<big><?php
        if ( is_plugin_active($file) ) {
                if ( is_writeable($real_file) )
                        echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
        if ( is_plugin_active($file) ) {
                if ( is_writeable($real_file) )
                        echo sprintf(__('Editing <strong>%s</strong> (active)'), $file);
@@ -105,7 +113,7 @@ default:
                else
                        echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
        }
                else
                        echo sprintf(__('Browsing <strong>%s</strong> (inactive)'), $file);
        }
-       ?></strong></big>
+       ?></big>
 </div>
 <br class="clear" />
 </div>
 </div>
 <br class="clear" />
 </div>
@@ -134,9 +142,9 @@ 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' 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='" . __('Update File and Attempt to Reactivate') . "' tabindex='2' />";
                else
                else
-                       echo "<input type='submit' name='submit' value='" . __('Update File') . "' tabindex='2' />";
+                       echo "<input type='submit' name='submit' class='button-primary' value='" . __('Update File') . "' tabindex='2' />";
        ?>
        </p>
 <?php else : ?>
        ?>
        </p>
 <?php else : ?>
diff --git a/wp-admin/plugin-install.php b/wp-admin/plugin-install.php
new file mode 100644 (file)
index 0000000..dde4a30
--- /dev/null
@@ -0,0 +1,74 @@
+<?php
+/**
+ * Install plugin administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once('admin.php');
+
+if ( ! current_user_can('install_plugins') )
+       wp_die(__('You do not have sufficient permissions to install plugins on this blog.'));
+
+include(ABSPATH . 'wp-admin/includes/plugin-install.php');
+
+$title = __('Install Plugins');
+$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();
+$tabs['dashboard'] = __('Start Page'); //TODO: Better name?
+if ( 'search' == $tab )
+       $tabs['search'] = __('Search Results');
+$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.
+
+$tabs = apply_filters('install_plugins_tabs', $tabs );
+$nonmenu_tabs = apply_filters('install_plugins_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_plugins_pre_' . $tab); //Used to override the general interface, Eg, install or plugin information.
+
+include('admin-header.php');
+?>
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $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('plugin-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_plugins_' . $tab, $paged); ?>
+</div>
+<?php
+include('admin-footer.php');
+?>
index 46d2b6115e6a4629fc6481299074ee3a28e97b1f..ab7049198ec58fb1e607f6765477b7a18afcbe75 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Plugins administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $action = '';
 require_once('admin.php');
 
 $action = '';
@@ -9,10 +17,10 @@ foreach( array('activate-selected', 'deactivate-selected', 'delete-selected', 'c
        }
 }
 
        }
 }
 
-if( isset($_GET['action']) )
-       $action = $_GET['action'];
+if( isset($_REQUEST['action']) && !empty($_REQUEST['action']) )
+       $action = $_REQUEST['action'];
 
 
-$plugin = $_REQUEST['plugin'];
+$plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
 
 if( !empty($action) ) {
        switch( $action ) {
 
 if( !empty($action) ) {
        switch( $action ) {
@@ -20,9 +28,9 @@ if( !empty($action) ) {
                        check_admin_referer('activate-plugin_' . $plugin);
                        $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
                        if ( is_wp_error( $result ) )
                        check_admin_referer('activate-plugin_' . $plugin);
                        $result = activate_plugin($plugin, 'plugins.php?error=true&plugin=' . $plugin);
                        if ( is_wp_error( $result ) )
-                               wp_die( $result->get_error_message() );
+                               wp_die($result);
                        $recent = (array)get_option('recently_activated');
                        $recent = (array)get_option('recently_activated');
-                       if( isset($recent[ $plugin ]) ){
+                       if ( isset($recent[ $plugin ]) ) {
                                unset($recent[ $plugin ]);
                                update_option('recently_activated', $recent);
                        }
                                unset($recent[ $plugin ]);
                                update_option('recently_activated', $recent);
                        }
@@ -35,7 +43,7 @@ if( !empty($action) ) {
 
                        $recent = (array)get_option('recently_activated');
                        foreach( (array)$_POST['checked'] as $plugin => $time) {
 
                        $recent = (array)get_option('recently_activated');
                        foreach( (array)$_POST['checked'] as $plugin => $time) {
-                               if( isset($recent[ $plugin ]) )
+                               if ( isset($recent[ $plugin ]) )
                                        unset($recent[ $plugin ]);
                        }
                        if( $recent != get_option('recently_activated') ) //If array changed, update it.
                                        unset($recent[ $plugin ]);
                        }
                        if( $recent != get_option('recently_activated') ) //If array changed, update it.
@@ -52,6 +60,7 @@ if( !empty($action) ) {
                        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);
+                       do_action('activate_' . $plugin);
                        exit;
                        break;
                case 'deactivate':
                        exit;
                        break;
                case 'deactivate':
@@ -65,34 +74,34 @@ if( !empty($action) ) {
                        check_admin_referer('bulk-manage-plugins');
                        deactivate_plugins($_POST['checked']);
                        $deactivated = array();
                        check_admin_referer('bulk-manage-plugins');
                        deactivate_plugins($_POST['checked']);
                        $deactivated = array();
-                       foreach( (array)$_POST['checked'] as $plugin )
+                       foreach ( (array)$_POST['checked'] as $plugin )
                                $deactivated[ $plugin ] = time();
                        update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
                        wp_redirect('plugins.php?deactivate-multi=true');
                        exit;
                        break;
                case 'delete-selected':
                                $deactivated[ $plugin ] = time();
                        update_option('recently_activated', $deactivated + (array)get_option('recently_activated'));
                        wp_redirect('plugins.php?deactivate-multi=true');
                        exit;
                        break;
                case 'delete-selected':
-                       if( ! current_user_can('delete_plugins') )
+                       if ( ! current_user_can('delete_plugins') )
                                wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
                                wp_die(__('You do not have sufficient permissions to delete plugins for this blog.'));
-                       
+
                        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.
                        include(ABSPATH . 'wp-admin/update.php');
 
                        $title = __('Delete Plugin');
                        $parent_file = 'plugins.php';
                        $plugins = $_REQUEST['checked']; //$_POST = from the plugin form; $_GET = from the FTP details screen.
                        include(ABSPATH . 'wp-admin/update.php');
 
                        $title = __('Delete Plugin');
                        $parent_file = 'plugins.php';
-                       
-                       if( ! isset($_REQUEST['verify-delete']) ) {
+
+                       if ( ! isset($_REQUEST['verify-delete']) ) {
                                wp_enqueue_script('jquery');
                                require_once('admin-header.php');
                                ?>
                        <div class="wrap">
                                wp_enqueue_script('jquery');
                                require_once('admin-header.php');
                                ?>
                        <div class="wrap">
-                               <h2><?php _e('Delete Plugin(s)'); ?></h2>               
+                               <h2><?php _e('Delete Plugin(s)'); ?></h2>
                                <?php
                                        $files_to_delete = $plugin_info = array();
                                <?php
                                        $files_to_delete = $plugin_info = array();
-                                       foreach( (array) $plugins as $plugin ) {
-                                               if( '.' == dirname($plugin) ) {
+                                       foreach ( (array) $plugins as $plugin ) {
+                                               if ( '.' == dirname($plugin) ) {
                                                        $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
                                                        if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
                                                                $plugin_info[ $plugin ] = $data;
                                                        $files_to_delete[] = WP_PLUGIN_DIR . '/' . $plugin;
                                                        if( $data = get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin) )
                                                                $plugin_info[ $plugin ] = $data;
@@ -109,23 +118,19 @@ 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>
-                               <p>
                                        <ul>
                                        <ul>
-                                               <?php 
-                                               foreach( $plugin_info as $plugin )
-                                                       echo '<li>', $plugin['Title'], ' ', __('By'), ' ', $plugin['Author'], '</li>';
+                                               <?php
+                                               foreach ( $plugin_info as $plugin )
+                                                       echo '<li>', sprintf(__('%s by %s'), $plugin['Name'], $plugin['Author']), '</li>';
                                                ?>
                                        </ul>
                                                ?>
                                        </ul>
-                               </p>
                                <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;">
                                        <input type="hidden" name="verify-delete" value="1" />
                                        <input type="hidden" name="delete-selected" value="1" />
                                        <?php
                                <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;">
                                        <input type="hidden" name="verify-delete" value="1" />
                                        <input type="hidden" name="delete-selected" value="1" />
                                        <?php
-                                               foreach( (array)$plugins as $plugin ) {
-                                                       $plugin = attribute_escape($plugin);
-                                                       echo "<input type='hidden' name='checked[]' value='$plugin' />";
-                                               }
+                                               foreach ( (array)$plugins as $plugin )
+                                                       echo '<input type="hidden" name="checked[]" value="' . attribute_escape($plugin) . '" />';
                                        ?>
                                        <?php wp_nonce_field('bulk-manage-plugins') ?>
                                        <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
                                        ?>
                                        <?php wp_nonce_field('bulk-manage-plugins') ?>
                                        <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" />
@@ -138,13 +143,11 @@ if( !empty($action) ) {
                                <div id="files-list" style="display:none;">
                                        <ul>
                                        <?php
                                <div id="files-list" style="display:none;">
                                        <ul>
                                        <?php
-                                               foreach( (array)$files_to_delete as $file ) {
-                                                       $file = str_replace(ABSPATH, '', $file);
-                                                       echo "<li>$file</li>";
-                                               }
+                                               foreach ( (array)$files_to_delete as $file )
+                                                       echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>';
                                        ?>
                                        </ul>
                                        ?>
                                        </ul>
-                               </div>                          
+                               </div>
                        </div>
                                <?php
                                require_once('admin-footer.php');
                        </div>
                                <?php
                                require_once('admin-footer.php');
@@ -160,14 +163,15 @@ if( !empty($action) ) {
        }
 }
 
        }
 }
 
-wp_enqueue_script('admin-forms');
+wp_enqueue_script('plugin-install');
+add_thickbox();
 
 $title = __('Manage Plugins');
 require_once('admin-header.php');
 
 $invalid = validate_active_plugins();
 
 $title = __('Manage Plugins');
 require_once('admin-header.php');
 
 $invalid = validate_active_plugins();
-if( !empty($invalid) )
-       foreach($invalid as $plugin_file => $error)
+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'), wp_specialchars($plugin_file), $error->get_error_message()) . '</p></div>';
 ?>
 
@@ -197,7 +201,9 @@ if( !empty($invalid) )
 <?php endif; ?>
 
 <div class="wrap">
 <?php endif; ?>
 
 <div class="wrap">
-<h2><?php _e('Plugin Management'); ?></h2>
+<?php screen_icon(); ?>
+       <h2><?php echo wp_specialchars( $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
 
 <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
 
@@ -205,26 +211,19 @@ $all_plugins = get_plugins();
 $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 = (array) get_option('recently_activated');
 
 //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
+foreach ( $recently_activated as $key => $time )
+       if ( $time + (7*24*60*60) < time() ) //1 week
                unset($recently_activated[ $key ]);
                unset($recently_activated[ $key ]);
-if( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
+if ( $recently_activated != get_option('recently_activated') ) //If array changed, update it.
        update_option('recently_activated', $recently_activated);
 
        update_option('recently_activated', $recently_activated);
 
-$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
+foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
 
 
-foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
-
-       // Sanitize all displayed data
-       $plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags);
-       $plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags);
-       $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags);
-       $plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags);
-       if( ! empty($plugin_data['Author']) )
-               $plugin_data['Description'] .= ' <cite>' . sprintf( __('By %s'), $plugin_data['Author'] ) . '.</cite>';
+       //Translate, Apply Markup, Sanitize HTML
+       $plugin_data = _get_plugin_data_markup_translate($plugin_data, true, true);
 
        //Filter into individual sections
        if ( is_plugin_active($plugin_file) ) {
 
        //Filter into individual sections
        if ( is_plugin_active($plugin_file) ) {
@@ -240,9 +239,15 @@ foreach( (array)$all_plugins as $plugin_file => $plugin_data) {
 ?>
 
 <?php
 ?>
 
 <?php
+/**
+ * @ignore
+ *
+ * @param array $plugins
+ * @param string $context
+ */
 function print_plugins_table($plugins, $context = '') {
 ?>
 function print_plugins_table($plugins, $context = '') {
 ?>
-<table class="widefat" id="<?php echo $context ?>-plugins-table">
+<table class="widefat" cellspacing="0" id="<?php echo $context ?>-plugins-table">
        <thead>
        <tr>
                <th scope="col" class="check-column"><input type="checkbox" /></th>
        <thead>
        <tr>
                <th scope="col" class="check-column"><input type="checkbox" /></th>
@@ -252,26 +257,38 @@ function print_plugins_table($plugins, $context = '') {
                <th scope="col" class="action-links"><?php _e('Action'); ?></th>
        </tr>
        </thead>
                <th scope="col" class="action-links"><?php _e('Action'); ?></th>
        </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>
+       </tr>
+       </tfoot>
+
        <tbody class="plugins">
 <?php
 
        <tbody class="plugins">
 <?php
 
-       if( empty($plugins) ) {
+       if ( empty($plugins) ) {
                echo '<tr>
                        <td colspan="6">' . __('No plugins to show') . '</td>
                </tr>';
        }
                echo '<tr>
                        <td colspan="6">' . __('No plugins to show') . '</td>
                </tr>';
        }
-       foreach( (array)$plugins as $plugin_file => $plugin_data) {
+       foreach ( (array)$plugins as $plugin_file => $plugin_data) {
                $action_links = array();
 
                $action_links = array();
 
-               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') . '" class="delete">' . __('Deactivate') . '</a>';
-               else //Available or Recently deactivated
+               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 ( 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>';
 
                        $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 ( 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>';
 
-               $action_links = apply_filters('plugin_action_links', $action_links, $plugin_file, $plugin_data, $context);
+               $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 );
 
                echo "
        <tr class='$context'>
 
                echo "
        <tr class='$context'>
@@ -279,18 +296,47 @@ function print_plugins_table($plugins, $context = '') {
                <td class='name'>{$plugin_data['Title']}</td>
                <td class='vers'>{$plugin_data['Version']}</td>
                <td class='desc'><p>{$plugin_data['Description']}</p></td>
                <td class='name'>{$plugin_data['Title']}</td>
                <td class='vers'>{$plugin_data['Version']}</td>
                <td class='desc'><p>{$plugin_data['Description']}</p></td>
-               <td class='togl action-links'>";  
+               <td class='togl action-links'>";
                if ( !empty($action_links) )
                        echo implode(' | ', $action_links);
                if ( !empty($action_links) )
                        echo implode(' | ', $action_links);
-               echo '</td> 
+               echo '</td>
        </tr>';
                do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
        </tr>';
                do_action( 'after_plugin_row', $plugin_file, $plugin_data, $context );
+               do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $context );
        }
 ?>
        </tbody>
 </table>
        }
 ?>
        </tbody>
 </table>
-<?php 
+<?php
 } //End print_plugins_table()
 } //End print_plugins_table()
+
+/**
+ * @ignore
+ *
+ * @param string $context
+ */
+function print_plugin_actions($context) {
+?>
+       <div class="alignleft actions">
+               <select name="action">
+                       <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
+       <?php if( 'active' != $context ) : ?>
+                       <option value="activate-selected"><?php _e('Activate'); ?></option>
+       <?php endif; ?>
+       <?php if ( 'active' == $context ) : ?>
+                       <option value="deactivate-selected"><?php _e('Deactivate'); ?></option>
+       <?php endif; ?>
+       <?php if( current_user_can('delete_plugins') && ( 'recent' == $context || 'inactive' == $context ) ) : ?>
+                       <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" />
+       <?php if( 'recent' == $context ) : ?>
+               <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
+       <?php endif; ?>
+       </div>
+<?php
+}
 ?>
 
 <?php if ( ! empty($active_plugins) ) : ?>
 ?>
 
 <?php if ( ! empty($active_plugins) ) : ?>
@@ -299,11 +345,9 @@ function print_plugins_table($plugins, $context = '') {
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 
 <div class="tablenav">
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 
 <div class="tablenav">
-       <div class="alignleft">
-               <input type="submit" name="deactivate-selected" value="<?php _e('Deactivate') ?>" class="button-secondary" />
-       </div>
+<?php print_plugin_actions('active') ?>
 </div>
 </div>
-<br class="clear" />
+<div class="clear"></div>
 <?php print_plugins_table($active_plugins, 'active') ?>
 </form>
 
 <?php print_plugins_table($active_plugins, 'active') ?>
 </form>
 
@@ -317,15 +361,9 @@ function print_plugins_table($plugins, $context = '') {
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 
 <div class="tablenav">
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 
 <div class="tablenav">
-       <div class="alignleft">
-               <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
-<?php if( current_user_can('delete_plugins') ) : ?>
-               <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
-<?php endif; ?>
-               <input type="submit" name="clear-recent-list" value="<?php _e('Clear List') ?>" class="button-secondary" />
-       </div>
+<?php print_plugin_actions('recent') ?>
 </div>
 </div>
-<br class="clear" />
+<div class="clear"></div>
 <?php print_plugins_table($recent_plugins, 'recent') ?>
 </form>
 <?php endif; ?>
 <?php print_plugins_table($recent_plugins, 'recent') ?>
 </form>
 <?php endif; ?>
@@ -336,14 +374,9 @@ function print_plugins_table($plugins, $context = '') {
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 
 <div class="tablenav">
 <?php wp_nonce_field('bulk-manage-plugins') ?>
 
 <div class="tablenav">
-       <div class="alignleft">
-               <input type="submit" name="activate-selected" value="<?php _e('Activate') ?>" class="button-secondary" />
-<?php if( current_user_can('delete_plugins') ) : ?>
-               <input type="submit" name="delete-selected" value="<?php _e('Delete') ?>" class="button-secondary" />
-<?php endif; ?>
-       </div>
+<?php print_plugin_actions('inactive') ?>
 </div>
 </div>
-<br class="clear" />
+<div class="clear"></div>
 <?php print_plugins_table($inactive_plugins, 'inactive') ?>
 </form>
 <?php endif; ?>
 <?php print_plugins_table($inactive_plugins, 'inactive') ?>
 </form>
 <?php endif; ?>
@@ -353,8 +386,9 @@ function print_plugins_table($plugins, $context = '') {
 <?php endif; ?>
 
 <h2><?php _e('Get More Plugins'); ?></h2>
 <?php endif; ?>
 
 <h2><?php _e('Get More Plugins'); ?></h2>
-<p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p>
-<p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p>
+<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>
 
 
 </div>
 
index f1f2da5b9c8edd0a47f0fee40adbca8f65c95326..229f3d06c3c3e5e4b872cfb84950b2ccf14e85f0 100644 (file)
@@ -1,7 +1,15 @@
 <?php
 <?php
+/**
+ * New Post Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Administration Bootstrap */
 require_once('admin.php');
 require_once('admin.php');
-$title = __('Create New Post');
-$parent_file = 'post-new.php';
+$title = __('Add New Post');
+$parent_file = 'edit.php';
 $editing = true;
 wp_enqueue_script('autosave');
 wp_enqueue_script('post');
 $editing = true;
 wp_enqueue_script('autosave');
 wp_enqueue_script('post');
@@ -11,9 +19,8 @@ add_thickbox();
 wp_enqueue_script('media-upload');
 wp_enqueue_script('word-count');
 
 wp_enqueue_script('media-upload');
 wp_enqueue_script('word-count');
 
-require_once ('./admin-header.php');
-
-if ( ! current_user_can('edit_posts') ) { ?>
+if ( ! current_user_can('edit_posts') ) {
+       require_once ('./admin-header.php'); ?>
 <div class="wrap">
 <p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
 You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
 <div class="wrap">
 <p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
 You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br />
@@ -25,15 +32,6 @@ When you&#8217;re promoted, just reload this page and you&#8217;ll be able to bl
        exit();
 }
 
        exit();
 }
 
-if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
-<div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $_GET['posted']; ?>"><?php _e('Edit post'); ?></a></p></div>
-<?php
-endif;
-?>
-
-
-<?php
-
 // Show post form.
 $post = get_default_post_to_edit();
 include('edit-form-advanced.php');
 // Show post form.
 $post = get_default_post_to_edit();
 include('edit-form-advanced.php');
index 0dfb8212fadec2061ab1b24974429f1aaa8c76f4..5f04fa71ff0f7613874c7573dbf28599b5465390 100644 (file)
@@ -1,4 +1,14 @@
 <?php
 <?php
+/**
+ * Edit post administration panel.
+ *
+ * Manage Post actions: post, edit, delete, etc.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $parent_file = 'edit.php';
 require_once('admin.php');
 
 $parent_file = 'edit.php';
@@ -6,6 +16,11 @@ $submenu_file = 'edit.php';
 
 wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
 
 
 wp_reset_vars(array('action', 'safe_mode', 'withcomments', 'posts', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder'));
 
+/**
+ * Redirect to previous page.
+ *
+ * @param int $post_ID Optional. Post ID.
+ */
 function redirect_post($post_ID = '') {
        global $action;
 
 function redirect_post($post_ID = '') {
        global $action;
 
@@ -19,12 +34,26 @@ function redirect_post($post_ID = '') {
        if ( !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
                $location = $_POST['referredby'];
        } elseif ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
        if ( !empty($_POST['mode']) && 'bookmarklet' == $_POST['mode'] ) {
                $location = $_POST['referredby'];
        } elseif ( !empty($_POST['mode']) && 'sidebar' == $_POST['mode'] ) {
-               $location = 'sidebar.php?a=b';
-       } elseif ( isset($_POST['save']) && ( empty($referredby) || $referredby == $referer || 'redo' != $referredby ) ) {
-               if ( $_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( '_wp_original_http_referer', urlencode( stripslashes( $_POST['_wp_original_http_referer'] ) ), "post.php?action=edit&post=$post_ID&message=1" );
-               else
-                       $location = "post.php?action=edit&post=$post_ID&message=4";
+               if ( isset($_POST['saveasdraft']) )
+                       $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['addmeta']) && $_POST['addmeta']) {
                $location = add_query_arg( 'message', 2, wp_get_referer() );
                $location = explode('#', $location);
        } elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
                $location = add_query_arg( 'message', 2, wp_get_referer() );
                $location = explode('#', $location);
@@ -36,16 +65,18 @@ function redirect_post($post_ID = '') {
        } elseif (!empty($referredby) && $referredby != $referer) {
                $location = $_POST['referredby'];
                $location = remove_query_arg('_wp_original_http_referer', $location);
        } elseif (!empty($referredby) && $referredby != $referer) {
                $location = $_POST['referredby'];
                $location = remove_query_arg('_wp_original_http_referer', $location);
-               if ( false !== strpos($location, 'edit.php') )
-                       $location = add_query_arg('posted', $post_ID, $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 ( 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'] ) {
+               $location = "post.php?action=edit&post=$post_ID&message=7";
        } else {
        } else {
-               $location = "post.php?action=edit&post=$post_ID&message=4";
+               $location = add_query_arg( 'message', 4, get_edit_post_link( $post_ID, 'url' ) );
        }
 
        wp_redirect( $location );
        }
 
        wp_redirect( $location );
@@ -53,20 +84,44 @@ function redirect_post($post_ID = '') {
 
 if ( isset( $_POST['deletepost'] ) )
        $action = 'delete';
 
 if ( isset( $_POST['deletepost'] ) )
        $action = 'delete';
+elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
+       $action = 'preview';
 
 switch($action) {
 case 'postajaxpost':
 case 'post':
 
 switch($action) {
 case 'postajaxpost':
 case 'post':
+case 'post-quickpress-publish':
+case 'post-quickpress-save':
        check_admin_referer('add-post');
 
        check_admin_referer('add-post');
 
-       $post_ID = 'post' == $action ? write_post() : edit_post();
+       if ( 'post-quickpress-publish' == $action )
+               $_POST['publish'] = 'publish'; // tell write_post() to publish
+
+       if ( 'post-quickpress-publish' == $action || 'post-quickpress-save' == $action ) {
+               $_POST['comment_status'] = get_option('default_comment_status');
+               $_POST['ping_status'] = get_option('default_ping_status');
+       }
+
+       if ( !empty( $_POST['quickpress_post_ID'] ) ) {
+               $_POST['post_ID'] = (int) $_POST['quickpress_post_ID'];
+               $post_ID = edit_post();
+       } else {
+               $post_ID = 'postajaxpost' == $action ? edit_post() : write_post();
+       }
+
+       if ( 0 === strpos( $action, 'post-quickpress' ) ) {
+               $_POST['post_ID'] = $post_ID;
+               // output the quickpress dashboard widget
+               require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
+               wp_dashboard_quick_press();
+               exit;
+       }
 
        redirect_post($post_ID);
        exit();
        break;
 
 case 'edit':
 
        redirect_post($post_ID);
        exit();
        break;
 
 case 'edit':
-       $title = __('Edit');
        $editing = true;
 
        if ( empty( $_GET['post'] ) ) {
        $editing = true;
 
        if ( empty( $_GET['post'] ) ) {
@@ -89,6 +144,8 @@ case 'edit':
        add_thickbox();
        wp_enqueue_script('media-upload');
        wp_enqueue_script('word-count');
        add_thickbox();
        wp_enqueue_script('media-upload');
        wp_enqueue_script('word-count');
+       wp_enqueue_script( 'admin-comments' );
+       enqueue_comment_hotkeys_js();
 
        if ( current_user_can('edit_post', $post_ID) ) {
                if ( $last = wp_check_post_lock( $post->ID ) ) {
 
        if ( current_user_can('edit_post', $post_ID) ) {
                if ( $last = wp_check_post_lock( $post->ID ) ) {
@@ -103,7 +160,7 @@ case 'edit':
                }
        }
 
                }
        }
 
-       require_once('admin-header.php');
+       $title = __('Edit Post');
 
        if ( !current_user_can('edit_post', $post_ID) )
                die ( __('You are not allowed to edit this post.') );
 
        if ( !current_user_can('edit_post', $post_ID) )
                die ( __('You are not allowed to edit this post.') );
@@ -158,13 +215,22 @@ case 'delete':
        }
 
        $sendback = wp_get_referer();
        }
 
        $sendback = wp_get_referer();
-       if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+       if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('edit.php?deleted=1');
        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
        elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
-       $sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
+       else $sendback = add_query_arg('deleted', 1, $sendback);
        wp_redirect($sendback);
        exit();
        break;
 
        wp_redirect($sendback);
        exit();
        break;
 
+case 'preview':
+       check_admin_referer( 'autosave', 'autosavenonce' );
+
+       $url = post_preview();
+
+       wp_redirect($url);
+       exit();
+       break;
+
 default:
        wp_redirect('edit.php');
        exit();
 default:
        wp_redirect('edit.php');
        exit();
index 8bd6ce28f71c0208ab21bf5fab5ece32db20531b..1823d2173e99ef57b38491fa0072ffe7ecab535e 100644 (file)
@@ -1,62 +1,83 @@
 <?php
 <?php
+/**
+ * Press This Display and Handler.
+ *
+ * @package WordPress
+ * @subpackage Press_This
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 if ( ! current_user_can('publish_posts') ) wp_die( __( 'Cheatin&#8217; uh?' ) );
 
 require_once('admin.php');
 
 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));
 }
 function preg_quote2($string) {
        return str_replace('/', '\/', preg_quote($string));
 }
+
+/**
+ * Convert characters.
+ *
+ * @package WordPress
+ * @subpackage Press_This
+ * @since 2.6.0
+ *
+ * @param string $text
+ * @return string
+ */
 function aposfix($text) {
        $translation_table[chr(34)] = '&quot;';
        $translation_table[chr(38)] = '&';
        $translation_table[chr(39)] = '&apos;';
        return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));
 }
 function aposfix($text) {
        $translation_table[chr(34)] = '&quot;';
        $translation_table[chr(38)] = '&';
        $translation_table[chr(39)] = '&apos;';
        return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($text, $translation_table));
 }
+
+/**
+ * Press It form handler.
+ *
+ * @package WordPress
+ * @subpackage Press_This
+ * @since 2.6.0
+ *
+ * @return int Post ID
+ */
 function press_it() {
        // define some basic variables
 function press_it() {
        // define some basic variables
-       $quick['post_status'] = isset($_REQUEST['publish']) ? 'publish' : 'draft';
+       $quick['post_status'] = 'draft'; // set as draft first
        $quick['post_category'] = $_REQUEST['post_category'];
        $quick['tags_input'] = $_REQUEST['tags_input'];
        $quick['post_category'] = $_REQUEST['post_category'];
        $quick['tags_input'] = $_REQUEST['tags_input'];
-       $quick['post_title'] = $_REQUEST['post_title'];
+       $quick['post_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 = '';
-       switch ( $_REQUEST['post_type'] ) {
-               case 'text':
-               case 'quote':
-                       $content .= $_REQUEST['content'];
-                       break;
-
-               case 'photo':
-                       $content = $_REQUEST['content'];
-
-                       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]);
-                                        
-                                       // 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);
-                               }
+       $content = $_REQUEST['content'];
+
+       if($_REQUEST['photo_src'])
+               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]);
+
+                               // 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);
                        }
 
                        }
 
-                       break;
-
-               case "video":
-                       if($_REQUEST['embed_code']) 
-                               $content .= $_REQUEST['embed_code']."\n\n";
-                       $content .= $_REQUEST['content'];
-                       break;
-               }
-       // set the post_content
+       // set the post_content and status
+       $quick['post_status'] = isset($_REQUEST['publish']) ? 'publish' : 'draft';
        $quick['post_content'] = $content;
        $quick['post_content'] = $content;
-
        // error handling for $post
        if ( is_wp_error($post_ID)) {
                wp_die($id);
        // error handling for $post
        if ( is_wp_error($post_ID)) {
                wp_die($id);
@@ -73,215 +94,236 @@ function press_it() {
 }
 
 // For submitted posts.
 }
 
 // For submitted posts.
-if ( 'post' == $_REQUEST['action'] ) { 
-       check_admin_referer('press-this'); $post_ID = press_it(); ?>
-       <!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 _e('Press This') ?></title>
-       <?php
-               add_thickbox();
-               wp_enqueue_style('press-this');
-               wp_enqueue_style('press-this-ie');
-               wp_enqueue_style( 'colors' );
-               wp_enqueue_script('post');
-
-               do_action('admin_print_styles');
-               do_action('admin_print_scripts');
-               do_action('admin_head');
-       ?>
-       </head>
-       <body class="press-this">
-               <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="post.php?action=edit&amp;post=<?php echo $post_ID; ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>
-               <div id="footer">
-               <p><?php
-               do_action('in_admin_footer', '');
-               $upgrade = apply_filters( 'update_footer', '' );
-               echo __('Thank you for creating with <a href="http://wordpress.org/">WordPress</a>');
-               ?></p>
-               </div>
-               <?php do_action('admin_footer', ''); ?>
-       </body>
-       </html>
-       <?php die;
+if ( 'post' == $_REQUEST['action'] ) {
+       check_admin_referer('press-this');
+       $post_ID = press_it();
+       $posted =  $post_ID;
 }
 
 }
 
-// Ajax Requests
+// Set Variables
 $title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
 $title = wp_specialchars(aposfix(stripslashes($_GET['t'])));
-
 $selection = 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>';
 }
 $selection = 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>';
 }
-
 $url = clean_url($_GET['u']);
 $image = $_GET['i'];
 
 $url = clean_url($_GET['u']);
 $image = $_GET['i'];
 
-if($_REQUEST['ajax'] == 'thickbox') { ?>
-       <script type="text/javascript" charset="utf-8">
-               jQuery('.cancel').click(function() {
-                       tb_remove();
-               });
+if($_REQUEST['ajax']) {
+switch ($_REQUEST['ajax']) {
+       case 'video': ?>
+               <script type="text/javascript" charset="utf-8">
+                       jQuery('.select').click(function() {
+                               append_editor(jQuery('#embed-code').val());
+                               jQuery('#extra_fields').hide();
+                               jQuery('#extra_fields').html('');
+                       });
+                       jQuery('.close').click(function() {
+                               jQuery('#extra_fields').hide();
+                               jQuery('#extra_fields').html('');
+                       });
+               </script>
+               <div class="postbox">
+               <h2><label for="embed-code"><?php _e('Embed Code') ?></label></h2>
+               <div class="inside">
+                       <textarea name="embed-code" id="embed-code" rows="8" cols="40"><?php echo format_to_edit($selection, true); ?></textarea>
+                       <p id="options"><a href="#" class="select button"><?php _e('Insert Video'); ?></a> <a href="#" class="close button"><?php _e('Cancel'); ?></a></p>
+               </div>
+               </div>
+               <?php break;
 
 
-               jQuery('.select').click(function() {
-                       image_selector();
-               });
-       </script>
-       <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
-       <div class="titlewrap">
-               <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
-       </div>
+       case 'photo_thickbox': ?>
+               <script type="text/javascript" charset="utf-8">
+                       jQuery('.cancel').click(function() {
+                               tb_remove();
+                       });
+                       jQuery('.select').click(function() {
+                               image_selector();
+                       });
+               </script>
+               <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);?>"/>
+               </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 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 id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
-<?php die; 
-}
+               <p id="options"><a href="#" class="select button"><?php _e('Insert Image'); ?></a> <a href="#" class="cancel button"><?php _e('Cancel'); ?></a></p>
 
 
-if($_REQUEST['ajax'] == 'thickbox_url') { ?>
-       <script type="text/javascript" charset="utf-8">
-               jQuery('.cancel').click(function() {
-                       tb_remove();
-               });
 
 
-               jQuery('.select').click(function() {
-                       image_selector();
-               });
-       </script>
-       <h3 id="title"><label for="post_title"><?php _e('URL') ?></label></h3>
-       <div class="titlewrap">
-               <input id="this_photo" name="this_photo" class="text" onkeypress="if(event.keyCode==13) image_selector();" />
-       </div>
+               <?php break;
 
 
+       case 'photo_thickbox_url': ?>
+               <script type="text/javascript" charset="utf-8">
+                       jQuery('.cancel').click(function() {
+                               tb_remove();
+                       });
 
 
-       <h3 id="title"><label for="post_title"><?php _e('Description') ?></label></h3>
-       <div class="titlewrap">
-               <input id="this_photo_description" name="photo_description" class="text" onkeypress="if(event.keyCode==13) image_selector();" value="<?php echo attribute_escape($title);?>"/>
-       </div>
+                       jQuery('.select').click(function() {
+                               image_selector();
+                       });
+               </script>
+               <h3 class="tb"><label for="this_photo"><?php _e('URL') ?></label></h3>
+               <div class="titlediv">
+                       <div class="titlewrap">
+                       <input id="this_photo" name="this_photo" class="tbtitle text" onkeypress="if(event.keyCode==13) image_selector();" />
+                       </div>
+               </div>
 
 
-       <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p>
-<?php die; 
-}
 
 
-if($_REQUEST['ajax'] == 'video') { ?>
-       <h2 id="embededcode"><label for="embed_code"><?php _e('Embed Code') ?></label></h2>
-       <div class="titlewrap" >
-               <textarea name="embed_code" id="embed_code" rows="8" cols="40"><?php echo format_to_edit($selection); ?></textarea>
-       </div>
-<?php die;
-}
+               <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);?>"/>
+                       </div>
+               </div>
 
 
-if($_REQUEST['ajax'] == 'photo_images') {
-       function get_images_from_uri($uri) {
-               if( preg_match('/\.(jpg|jpe|jpeg|png|gif)/', $uri) && !strpos($uri,'blogger.com') ) 
-                       return "'".$uri."'";
-
-               $content = wp_remote_fopen($uri);
-               if ( false === $content ) return '';
-
-               $host = parse_url($uri);
-
-               $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))[^<>\'\"]*(\2)([^>\/]*)\/*>/is';
-               preg_match_all($pattern, $content, $matches);
-               
-               if ( empty($matches[1]) ) return '';
-
-               $sources = array();
-               foreach ($matches[3] as $src) {
-                       // if no http in url
-                       if(strpos($src, 'http') === false)
-                               // if it doesn't have a relative uri
-                               if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === true)
-                                       $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
-                               else
-                                       $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
-                       
-                       $sources[] = clean_url($src);
+               <p id="options"><a href="#" class="select"><?php _e('Insert Image'); ?></a> | <a href="#" class="cancel"><?php _e('Cancel'); ?></a></p>
+               <?php break;
+       case 'photo_images':
+               /**
+                * Retrieve all image URLs from given URI.
+                *
+                * @package WordPress
+                * @subpackage Press_This
+                * @since 2.6.0
+                *
+                * @param string $uri
+                * @return string
+                */
+               function get_images_from_uri($uri) {
+                       if( preg_match('/\.(jpg|jpe|jpeg|png|gif)$/', $uri) && !strpos($uri,'blogger.com') )
+                               return "'".$uri."'";
+                       $content = wp_remote_fopen($uri);
+                       if ( false === $content )
+                               return '';
+                       $host = parse_url($uri);
+                       $pattern = '/<img ([^>]*)src=(\"|\')([^<>]+?\.(png|jpeg|jpg|jpe|gif))[^<>\'\"]*(\2)([^>\/]*)\/*>/is';
+                       preg_match_all($pattern, $content, $matches);
+                       if ( empty($matches[0]) )
+                               return '';
+                       $sources = array();
+                       foreach ($matches[3] as $src) {
+                               // if no http in url
+                               if(strpos($src, 'http') === false)
+                                       // if it doesn't have a relative uri
+                                       if( strpos($src, '../') === false && strpos($src, './') === false && strpos($src, '/') === 0)
+                                               $src = 'http://'.str_replace('//','/', $host['host'].'/'.$src);
+                                       else
+                                               $src = 'http://'.str_replace('//','/', $host['host'].'/'.dirname($host['path']).'/'.$src);
+                               $sources[] = clean_url($src);
+                       }
+                       return "'" . implode("','", $sources) . "'";
                }
                }
-               return "'" . implode("','", $sources) . "'";
-       } 
+               $url = urldecode($url);
+               $url = str_replace(' ', '%20', $url);
+               echo 'new Array('.get_images_from_uri($url).')';
 
 
-       $url = urldecode($url);
-       $url = str_replace(' ', '%20', $url);
-       echo 'new Array('.get_images_from_uri($url).')'; 
-die;
-}
+               break;
+
+       case 'photo_js': ?>
+               // gather images and load some default JS
+               var last = null
+               var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
+                       var my_src = eval(
+                               jQuery.ajax({
+                                       type: "GET",
+                                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+                                       cache : false,
+                                       async : false,
+                                       data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
+                                       dataType : "script"
+                               }).responseText
+                       );
+                       if(my_src.length == 0) {
+                               var my_src = eval(
+                               jQuery.ajax({
+                                       type: "GET",
+                                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
+                                       cache : false,
+                                       async : false,
+                                       data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
+                                       dataType : "script"
+                               }).responseText
+                               );
+                               if(my_src.length == 0) {
+                                       strtoappend = '<?php _e('Unable to retrieve images or no images on page.'); ?>';
+                               }
+                       }
+
+               for (i = 0; i < my_src.length; i++) {
+                       img = new Image();
+                       img.src = my_src[i];
+                       img_attr = 'id="img' + i + '"';
+                       skip = false;
+
+                       maybeappend = '<a href="?ajax=photo_thickbox&amp;i=' + encodeURIComponent(img.src) + '&amp;u=<?php echo urlencode($url); ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
+
+                       if (img.width && img.height) {
+                               if (img.width >= 30 && img.height >= 30) {
+                                       aspect = img.width / img.height;
+                                       scale = (aspect > 1) ? (71 / img.width) : (71 / img.height);
+
+                                       w = img.width;
+                                       h = img.height;
 
 
-if($_REQUEST['ajax'] == 'photo_js') { ?>
-       // gather images and load some default JS
-       var last = null
-       var img, img_tag, aspect, w, h, skip, i, strtoappend = "";
-       var my_src = eval(
-               jQuery.ajax({
-                       type: "GET",
-                       url: "<?php echo clean_url($_SERVER['PHP_SELF']); ?>",
-                       cache : false,
-                       async : false,
-                       data: "ajax=photo_images&u=<?php echo urlencode($url); ?>",
-                       dataType : "script"
-               }).responseText
-       );
-
-       for (i = 0; i < my_src.length; i++) {
-               img = new Image(); 
-               img.src = my_src[i]; 
-               img_attr = 'id="img' + i + '"'; 
-               skip = false;
-               if (img.width && img.height) {
-                       if (img.width * img.height < 2500) 
-                               skip = true;
-                       aspect = img.width / img.height;
-                       scale = (aspect > 1) ? (75 / img.width) : (75 / img.height);
-
-                       w = img.width;
-                       h = img.height;
-
-                       if (scale < 1) {
-                               w = parseInt(img.width * scale);
-                               h = parseInt(img.height * scale);
+                                       if (scale < 1) {
+                                               w = parseInt(img.width * scale);
+                                               h = parseInt(img.height * scale);
+                                       }
+                                       img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
+                                       strtoappend += maybeappend;
+                               }
+                       } else {
+                               strtoappend += maybeappend;
                        }
                        }
-                       img_attr += ' style="width: ' + w + 'px; height: ' + h + 'px;"';
                }
                }
-               if (!skip) strtoappend += '<a href="?ajax=thickbox&amp;i=' + img.src + '&amp;u=<?php echo $url; ?>&amp;height=400&amp;width=500" title="" class="thickbox"><img src="' + img.src + '" ' + img_attr + '/></a>';
-       }
 
 
-       function pick(img, desc) {
-               if (img) {
-                       if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length;
-                       if(length == 0) length = 1;
-                       jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
-                       jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
-                       append_editor("\n\n" + '<p><img src="' + img +'" alt="' + desc + '" class="aligncenter"/></p>');
+               function pick(img, desc) {
+                       if (img) {
+                               if('object' == typeof jQuery('.photolist input') && jQuery('.photolist input').length != 0) length = jQuery('.photolist input').length;
+                               if(length == 0) length = 1;
+                               jQuery('.photolist').append('<input name="photo_src[' + length + ']" value="' + img +'" type="hidden"/>');
+                               jQuery('.photolist').append('<input name="photo_description[' + length + ']" value="' + desc +'" type="hidden"/>');
+                               insert_editor( "\n\n" + encodeURI('<p style="text-align: center;"><a href="<?php echo $url; ?>"><img src="' + img +'" alt="' + desc + '" /></a></p>'));
+                       }
+                       return false;
                }
                }
-               tinyMCE.activeEditor.resizeToContent();
-               return false;
-       }
-
-       function image_selector() {
-               tb_remove();
-               desc = jQuery('#this_photo_description').val();
-               src = jQuery('#this_photo').val();
-               pick(src, desc);
-               return false;
-       }
 
 
-       jQuery(document).ready(function() {
-               jQuery('#extra_fields').html('<div class="photolist"></div><small id="photo_directions"><?php _e("Click images to select:") ?> <span><a href="#" id="photo_add_url" class="thickbox"><?php _e("Add from URL") ?> +</a></span></small><div class="titlewrap"><div id="img_container"></div></div>');
-               jQuery('#img_container').html(strtoappend);
-               jQuery('#photo_add_url').attr('href', '?ajax=thickbox_url&height=200&width=500');
-               tb_init('a.thickbox, area.thickbox, input.thickbox');
-       });
+               function image_selector() {
+                       tb_remove();
+                       desc = jQuery('#this_photo_description').val();
+                       src = jQuery('#this_photo').val();
+                       pick(src, desc);
+                       jQuery('#extra_fields').hide();
+                       jQuery('#extra_fields').html('');
+                       return false;
+               }
 
 
-<?php die;
-}
+               jQuery(document).ready(function() {
+                       jQuery('#extra_fields').html('<div class="postbox"><h2>Photo <small id="photo_directions">(<?php _e("click images to select") ?>)</small></h2><ul id="actions"><li><a href="#" id="photo_add_url" class="thickbox button"><?php _e("Add from URL") ?> +</a></li></ul><div class="inside"><div class="titlewrap"><div id="img_container"></div></div><p id="options"><a href="#" class="close button"><?php _e('Cancel'); ?></a><a href="#" class="refresh button"><?php _e('Refresh'); ?></a></p></div>');
+                       jQuery('.close').click(function() {
+                               jQuery('#extra_fields').hide();
+                               jQuery('#extra_fields').html('');
+                       });
+                       jQuery('.refresh').click(function() {
+                                               show('photo');
+                                       });
+                       jQuery('#img_container').html(strtoappend);
+                       jQuery('#photo_add_url').attr('href', '?ajax=photo_thickbox_url&height=200&width=500');
+                       tb_init('#extra_fields .thickbox');
 
 
-if($_REQUEST['ajax'] == 'photo') { ?>
 
 
-<?php die;
+               });
+               <?php break;
+}
+die;
 }
 }
+
 ?>
 <!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(); ?>>
 ?>
 <!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(); ?>>
@@ -289,67 +331,26 @@ if($_REQUEST['ajax'] == 'photo') { ?>
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
        <title><?php _e('Press This') ?></title>
 
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
        <title><?php _e('Press This') ?></title>
 
-       <script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js?ver=311"></script>
 <?php
        add_thickbox();
        wp_enqueue_style('press-this');
        wp_enqueue_style('press-this-ie');
        wp_enqueue_style( 'colors' );
 <?php
        add_thickbox();
        wp_enqueue_style('press-this');
        wp_enqueue_style('press-this-ie');
        wp_enqueue_style( 'colors' );
-       wp_enqueue_script('post');
-       wp_enqueue_script('editor_functions');
+       wp_enqueue_script( 'post' );
+       wp_enqueue_script('editor');
 
        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');
+
+       if ( user_can_richedit() ) {
+               add_filter( 'teeny_mce_before_init', create_function( '$a', '$a["height"] = "400"; $a["onpageload"] = ""; $a["mode"] = "textareas"; $a["editor_selector"] = "mceEditor"; return $a;' ) );
+               wp_tiny_mce( true );
+       }
 ?>
        <script type="text/javascript">
 ?>
        <script type="text/javascript">
-       <?php if ( user_can_richedit() ) { 
-               $language = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) );
-               // Add TinyMCE languages
-               @include_once( dirname(__FILE__).'/../wp-includes/js/tinymce/langs/wp-langs.php' );
-               if ( isset($strings) ) echo $strings; ?>
-                       (function() {
-                               var base = tinymce.baseURL, sl = tinymce.ScriptLoader, ln = "<?php echo $language; ?>";
-                               sl.markDone(base + '/langs/' + ln + '.js');
-                               sl.markDone(base + '/themes/advanced/langs/' + ln + '.js');
-                               sl.markDone(base + '/themes/advanced/langs/' + ln + '_dlg.js');
-                       })();
-
-                       tinyMCE.init({
-                               mode: "textareas",
-                               editor_selector: "mceEditor",
-                               language : "<?php echo $language; ?>",
-                               width: "100%",
-                               height: "300",
-                               theme : "advanced",
-                               theme_advanced_buttons1 : "bold,italic,underline,blockquote,separator,strikethrough,bullist,numlist,undo,redo,link,unlink",
-                               theme_advanced_buttons2 : "",
-                               theme_advanced_buttons3 : "",
-                               theme_advanced_toolbar_location : "top",
-                               theme_advanced_toolbar_align : "left",
-                               theme_advanced_statusbar_location : "bottom",
-                               theme_advanced_resizing : true,
-                               theme_advanced_resize_horizontal : false,
-                               skin : "wp_theme",
-                               dialog_type : "modal",
-                               relative_urls : false,
-                               remove_script_host : false,
-                               convert_urls : false,
-                               apply_source_formatting : false,
-                               remove_linebreaks : true,
-                               accessibility_focus : false,
-                               tab_focus : ":next",
-                               plugins : "safari,inlinepopups",
-                               entities : "38,amp,60,lt,62,gt",
-                               force_p_newlines : true,
-                               save_callback : 'switchEditors.saveCallback'
-                       });
-    <?php } ?>
-
     jQuery('#tags-input').hide();
     jQuery('#tags-input').hide();
-
        tag_update_quickclicks();
        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>');
 
        // 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>');
 
@@ -359,59 +360,43 @@ if($_REQUEST['ajax'] == 'photo') { ?>
                        jQuery(this).val( '' ).removeClass( 'form-input-tip' );
        });
        jQuery('#newtag').blur(function() {
                        jQuery(this).val( '' ).removeClass( 'form-input-tip' );
        });
        jQuery('#newtag').blur(function() {
-               if ( this.value == '' ) 
+               if ( this.value == '' )
                        jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
        });
                        jQuery(this).val( postL10n.addTag ).addClass( 'form-input-tip' );
        });
-
        // auto-save tags on post save/publish
        jQuery('#publish').click( tag_save_on_publish );
        // auto-save tags on post save/publish
        jQuery('#publish').click( tag_save_on_publish );
-       jQuery('#save-post').click( tag_save_on_publish );
-
-       function set_menu(type) {
-               jQuery('#text_button').removeClass('ui-tabs-selected');
-               jQuery('#menu li').removeClass('ui-tabs-selected');
-               jQuery('#' + type + '_button').addClass('ui-tabs-selected');
-               jQuery("#post_type").val(type);
+       jQuery('#save').click( tag_save_on_publish );
+       function insert_plain_editor(text) {
+               edCanvas = document.getElementById('content');
+               edInsertContent(edCanvas, text);
        }
        }
-
        function set_editor(text) {
                if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>';
                if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
        }
        function set_editor(text) {
                if ( '' == text || '<p></p>' == text ) text = '<p><br /></p>';
                if ( tinyMCE.activeEditor ) tinyMCE.execCommand('mceSetContent', false, text);
        }
-
+       function insert_editor(text) {
+               if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
+                       tinyMCE.execCommand('mceInsertContent', false, '<p>' + decodeURI(tinymce.DOM.decode(text)) + '</p>', {format : 'raw'});
+               } else {
+                       insert_plain_editor(decodeURI(text));
+               }
+       }
        function append_editor(text) {
        function append_editor(text) {
-               if ( '' != text && tinyMCE.activeEditor ) tinyMCE.execCommand('mceInsertContent', false, text);
+               if ( '' != text && tinyMCE.activeEditor && ! tinyMCE.activeEditor.isHidden()) {
+                       tinyMCE.execCommand('mceSetContent', false, tinyMCE.activeEditor.getContent({format : 'raw'}) + '<p>' + text + '</p>');
+                       tinyMCE.execCommand('mceCleanup');
+               } else {
+                       insert_plain_editor(text);
+               }
        }
 
        }
 
-       function set_title(title) { jQuery("#content_type").text(title); }
-
        function show(tab_name) {
        function show(tab_name) {
-               jQuery('body').removeClass('video_split');
-               jQuery('#extra_fields').hide();
+               jQuery('#extra_fields').html('');
+               jQuery('#extra_fields').show();
                switch(tab_name) {
                switch(tab_name) {
-                       case 'text' :
-                               set_menu('text');
-                               set_title('<?php _e('Post') ?>');
-                               <?php if ($selection) { ?>
-                                       set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</p>');
-                               <?php } else { ?>
-                                       set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
-                               <?php } ?>
-                               return false;
-                               break;
-                       case 'quote' :
-                               set_menu('quote');
-                               set_title('<?php _e('Quote') ?>');
-                               set_editor('<blockquote><?php echo $selection; ?> <p><cite><a href="<?php echo $url; ?>"><?php echo $title; ?> </a> </cite> </p></blockquote>');
-                               return false;
-                               break;
                        case 'video' :
                        case 'video' :
-                               set_menu('video');
-                               set_title('<?php _e('Caption') ?>');
-                               jQuery('#extra_fields').show();
-                               jQuery('body').addClass('video_split');
                                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 clean_url($_SERVER['PHP_SELF']); ?>', { ajax: 'video', s: '<?php echo attribute_escape($selection); ?>'}, function() {
-                                       <?php 
+                                       <?php
                                        $content = '';
                                        if ( preg_match("/youtube\.com\/watch/i", $url) ) {
                                                list($domain, $video_id) = split("v=", $url);
                                        $content = '';
                                        if ( preg_match("/youtube\.com\/watch/i", $url) ) {
                                                list($domain, $video_id) = split("v=", $url);
@@ -428,22 +413,12 @@ if($_REQUEST['ajax'] == 'photo') { ?>
                                                $content = $selection;
                                        }
                                        ?>
                                                $content = $selection;
                                        }
                                        ?>
-                                       jQuery('#embed_code').prepend('<?php echo htmlentities($content); ?>');
-
-                                       set_editor('<a href="<?php echo $url ?>"><?php echo $title; ?></a>.');
+                                       jQuery('#embed-code').prepend('<?php echo htmlentities($content); ?>');
                                });
                                return false;
                                break;
                        case 'photo' :
                                });
                                return false;
                                break;
                        case 'photo' :
-                               set_menu('photo');
-                               set_title('<?php _e('Post') ?>');
-                               <?php if ($selection) { ?>
-                                       set_editor('<?php echo $selection; ?><p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
-                               <?php } else { ?>
-                                       set_editor('<p><a href="<?php echo $url ?>"><?php echo $title; ?></a></p>');
-                               <?php } ?>
-                               jQuery('#extra_fields').show();
-                               jQuery('#extra_fields').before('<h2 id="waiting"><img src="images/loading.gif" alt="" /><?php echo js_escape( __( 'Loading...' ) ); ?></h2>');
+                               jQuery('#extra_fields').before('<p id="waiting"><img src="images/loading.gif" alt="" /> <?php echo js_escape( __( 'Loading...' ) ); ?></p>');
                                jQuery.ajax({
                                        type: "GET",
                                        cache : false,
                                jQuery.ajax({
                                        type: "GET",
                                        cache : false,
@@ -458,14 +433,13 @@ if($_REQUEST['ajax'] == 'photo') { ?>
                                break;
                }
        }
                                break;
                }
        }
-
        jQuery(document).ready(function() {
        jQuery(document).ready(function() {
-       jQuery('#menu li').click(function (){ 
-                       tab_name = this.id.split('_');
-                       tab_name = tab_name[0];
-                       show(tab_name);
-               });
-               // Set default tabs
+               //resize screen
+               window.resizeTo(720,570);
+               // set button actions
+       jQuery('#photo_button').click(function() { show('photo'); return false; });
+               jQuery('#video_button').click(function() { show('video'); return false; });
+               // auto select
                <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
                        show('video');
                <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
                <?php if ( preg_match("/youtube\.com\/watch/i", $url) ) { ?>
                        show('video');
                <?php } elseif ( preg_match("/vimeo\.com\/[0-9]+/i", $url) ) { ?>
@@ -473,64 +447,117 @@ if($_REQUEST['ajax'] == 'photo') { ?>
                <?php  } elseif ( preg_match("/flickr\.com/i", $url) ) { ?>
                        show('photo');
                <?php } ?>
                <?php  } elseif ( preg_match("/flickr\.com/i", $url) ) { ?>
                        show('photo');
                <?php } ?>
+               jQuery('#title').unbind();
+               jQuery('#publish, #save').click(function() { jQuery('#saving').css('display', 'inline'); });
        });
        });
-
 </script>
 </head>
 <body class="press-this">
 </script>
 </head>
 <body class="press-this">
-<div id="wphead">
-       <h1><span id="viewsite"><a href="<?php echo get_option('home'); ?>/"><?php _e('Visit:') ?> <?php bloginfo('name'); ?></a></span></h1>
-</div>
+<div id="wphead"></div>
+<form action="press-this.php?action=post" method="post">
+<div id="poststuff" class="metabox-holder">
+       <div id="side-info-column">
+               <div class="sleeve">
+                       <h1 id="viewsite"><a class="button" href="<?php echo get_option('home'); ?>/" target="_blank"><?php bloginfo('name'); ?> &rsaquo; <?php _e('Press This') ?></a></span></h1>
 
 
-<ul id="menu" class="ui-tabs-nav">
-       <li id="text_button" class="ui-tabs-selected"><a href="#"><?php _e('Text') ?></a></li>
-       <li id="photo_button"><a href="#"><?php _e('Photo') ?></a></li>
-       <li id="quote_button"><a href="#"><?php _e('Quote') ?></a></li>
-       <li id="video_button"><a href="#"><?php _e('Video') ?></a></li>
-</ul>
+                       <?php wp_nonce_field('press-this') ?>
+                       <input type="hidden" name="post_type" id="post_type" value="text"/>
+                       <input type="hidden" name="autosave" id="autosave" />
+                       <input type="hidden" id="original_post_status" name="original_post_status" value="draft" />
+                       <input type="hidden" id="prev_status" name="prev_status" value="draft" />
 
 
-<form action="press-this.php?action=post" method="post">
-       <?php wp_nonce_field('press-this') ?>
-       <input type="hidden" name="post_type" id="post_type" value="text"/>
-       <div id="posting">
-               <h2 id="title"><label for="post_title"><?php _e('Title') ?></label></h2>
-               <div class="titlewrap">
-                       <input name="post_title" id="post_title" class="text" value="<?php echo attribute_escape($title);?>"/>
-               </div>
+                       <!-- This div holds the photo metadata -->
+                       <div class="photolist"></div>
 
 
-               <div id="extra_fields" style="display: none"></div>
+                       <div id="categorydiv" class="stuffbox">
+                               <h2><?php _e('Categories') ?></h2>
+                               <div class="inside">
+
+                                       <div id="categories-all" class="ui-tabs-panel">
+                                               <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
+                                                       <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
+                                               </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" />
+                                                       <?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
+                                                       <span id="category-ajax-response"></span>
+                                               </p>
+                                       </div>
+                               </div>
+                       </div>
 
 
-               <div class="editor_area">
-                       <h2 id="content_type"><label for="content"><?php _e('Post') ?></label></h2>
-                       <div class="editor-container">
-                               <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15"><?php if ($selection) { echo wp_richedit_pre($selection); } ?><a href="<?php echo $url ?>"><?php echo $title; ?></a>.</textarea>
+                       <div class="stuffbox">
+                               <h2><?php _e('Tags') ?></h2>
+                               <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>
+                                       <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>
+                               </div>
                        </div>
                </div>
        </div>
 
                        </div>
                </div>
        </div>
 
-       <div id="categories">
-               <div class="submitbox" id="submitpost">
-                       <div id="previewview"></div>
-                       <div class="inside">
-                               <h2><?php _e('Categories') ?></h2>
-                               <div id="categories-all">
-                                       <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
-                                               <?php wp_category_checklist() ?>
-                                       </ul>
-                               </div>
-                               
-                               <h2><?php _e('Tags') ?></h2>
-                               <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>
+       <div class="posting">
+               <?php if ( isset($posted) && intval($posted) ) { $post_ID = intval($posted); ?>
+               <div id="message" class="updated fade"><p><strong><?php _e('Your post has been saved.'); ?></strong> <a onclick="window.opener.location.replace(this.href); window.close();" href="<?php echo get_permalink( $post_ID); ?>"><?php _e('View post'); ?></a> | <a href="<?php echo get_edit_post_link( $post_ID ); ?>" onclick="window.opener.location.replace(this.href); window.close();"><?php _e('Edit post'); ?></a> | <a href="#" onclick="window.close();"><?php _e('Close Window'); ?></a></p></div>
+               <?php } ?>
+
+               <div id="titlediv">
+                       <div class="titlewrap">
+                               <input name="title" id="title" class="text" value="<?php echo attribute_escape($title);?>"/>
                        </div>
                        </div>
+               </div>
+
+               <div id="extra_fields" style="display: none"></div>
 
 
-                       <p class="submit">         
-                               <input type="submit" name="draft" value="<?php _e('Save') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
-                               <input type="submit" name="publish" value="<?php _e('Publish') ?>" onclick="document.getElementById('photo_saving').style.display = '';"/>
-                               <img src="images/loading-publish.gif" alt="" id="photo_saving" style="display:none;"/>
-                       </p>
+               <div class="postdivrich">
+                       <ul id="actions">
+                               <li id="photo_button">
+                                       Add: <a title="<?php _e('Insert an Image'); ?>" href="#">
+<img alt="<?php _e('Insert an Image'); ?>" src="images/media-button-image.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>
+                               </li>
+                               <?php if( user_can_richedit() ) { ?>
+                               <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>
+                               </li>
+                               <?php } ?>
+                       </ul>
+                       <div id="quicktags"></div>
+                       <div class="editor-container">
+                               <textarea name="content" id="content" style="width:100%;" class="mceEditor" rows="15">
+                                       <?php if ($selection) echo wp_richedit_pre(htmlspecialchars_decode($selection)); ?>
+                                       <?php if ($url) { echo '<p>'; if($selection) _e('via '); echo "<a href='$url'>$title</a>."; echo '</p>'; } ?>
+                               </textarea>
+                       </div>
                </div>
        </div>
                </div>
        </div>
+</div>
 </form>
 </body>
 </form>
 </body>
-</html>
\ No newline at end of file
+</html>
index 685d46c1c3cb28653054c0fef9848ab19a9df4e9..7c30cdfd25e521bc7271a06222076afdf5dd22ce 100644 (file)
@@ -1,4 +1,19 @@
 <?php
 <?php
+/**
+ * User Profile Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * This is a profile page.
+ *
+ * @since unknown
+ * @var bool
+ */
 define('IS_PROFILE_PAGE', true);
 define('IS_PROFILE_PAGE', true);
+
+/** Load User Editing Page */
 require_once('user-edit.php');
 ?>
 require_once('user-edit.php');
 ?>
index 4820abc3c7e048c30f70f870164b2e159077cc5b..c93357cc36cb06d8971999d9457912a5e7fe6150 100644 (file)
@@ -1,8 +1,15 @@
 <?php
 <?php
-
+/**
+ * Revisions administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 require_once('admin.php');
 
-wp_reset_vars(array('revision', 'left', 'right', 'action'));
+wp_reset_vars(array('revision', 'left', 'right', 'diff', 'action'));
 $revision_id = absint($revision);
 $diff        = absint($diff);
 $left        = absint($left);
 $revision_id = absint($revision);
 $diff        = absint($diff);
 $left        = absint($left);
@@ -84,7 +91,7 @@ case 'diff' :
                ( !wp_get_post_revision( $left_revision->ID ) && !wp_get_post_revision( $right_revision->ID ) )
        )
                break;
                ( !wp_get_post_revision( $left_revision->ID ) && !wp_get_post_revision( $right_revision->ID ) )
        )
                break;
-       
+
        $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
        $h2 = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
 
        $post_title = '<a href="' . get_edit_post_link() . '">' . get_the_title() . '</a>';
        $h2 = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
 
@@ -154,7 +161,7 @@ require_once( 'admin-header.php' );
 </tr>
 <?php endif;
 
 </tr>
 <?php endif;
 
-// use get_post_to_edit filters? 
+// use get_post_to_edit filters?
 $identical = true;
 foreach ( _wp_post_revision_fields() as $field => $field_title ) :
        if ( 'diff' == $action ) {
 $identical = true;
 foreach ( _wp_post_revision_fields() as $field => $field_title ) :
        if ( 'diff' == $action ) {
index a23793b980d933f33fa2b295a8249f8085a1d913..467711aa45fa109abc597c47ce8aeedc1b370e62 100644 (file)
-a:link, a:visited {
-       text-decoration:none;
-}
-a:hover {
-       text-decoration:underline;
-}
-.plugins .togl {
-       border-right-width: 0;
-       border-left-width: 1px;
-       border-left-style: solid;
-}
-form#upload th {
-       text-align:left;
-}
+/* 0 - 200
+=================================== */
 td.available-theme {
 td.available-theme {
-       text-align:right;
+       text-align: right;
 }
 #current-theme img {
        float: right;
 }
 #current-theme img {
        float: right;
-       margin-right:0;
+       margin-right: 0;
        margin-left: 1em;
 }
 .quicktags, .search {
        margin-left: 1em;
 }
 .quicktags, .search {
-       font-family: Tahoma;
+       font-family: Tahoma, "Times New Roman";
 }
 }
-/* 201 - 403
+/* 200 - 500
 =================================== */
 =================================== */
-.side-info ul {
-       padding-left:0;
-       padding-right:18px;
+#save-post {
+       float: right;
+}
+.preview {
+       float: left;
 }
 }
-.submit input, .button, .button-secondary, .button-highlighted {
-       font-family: Tahoma;
+#sticky-span {
+       margin-left: 0;
+       margin-right: 18px;
 }
 }
-#wpcontent select  {
-       font-family: Tahoma;
+#post-body .misc-pub-section {
+       border-right-width: 0;
+       border-left-width: 1;
+       border-right-style: none;
+       border-left-style: solid;
+       float: right;
 }
 }
-/* #postdiv, #titlediv, #guiddiv, #poststuff .stuffbox {
-       margin:0 0 0 8px;
-} */
-#quicktags #ed_code {
-       font-family: Tahoma;
+#post-body .misc-pub-section-last {
+       border-left: 0;
 }
 }
-#searchform fieldset {
-       float:right;
-       margin: 0 0 1em 1.5ex;
+#delete-action {
+       text-align: right;
+       float: right;
 }
 }
-#searchform fieldset legend {
-       padding: 0 1px .2em 0;
+#publishing-action {
+       text-align: left;
+       float: left;
+}
+.side-info ul {
+       padding-left: 0;
+       padding-right: 18px;
+}
+.submit input,
+.button,
+.button-primary,
+.button-secondary,
+.button-highlighted,
+#postcustomstuff .submit input {
+       font-family: Tahoma, "Times New Roman";
 }
 }
-#searchform #post-query-submit {
-       float:right;
+#wpcontent select {
+       font-family: Tahoma, "Times New Roman";
 }
 }
-/* 404 - 804
+#quicktags {
+       background-position: right top;
+}
+/* 500 - 700
 =================================== */
 #template div {
 =================================== */
 #template div {
-       margin-right:0;
+       margin-right: 0;
        margin-left: 190px;
 }
 * html #template div {
        margin-left: 0;
 }
 #your-profile legend {
        margin-left: 190px;
 }
 * html #template div {
        margin-left: 0;
 }
 #your-profile legend {
-       font-family:arial;
+       font-family: "Times New Roman", Tahoma;
 }
 #ajax-response.alignleft {
 }
 #ajax-response.alignleft {
-       margin-left:0;
+       margin-left: 0;
        margin-right: 2em;
 }
 .page-numbers {
        margin-right: 2em;
 }
 .page-numbers {
-       margin-right:0;
-       margin-left:3px;
+       margin-right: 0;
+       margin-left: 1px;
 }
 }
-.comment-column {
-       margin-left:0;
-       margin-right: 5px;
+.column-author img, .column-username img {
+       float: right;
+       margin-right: 0;
+       margin-left: 10px;
 }
 .tablenav a.button-secondary {
 }
 .tablenav a.button-secondary {
-       margin: 1px 0 0 8px;
+       margin: 8px 0 0 8px;
 }
 }
-#update-nag, .plugin-update {
-       clear:both;
+.tablenav .tablenav-pages {
+       float: left;
 }
 }
-/* .tablenav .tablenav-pages {
-       float:left;
-} */
-#user_info {
-       right:auto;
-       left:15px;
+.tablenav .displaying-num {
+       margin-right: 0;
+       margin-left: 10px;
+       font-family: Tahoma, "Times New Roman";
+}
+#postcustomstuff table input,
+#postcustomstuff table select,
+#postcustomstuff table textarea {
+       margin: 8px 8px 8px 0;
+}
+/* 700 - 1000
+=================================== */
+#pass-strength-result {
+       float: right;
+       margin: 12px 1px 5px 5px;
 }
 }
-#wphead #viewsite {
-       margin-left:0;
-       margin-right:10px;
+/* Admin Header */
+#user_info {
+       float: left;
 }
 }
-#wphead #viewsite a {
-       font-family: Tahoma;
+#header-logo {
+       float: right;
+       margin: 7px 15px 0 0;
 }
 #wphead h1 {
 }
 #wphead h1 {
-       font-family:arial;
-       margin-right:0;
-       margin-left:15%;
-       padding: 11px 12px 16px 170px;
+       font-family: "Times New Roman", Tahoma;
+       float: right;
 }
 }
-#dashmenu {
-       right:0;
-       left:auto;
-       padding-left:0;
-       padding-right: 9px;
+#wphead h1.long-title {
+       font-family: "Times New Roman", Tahoma;
 }
 }
-#dashmenu a {
-       margin-right:0;
-       margin-left:8px;
+#adminmenu .wp-submenu a {
+       padding-left: 0;
+       padding-right: 12px;
+       border-width: 0 0 0 1px;
+       border-style: none none none solid;
+       font-family: Tahoma, "Times New Roman";
 }
 }
-#adminmenu {
-       padding-left:0;
-       padding-right:11px;
+#adminmenu a.menu-top,
+#adminmenu .wp-submenu-head {
+       font-family: Tahoma, "Times New Roman";
 }
 }
-#adminmenu a {
-       font-family:arial;
-       font-weight:bold;
-       padding:6px 7px;
+#adminmenu img.wp-menu-image {
+       float: right;
 }
 }
-#adminmenu a.current, #sidemenu a.current {
-       font-weight:bold;
+.folded #adminmenu img.wp-menu-image {
+       padding: 7px 6px 0 0;
 }
 }
-#sidemenu {
-       margin: -30px 0 0 15px;
-       float: left;
-       padding-left:0;
+#adminmenu .wp-submenu .wp-submenu-head {
+       padding: 6px 10px 6px 4px;
+}
+.folded #adminmenu .wp-submenu {
+       margin: -1px 28px 0 0;
+}
+.folded #adminmenu .wp-submenu a {
+       padding-left: 0;
        padding-right: 10px;
        padding-right: 10px;
-       height: 1%; /* Peek-a-boo in IE6 */
 }
 }
-#sidemenu a {
-       float:right;
+.folded #adminmenu a.wp-has-submenu {
+       margin-left: 0;
+       margin-right: 40px;
 }
 }
-#submenu li {
-       padding: 0 17px 8px 0;
-       font-size:13px;
+#adminmenu .wp-menu-toggle {
+       float: left;
+       padding: 1px 0 0 2px;
+       clear: left;
 }
 }
-#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
-       right:auto;
-       left:0;
+#adminmenu div.wp-menu-image {
+       float: right;
 }
 }
-#adminmenu li a:hover #awaiting-mod, #sidemenu li a:hover #update-plugins {
-       background-position: -160px top;
+#wphead-info {
+       margin: 0 15px 0 0;
+       padding-right:0;
+       padding-left: 15px;
 }
 }
-/* 804 - 1004
+/* end side admin menu */
+/* 1000 - 1300
 =================================== */
 =================================== */
-#footer {
-       padding: 10px 60px 0 0;
+#adminmenu #awaiting-mod,
+#adminmenu span.update-plugins,
+#sidemenu li a span.update-plugins {
+       font-family: tahoma;
+       margin-left: 0;
+       margin-right: 2px;
+}
+#adminmenu li #awaiting-mod span,
+#adminmenu li span.update-plugins span,
+#sidemenu li a span.update-plugins span {
+       float: right;
+}
+.post-com-count-wrapper {
+       font-family: tahoma;
+}
+.column-response .post-com-count {
+       float: right;
+       margin-right: 0;
+       margin-left: 5px;
 }
 }
-.form-table th {
-       text-align:right;
+/* Tables used on comment.php and option/setting pages */
+.form-table th,
+#wpbody-content .describe th {
+       text-align: right;
 }
 .form-table input.tog {
 }
 .form-table input.tog {
-       margin-right:0;
+       margin-right: 0;
        margin-left: 2px;
        float: right;
 }
 .form-table table.color-palette {
        margin-left: 2px;
        float: right;
 }
 .form-table table.color-palette {
-       float:right;
-}
-#pass-strength-result {
-       float:right;
-       margin-right:0;
-       margin-left: 5px;
+       float: right;
 }
 #profile-page .form-table #rich_editing {
 }
 #profile-page .form-table #rich_editing {
-       margin-right:0;
+       margin-right: 0;
        margin-left: 5px;
 }
        margin-left: 5px;
 }
-#tagsdiv #newtag {
-       margin-right:0;
+/* Post Screen */
+/* 1300 - 1500
+=================================== */
+#normal-sortables .postbox .submit {
+       float: left;
+}
+#post-body #tagsdiv #newtag {
+       margin-right: 0;
        margin-left: 5px;
 }
        margin-left: 5px;
 }
+#post-status-info {
+       padding: 0 7px 0 15px;
+}
+#comment-status-radio input {
+       margin: 2px 0 5px 3px;
+}
 #tagchecklist {
 #tagchecklist {
-       margin-left:0;
+       margin-left: 0;
        margin-right: 10px;
 }
 #tagchecklist strong {
        margin-right: 10px;
 }
 #tagchecklist strong {
-       margin-left:0;
+       margin-left: 0;
        margin-right: -8px;
 }
 #tagchecklist span {
        margin-right: -8px;
 }
 #tagchecklist span {
-       margin-right:0;
-       margin-left: 25px;
        float: right;
 }
 #tagchecklist span a {
        margin: 6px -9px 0 0;
        float: right;
 }
        float: right;
 }
 #tagchecklist span a {
        margin: 6px -9px 0 0;
        float: right;
 }
-/* 1005 - 1304
-=================================== */
 .ac_results li {
 .ac_results li {
-       text-align:right;
+       text-align: right;
 }
 #poststuff h2 {
 }
 #poststuff h2 {
-       clear:right;
+       clear: right;
 }
 }
-#poststuff .postbox, #poststuff .stuffbox, #titlediv, #poststuff .postarea {
-       margin-left: 8px;
-       margin-right: 20px;
+.setting-description, .form-wrap p {
+       font-family: Tahoma, Arial;
+}
+/* 1500 - 1800
+=================================== */
+.meta-box-sortables .postbox .handlediv {
+       float: left;
 }
 }
-#edit-slug-buttons a.save {
-       margin-right:0;
-       margin-left:4px;
+.howto {
+       font-family: Tahoma, Arial;
 }
 }
-#poststuff #edButtonPreview, #poststuff #edButtonHTML {
-       margin: 5px 0 0 8px;
+.postarea h3 label {
+       float: right;
+}
+.postarea #add-media-button {
        float: left;
        float: left;
+       right: auto;
+       left: 10px;
+}
+.wp_themeSkin tr.mceFirst td.mceToolbar {
+       background-position: right top;
 }
 }
-#poststuff #media-buttons {
+#poststuff #edButtonPreview,
+#poststuff #edButtonHTML {
+       margin: 5px 0 0 5px;
        float: left;
        float: left;
-       margin-right:0;
-       margin-left: 20px;
 }
 }
-#poststuff #media-buttons a {
-       padding: 0 2px 2px 5px;
-}
-#poststuff .togbox {
-       margin-left:0;
-       margin-right: -21px;
-       -moz-border-radius-topleft:0;
-       -khtml-border-top-left-radius:0;
-       -webkit-border-top-left-radius:0;
-       border-top-left-radius:0;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-top-right-radius: 3px;
-       -webkit-border-top-right-radius: 3px;
-       border-top-right-radius: 3px;
-       -moz-border-radius-bottomleft: 0;
-       -khtml-border-bottom-left-radius:0;
-       -webkit-border-bottom-left-radius:0;
-       border-bottom-left-radius:0;
-       -moz-border-radius-bottomright: 3px;
-       -khtml-border-bottom-right-radius: 3px;
-       -webkit-border-bottom-right-radius: 3px;
-       border-bottom-right-radius: 3px;
+#poststuff #edButtonHTML {
+       margin-right: 0;
+       margin-left: 15px;
 }
 }
-.submitbox .submitdelete {
-       margin-left:0;
-       margin-right:8px;
+#media-buttons a {
+       padding: 0 10px 5px 0;
 }
 .submitbox .submit {
 }
 .submitbox .submit {
-       text-align:right;
+       text-align: right;
+}
+
+.inside-submitbox #post_status {
+       margin: 2px -2px 2px 0;
 }
 .submitbox .submit input {
 }
 .submitbox .submit input {
-       margin-right:0;
-       margin-left:3px;
+       margin-right: 0;
+       margin-left: 4px;
 }
 }
-#categorydiv #category-adder {
-       margin-left:0;
+/* Categories */
+#category-adder {
+       margin-left: 0;
        margin-right: 120px;
 }
        margin-right: 120px;
 }
-#categorydiv ul#category-tabs {
-       float: right;
-       text-align: left;
-       margin: 0 0 0 -120px;
-}
-ul#category-tabs li.ui-tabs-selected {
-       -moz-border-radius-topleft:0;
-       -khtml-border-top-left-radius:0;
-       -webkit-border-top-left-radius:0;
-       border-top-left-radius:0;
-       -moz-border-radius-bottomleft:0;
-       -khtml-border-bottom-left-radius:0;
-       -webkit-border-bottom-left-radius:0;
-       border-bottom-left-radius:0;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-top-right-radius: 3px;
+#post-body ul#category-tabs li.ui-tabs-selected {
+       -moz-border-radius: 0 3px 3px 0;
+       -webkit-border-top-left-radius: 0;
        -webkit-border-top-right-radius: 3px;
        -webkit-border-top-right-radius: 3px;
-       border-top-right-radius: 3px;
-       -moz-border-radius-bottomright: 3px;
-       -khtml-border-bottom-right-radius: 3px;
+       -webkit-border-bottom-left-radius: 0;
        -webkit-border-bottom-right-radius: 3px;
        -webkit-border-bottom-right-radius: 3px;
+       border-top-left-radius: 0;
+       border-top-right-radius: 3px;
+       border-bottom-left-radius: 0;
        border-bottom-right-radius: 3px;
 }
        border-bottom-right-radius: 3px;
 }
-div.ui-tabs-panel {
-       margin: 0 120px 0 5px;
-}
-/* 1305 - elakh! :-)
-=================================== */
-#categorydiv ul.categorychecklist ul {
-       margin-left:0;
-       margin-right: 18px;
-}
-#linkcategorydiv #category-adder {
-       margin-left:0;
-       margin-right: 120px;
-}
-#linkcategorydiv ul#category-tabs {
+#post-body ul#category-tabs {
        float: right;
        text-align: left;
        margin: 0 0 0 -120px;
 }
        float: right;
        text-align: left;
        margin: 0 0 0 -120px;
 }
+#post-body #categorydiv div.ui-tabs-panel,
+#post-body #linkcategorydiv div.ui-tabs-panel {
+       margin: 0 120px 0 5px;
+}
+/* 1800 - 2000
+=================================== */
+#side-info-column #category-tabs li {
+       padding-right: 0;
+       padding-left: 8px;
+}
+#categorydiv ul.categorychecklist ul,
 #linkcategorydiv ul.categorychecklist ul {
 #linkcategorydiv ul.categorychecklist ul {
-       margin-left:0;
+       margin-left: 0;
        margin-right: 18px;
 }
        margin-right: 18px;
 }
-p#tag-search, p#post-search {
-       right:auto;
-       left:0;
+/* positioning etc. */
+p.search-box {
+       float: left;
 }
 #posts-filter fieldset {
        float: right;
 }
 #posts-filter fieldset {
        float: right;
@@ -309,55 +334,208 @@ p#tag-search, p#post-search {
 #posts-filter fieldset legend {
        padding: 0 1px .2em 0;
 }
 #posts-filter fieldset legend {
        padding: 0 1px .2em 0;
 }
-ul.view-switch {
+.view-switch {
        float: left;
        float: left;
-       margin: -23px 0 -2px 5px;
 }
 }
-ul.view-switch li {
+.filter {
        float: right;
        float: right;
+       margin: -5px 10px 0 0;
 }
 #the-comment-list td.comment p.comment-author {
 }
 #the-comment-list td.comment p.comment-author {
-       margin-right: 0 ;
+       margin-right: 0;
 }
 #the-comment-list p.comment-author img {
        float: right;
 }
 #the-comment-list p.comment-author img {
        float: right;
-       margin-right:0;
+       margin-right: 0;
        margin-left: 8px;
 }
        margin-left: 8px;
 }
-#the-comment-list td.comment p {
-       margin-left:0;
-       margin-right: 8px;
+.tablenav .delete {
+       margin-right: 0;
+       margin-left: 20px;
+}
+td.action-links, th.action-links {
+       text-align: left;
+}
+/* 2000 - 2300
+=================================== */
+.filter .subsubsub {
+       margin-left: 0;
+       margin-right: -10px;
+}
+#wp-word-count {
+       margin-right: 10px;
+}
+.tool-box .title {
+       font-family: "Times New Roman", Tahoma;
+}
+.settings-toggle {
+       text-align: left;
+       margin: 5px 0 15px 7px;
 }
 }
-.curtime {
-       background-position: right 2px;
-       padding-left:0;
+.curtime #timestamp {
+       background-position: right top;
+       padding-left: 0;
        padding-right: 18px;
 }
        padding-right: 18px;
 }
-.tablenav .delete {
-       margin-right:0;
-       margin-left: 20px;
+/* media popup 0819 */
+#sidemenu {
+       margin: -30px 315px 0 15px;
+       float: left;
+       padding-left: 0;
+       padding-right: 10px;
 }
 }
-#tTips {
+#sidemenu a {
+       float: right;
 }
 }
-td.action-links, th.action-links {
-       text-align:left;
+#replysubmit .button {
+       margin-right: 0;
+       margin-left: 5px;
+}
+/* 2300 - 2500
+=================================== */
+#edithead .inside {
+       float: right;
+       margin: 3px 5px 2px 0;
+}
+#replyrow #ed_reply_toolbar input {
+       margin: 1px 1px 1px 2px;
+}
+/* show/hide settings */
+#screen-meta-links {
+       margin: 0 0 0 9px;
 }
 }
-.info-box {
-       left:auto;
-       right: 50%;
+#screen-options-link-wrap,
+#contextual-help-link-wrap {
+       float: left;
+       font-family: Tahoma, "Times New Roman";
+       margin: 0 0 0 6px;
+}
+.metabox-prefs label {
+       padding-right: 0;
+       padding-left: 15px;
+}
+.metabox-prefs label input {
+       margin: 0 2px 0 5px;
+}
+.inline-editor .save,
+.inline-editor .cancel {
+       margin-right: 0;
+       margin-left: 5px;
+}
+/* 2500 - 2700
+=================================== */
+#bulk-titles div a {
+       float: right;
+       margin: 3px -2px 0 3px;
+}
+#wpbody-content .filename {
        margin-left: 0;
        margin-left: 0;
-       margin-right: -225px;
+       margin-right: 10px;
 }
 }
-.info-box .gears-img {
+#wpbody-content .inline-edit-row fieldset {
+       float: right;
+}
+#wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col {
+       border-left: 0 none;
+       border-right: 1px solid;
+}
+#wpbody-content .bulk-edit-row .inline-edit-col-bottom {
        float: left;
 }
        float: left;
 }
-/* LTR
+.inline-edit-row fieldset label span.title {
+       float: right;
+}
+.inline-edit-row fieldset label span.input-text-wrap {
+       margin-left: 0;
+       margin-right: 5em;
+}
+.quick-edit-row-post fieldset.inline-edit-col-right label span.title {
+       padding-right: 0;
+       padding-left: 0.5em;
+}
+#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child {
+       margin-right: 0;
+       margin-left: 0.5em;
+}
+/* 2700 - 3000
 =================================== */
 =================================== */
-#edit-slug-box, #trackback, #metakeyinput, #post_password, #link_url, #link_image, #rss_uri, #category_nicename, #slug, #dbuser, #dbpass, #dbname, #dbprefix, #dccharset, #gmpath, #archivespath, #lastentry, #dbhost, #pages-exclude, #newcontent, #email, #newcomment_author_url, #siteurl, #home, #admin_email, #date_format, #time_format, #gmt_offset, #mailserver_url, #mailserver_port, #mailserver_login, #mailserver_pass, #ping_sites, #posts_per_page, #posts_per_rss, #blog_charset, #moderation_keys, #blacklist_keys, #comment_max_links, #permalink_structure, #category_base, #tag_base, #upload_path, #upload_url_path, #thumbnail_size_w, #thumbnail_size_h, #medium_size_w, #medium_size_h, #user_login, #url, #pass1, #pass2, #aim, #yim, #jabber, #key, #src, #hostname, #username, #password, #rules {
-       direction:ltr;
+.inline-edit-row fieldset span.title,
+.inline-edit-row fieldset span.checkbox-title {
+       font-family: Tahoma, "Times New Roman";
+}
+.inline-edit-row fieldset .inline-edit-date {
+       float: right;
+}
+.inline-edit-row fieldset ul.cat-checklist label,
+.inline-edit-row .catshow,
+.inline-edit-row .cathide,
+.inline-edit-row #bulk-titles div {
+       font-family: Tahoma, "Times New Roman";
+}
+.quick-edit-row-post fieldset label.inline-edit-status {
+       float: right;
+}
+.describe-toggle-on, .describe-toggle-off {
+       float: left;
+       margin-right: 0;
+       margin-left: 20px;
+}
+#wpbody-content #media-items .filename {
+       float: right;
+       margin-left: 0;
+       margin-right: 10px;
+}
+.media-item .pinkynail {
+       float: right;
+}
+#find-posts-response .found-radio {
+       padding: 8px 8px 0 0;
+}
+.find-box-buttons {
+       left: auto;
+       right: 12px;
+}
+.find-box-search label {
+       padding-right: 0;
+       padding-left: 6px;
+}
+/* favorite-actions */
+#favorite-actions {
+       float: left;
+}
+#favorite-first {
+       padding: 3px 12px 4px 30px;
+}
+#favorite-inside {
+}
+#favorite-inside a {
+       padding: 3px 10px 3px 5px;
+}
+#favorite-toggle {
+       right: auto;
+       left: 0;
+       background:transparent url(images/fav-arrow-rtl.gif) no-repeat 10px -4px;
+}
+#utc-time, #local-time {
+       padding-left: 0;
+       padding-right: 25px;
+       font-family: Tahoma, Arial;
+}
+.icon32 {
+       float: right;
+       margin: 14px 0 0 6px;
+}
+.subtitle {
+       padding-left: 0;
+       padding-right: 25px;
 }
 /* TinyMCE
 =================================== */
 .clearlooks2 .mceTop .mceLeft {
        width:100% !important;
 }
 }
 /* TinyMCE
 =================================== */
 .clearlooks2 .mceTop .mceLeft {
        width:100% !important;
 }
+/* ltr
+=================================== */
+#author-email, #author-url, #rss-url-1, #edit-slug-box, #post_name, #trackback_url, #metakeyinput, #post_password, #slug, #category_nicename, #link_url, #link_image, #rss_uri, #menu_order, #email, #newcomment_author_url, #pages-exclude, #template textarea, #user_login, #url, #pass1, #pass2, #aim, #yim, #jabber, #siteurl, #home, #admin_email, #gmt_offset, #default_post_edit_rows, #mailserver_url, #mailserver_login, #mailserver_pass, #mailserver_port, #ping_sites, #posts_per_page, #posts_per_rss, #blog_charset, #close_comments_days_old, #comments_per_page, #comment_max_links, #moderation_keys, #blacklist_keys, #thumbnail_size_w, #thumbnail_size_h, #medium_size_w, #medium_size_h, #large_size_w, #large_size_h, #permalink_structure, #category_base, #tag_base, #upload_path, #upload_url_path, #rules {
+       direction: ltr;
+}
index c12bf4b46411b9ff8ac539ce0d40567ed5c77c12..4b0b564998067fe941f9af3b5dc96e77c91a2257 100644 (file)
@@ -1,9 +1,30 @@
 <?php
 <?php
+/**
+ * Retrieves and creates the wp-config.php file.
+ *
+ * The permissions for the base directory must allow for writing files in order
+ * for the wp-config.php to be created using this page.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * We are installing.
+ *
+ * @package WordPress
+ */
 define('WP_INSTALLING', true);
 define('WP_INSTALLING', true);
-//These three defines are required to allow us to use require_wp_db() to load the database class while being wp-content/wp-db.php aware
+
+/**#@+
+ * These three defines are required to allow us to use require_wp_db() to load
+ * the database class while being wp-content/db.php aware.
+ * @ignore
+ */
 define('ABSPATH', dirname(dirname(__FILE__)).'/');
 define('WPINC', 'wp-includes');
 define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
 define('ABSPATH', dirname(dirname(__FILE__)).'/');
 define('WPINC', 'wp-includes');
 define('WP_CONTENT_DIR', ABSPATH . 'wp-content');
+/**#@-*/
 
 require_once('../wp-includes/compat.php');
 require_once('../wp-includes/functions.php');
 
 require_once('../wp-includes/compat.php');
 require_once('../wp-includes/functions.php');
@@ -22,7 +43,7 @@ if (file_exists('../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>");
 
 // Check if wp-config.php exists above the root directory
        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'))
+if (file_exists('../../wp-config.php') && ! file_exists('../../wp-load.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']))
@@ -30,7 +51,15 @@ if (isset($_GET['step']))
 else
        $step = 0;
 
 else
        $step = 0;
 
-function display_header(){
+/**
+ * Display setup wp-config.php file header.
+ *
+ * @ignore
+ * @since 2.3.0
+ * @package WordPress
+ * @subpackage Installer_WP_Config
+ */
+function display_header() {
        header( 'Content-Type: text/html; charset=utf-8' );
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
        header( 'Content-Type: text/html; charset=utf-8' );
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -38,7 +67,7 @@ function display_header(){
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>WordPress &rsaquo; Setup Configuration File</title>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>WordPress &rsaquo; Setup Configuration File</title>
-<link rel="stylesheet" href="<?php echo $admin_dir; ?>css/install.css" type="text/css" />
+<link rel="stylesheet" href="css/install.css" type="text/css" />
 
 </head>
 <body>
 
 </head>
 <body>
@@ -60,7 +89,7 @@ switch($step) {
        <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
 </ol>
 <p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
        <li>Table prefix (if you want to run more than one WordPress in a single database) </li>
 </ol>
 <p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
-<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;</p>
+<p>In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;</p>
 
 <p class="step"><a href="setup-config.php?step=1" class="button">Let&#8217;s go!</a></p>
 <?php
 
 <p class="step"><a href="setup-config.php?step=1" class="button">Let&#8217;s go!</a></p>
 <?php
@@ -112,10 +141,14 @@ switch($step) {
        if (empty($prefix)) $prefix = 'wp_';
 
        // Test the db connection.
        if (empty($prefix)) $prefix = 'wp_';
 
        // Test the db connection.
+       /**#@+
+        * @ignore
+        */
        define('DB_NAME', $dbname);
        define('DB_USER', $uname);
        define('DB_PASSWORD', $passwrd);
        define('DB_HOST', $dbhost);
        define('DB_NAME', $dbname);
        define('DB_USER', $uname);
        define('DB_PASSWORD', $passwrd);
        define('DB_HOST', $dbhost);
+       /**#@-*/
 
        // We'll fail here if the values are no good.
        require_wp_db();
 
        // We'll fail here if the values are no good.
        require_wp_db();
index 96adee981e9ea4f4f128d763bc9b300f6e6f38de..210c0b9bfdc2b6b4fcbb91bf70547a2a39a539c0 100644 (file)
 <?php
 <?php
+/**
+ * Quick way to create a WordPress Post.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * @var string
+ * @name $mode
+ */
 $mode = 'sidebar';
 
 $mode = 'sidebar';
 
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 if ( ! current_user_can('edit_posts') )
        wp_die(__('Cheatin&#8217; uh?'));
 
 require_once('admin.php');
 
 if ( ! current_user_can('edit_posts') )
        wp_die(__('Cheatin&#8217; uh?'));
 
-if ('b' == $_GET['a']) {
-
-?><!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>
-<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=UTF-8" />
-<title><?php _e('WordPress &#8250; Posted'); ?></title>
-<?php
-wp_admin_css( 'global', true );
-wp_admin_css( 'wp-admin', true );
-wp_admin_css( 'colors', true );
-?>
-</head>
-<body>
-       <p><?php _e('Posted !'); ?></p>
-       <p><?php printf(__('<a href="%s">Click here</a> to post again.'), 'sidebar.php'); ?></p>
-</body>
-</html><?php
-
-} else {
+$post = get_default_post_to_edit();
 
 ?><!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>
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('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">
 <head>
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('blog_charset'); ?>" />
-<title><?php _e('WordPress &#8250; Sidebar'); ?></title>
-<?php
-wp_admin_css( 'global', true );
-wp_admin_css( 'wp-admin', true );
-wp_admin_css( 'colors', true );
-?>
+<title><?php bloginfo('name') ?> &rsaquo; <?php _e('Sidebar'); ?></title>
 <style type="text/css" media="screen">
 <style type="text/css" media="screen">
+body {
+       font-size: 0.9em;
+       margin: 0;
+       padding: 0;
+}
 form {
 form {
-       padding: 3px;
+       padding: 1%;
+}
+.tags-wrap p {
+       font-size: 0.75em;
+       margin-top: 0.4em;
+}
+.button-highlighted, #wphead, label {
+       font-weight: bold;
 }
 }
-.sidebar-categories {
-       display: block;
-       height: 6.6em;
-       overflow: auto;
-       background-color: #f4f4f4;
+#post-title, #tags-input, #content {
+       width: 99%;
+       padding: 2px;
 }
 }
-.sidebar-categories label {
-       font-size: 10px;
-       display: block;
-       width: 90%;
+#wphead {
+       font-size: 1.4em;
+       background-color: #E4F2FD;
+       color: #555555;
+       padding: 0.2em 1%;
+}
+#wphead p {
+       margin: 3px;
+}
+.button {
+       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       padding: 3px 5px;
+       margin-right: 5px;
+       font-size: 0.75em;
+       line-height: 1.5em;
+       border: 1px solid #80b5d0;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
+       cursor: pointer;
+       background-color: #e5e5e5;
+       color: #246;
+}
+.button:hover {
+       border-color: #535353;
+}
+.updated {
+       background-color: #FFFBCC;
+       border: 1px solid #E6DB55;
+       margin-bottom: 1em;
+       padding: 0 0.6em;
+}
+.updated p {
+       margin: 0.6em;
 }
 </style>
 </head>
 <body id="sidebar">
 }
 </style>
 </head>
 <body id="sidebar">
-<h1 id="wphead"><a href="http://wordpress.org/" rel="external">WordPress</a></h1>
+<div id="wphead"><p><?php bloginfo('name') ?> &rsaquo; <?php _e('Sidebar'); ?></p></div>
 <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="mode" value="sidebar" />
 <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="mode" value="sidebar" />
-<?php wp_nonce_field('add-post'); ?>
-<p><label for="post_title"><?php _e('Title:'); ?></label>
-<input type="text" name="post_title" id="post_title" size="20" tabindex="1" style="width: 100%;" />
-</p>
-<p><?php _e('Categories:'); ?>
-<span class="sidebar-categories">
-<?php dropdown_categories(); ?>
-</span>
+<input type="hidden" name="ping_status" value="<?php echo $post->ping_status; ?>" />
+<input type="hidden" name="comment_status" value="<?php echo $post->comment_status; ?>" />
+<?php wp_nonce_field('add-post');
+
+if ( 'b' == $_GET['a'] )
+       echo '<div class="updated"><p>' . __('Post published.') . '</p></div>';
+elseif ( 'c' == $_GET['a'] )
+       echo '<div class="updated"><p>' . __('Post saved.') . '</p></div>';
+?>
+<p>
+<label for="post-title"><?php _e('Title:'); ?></label>
+<input type="text" name="post_title" id="post-title" size="20" tabindex="1" autocomplete="off" value="" />
 </p>
 </p>
+
 <p>
 <p>
-<label for="content">Post:</label>
-<textarea rows="8" cols="12" style="width: 100%" name="content" id="content" tabindex="2"></textarea>
+<label for="content"><?php _e('Post:'); ?></label>
+<textarea rows="8" cols="12" name="content" id="content" style="height:10em;line-height:1.4em;" tabindex="2"></textarea>
 </p>
 </p>
+
+<div class="tags-wrap">
+<label for="tags-input"><?php _e('Tags:') ?></label>
+<input type="text" name="tags_input" id="tags-input" tabindex="3" value="" />
+<p><?php _e('Separate tags with commas'); ?></p>
+</div>
+
 <p>
 <p>
-       <input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft'); ?>" />
+<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" accesskey="s" class="button" value="<?php _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" value="<?php _e('Publish') ?>" class="button button-highlighted" />
+<input name="publish" type="submit" id="publish" tabindex="6" accesskey="p" value="<?php _e('Publish') ?>" class="button button-highlighted" />
 <?php endif; ?>
 </p>
 </div>
 <?php endif; ?>
 </p>
 </div>
@@ -85,6 +126,3 @@ form {
 
 </body>
 </html>
 
 </body>
 </html>
-<?php
-}
-?>
\ No newline at end of file
index fa16d7db760bb22acd86198a4b3a6f961300e5c8..361f26b61c3d258ad740ac46df38df9619aee39c 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Theme editor administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 $title = __("Edit Themes");
 require_once('admin.php');
 
 $title = __("Edit Themes");
@@ -88,12 +96,13 @@ default:
 <?php endif;
 
 $description = get_file_description($file);
 <?php endif;
 
 $description = get_file_description($file);
-$desc_header = ( $description != $file_show ) ? "$description</strong> (%s)" : "%s";
+$desc_header = ( $description != $file_show ) ? "<strong>$description</strong> (%s)" : "%s";
 ?>
 <div class="wrap">
 ?>
 <div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
 <div class="bordertitle">
 <div class="bordertitle">
-       <h2><?php _e('Theme Editor'); ?></h2>
-       <form id="themeselector" name="theme" action="theme-editor.php" method="post">
+       <form id="themeselector" action="theme-editor.php" method="post">
                <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
                <select name="theme" id="theme">
 <?php
                <strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
                <select name="theme" id="theme">
 <?php
@@ -111,7 +120,7 @@ $desc_header = ( $description != $file_show ) ? "$description</strong> (%s)" : "
 </div>
 <div class="tablenav">
 <div class="alignleft">
 </div>
 <div class="tablenav">
 <div class="alignleft">
-<big><strong><?php echo sprintf($desc_header, $file_show); ?></big>
+<big><?php echo sprintf($desc_header, $file_show); ?></big>
 </div>
 <br class="clear" />
 </div>
 </div>
 <br class="clear" />
 </div>
@@ -124,25 +133,47 @@ if ($allowed_files) :
 ?>
        <h4><?php _e('Templates'); ?></h4>
        <ul>
 ?>
        <h4><?php _e('Templates'); ?></h4>
        <ul>
-<?php foreach($themes[$theme]['Template Files'] as $template_file) :
-               $description = get_file_description($template_file);
+<?php
+       $template_mapping = array();
+       $template_dir = $themes[$theme]['Template Dir'];
+       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";
                $filedesc = ( $template_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($template_show)</span></span>" : $filedesc;
                $template_show = basename($template_file);
                $filedesc = ( $description != $template_file ) ? "$description <span class='nonessential'>($template_show)</span>" : "$description";
                $filedesc = ( $template_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($template_show)</span></span>" : $filedesc;
-               ?>
+
+               // If we have two files of the same name prefer the one in the Template Directory
+               // This means that we display the correct files for child themes which overload Templates as well as Styles
+               if( array_key_exists($description, $template_mapping ) ) {
+                       if ( false !== strpos( $template_file, $template_dir ) )  {
+                               $template_mapping[ $description ] = array( $template_file, $filedesc );
+                       }
+               } else {
+                       $template_mapping[ $description ] = array( $template_file, $filedesc );
+               }
+       }
+       ksort( $template_mapping );
+       while ( list( $template_sorted_key, list( $template_file, $filedesc ) ) = each( $template_mapping ) ) :
+       ?>
                <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
                <li><a href="theme-editor.php?file=<?php echo "$template_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
-<?php endforeach; ?>
+<?php endwhile; ?>
        </ul>
        <h4><?php echo _c('Styles|Theme stylesheets in theme editor'); ?></h4>
        <ul>
        </ul>
        <h4><?php echo _c('Styles|Theme stylesheets in theme editor'); ?></h4>
        <ul>
-<?php foreach($themes[$theme]['Stylesheet Files'] as $style_file) :
-               $description = get_file_description($style_file);
+<?php
+       $template_mapping = array();
+       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";
                $filedesc = ( $style_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($style_show)</span></span>" : $filedesc;
                $style_show = basename($style_file);
                $filedesc = ( $description != $style_file ) ? "$description <span class='nonessential'>($style_show)</span>" : "$description";
                $filedesc = ( $style_file == $file ) ? "<span class='highlight'>$description <span class='nonessential'>($style_show)</span></span>" : $filedesc;
+               $template_mapping[ $description ] = array( $style_file, $filedesc );
+       }
+       ksort( $template_mapping );
+       while ( list( $template_sorted_key, list( $style_file, $filedesc ) ) = each( $template_mapping ) ) :
                ?>
                <li><a href="theme-editor.php?file=<?php echo "$style_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
                ?>
                <li><a href="theme-editor.php?file=<?php echo "$style_file"; ?>&amp;theme=<?php echo urlencode($theme) ?>"><?php echo $filedesc ?></a></li>
-<?php endforeach; ?>
+<?php endwhile; ?>
        </ul>
 <?php endif; ?>
 </div>
        </ul>
 <?php endif; ?>
 </div>
@@ -161,7 +192,7 @@ if ($allowed_files) :
 <?php if ( is_writeable($real_file) ) : ?>
                        <p class="submit">
 <?php
 <?php if ( is_writeable($real_file) ) : ?>
                        <p class="submit">
 <?php
-       echo "<input type='submit' name='submit' value='" . __('Update File') . "' tabindex='2' />";
+       echo "<input type='submit' name='submit' class='button-primary' value='" . __('Update File') . "' tabindex='2' />";
 ?>
 </p>
 <?php else : ?>
 ?>
 </p>
 <?php else : ?>
index 22c52cea32b53259971617406085989f57b9a189..15b3e5bfc359b962396767f29fbaeb5eb95b2e3e 100644 (file)
@@ -1,4 +1,12 @@
 <?php
 <?php
+/**
+ * Themes administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 if ( isset($_GET['action']) ) {
 require_once('admin.php');
 
 if ( isset($_GET['action']) ) {
@@ -45,21 +53,62 @@ $start = $offset = ( $page - 1 ) * $per_page;
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',
        'format' => '',
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'pagenum', '%#%' ) . '#themenav',
        'format' => '',
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
        'total' => ceil($theme_total / $per_page),
        'current' => $page
 ));
 
 $themes = array_slice( $themes, $start, $per_page );
 
        'total' => ceil($theme_total / $per_page),
        'current' => $page
 ));
 
 $themes = array_slice( $themes, $start, $per_page );
 
+/**
+ * Check if there is an update for a theme available.
+ *
+ * Will display link, if there is an update available.
+ *
+ * @since 2.7.0
+ *
+ * @param object $theme Theme data object.
+ * @return bool False if no valid info was passed.
+ */
+function theme_update_available( $theme ) {
+       static $themes_update;
+       if ( !isset($themes_update) )
+               $themes_update = get_option('update_themes');
+
+       if ( is_object($theme) && isset($theme->stylesheet) )
+               $stylesheet = $theme->stylesheet;
+       elseif ( is_array($theme) && isset($theme['Stylesheet']) )
+               $stylesheet = $theme['Stylesheet'];
+       else
+               return false; //No valid info passed.
+
+       if ( isset($themes_update->response[ $stylesheet ]) ) {
+               $update = $themes_update->response[ $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);
+
+               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']);
+               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']);
+               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 );
+       }
+}
+
 ?>
 
 <div class="wrap">
 ?>
 
 <div class="wrap">
-<h2><?php _e('Current Theme'); ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
+<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'); ?>" />
 <?php endif; ?>
 <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'); ?>" />
 <?php endif; ?>
-<h3><?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) ; ?></h3>
+<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>
 <?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>
 <p class="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>
@@ -69,17 +118,22 @@ $themes = array_slice( $themes, $start, $per_page );
 <?php if ( $ct->tags ) : ?>
 <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
 <?php endif; ?>
 <?php if ( $ct->tags ) : ?>
 <p><?php _e('Tags:'); ?> <?php echo join(', ', $ct->tags); ?></p>
 <?php endif; ?>
-</div>
+<?php theme_update_available($ct); ?>
 
 
-<h2><?php _e('Available Themes'); ?></h2>
-<br class="clear" />
+</div>
+<div class="clear"></div>
+<h3><?php _e('Available Themes'); ?></h3>
+<div class="clear"></div>
 
 <?php if ( $page_links ) : ?>
 <div class="tablenav">
 
 <?php if ( $page_links ) : ?>
 <div class="tablenav">
-<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
-<br class="clear" />
+<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 * $per_page, $theme_total ) ),
+       number_format_i18n( $theme_total ),
+       $page_links
+); echo $page_links_text; ?></div>
 </div>
 </div>
-<br class="clear" />
 <?php endif; ?>
 
 <?php if ( 1 < $theme_total ) { ?>
 <?php endif; ?>
 
 <?php if ( 1 < $theme_total ) { ?>
@@ -117,7 +171,7 @@ foreach ( $cols as $col => $theme_name ) {
        $screenshot = $themes[$theme_name]['Screenshot'];
        $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
        $preview_link = clean_url( get_option('home') . '/');
        $screenshot = $themes[$theme_name]['Screenshot'];
        $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
        $preview_link = clean_url( get_option('home') . '/');
-       $preview_link = add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link );
+       $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 ) );
        $tags = $themes[$theme_name]['Tags'];
        $thickbox_class = 'thickbox';
        $preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) );
        $tags = $themes[$theme_name]['Tags'];
        $thickbox_class = 'thickbox';
@@ -133,8 +187,9 @@ foreach ( $cols as $col => $theme_name ) {
                <p><?php echo $description; ?></p>
 <?php if ( $tags ) : ?>
                <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
                <p><?php echo $description; ?></p>
 <?php if ( $tags ) : ?>
                <p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
-               <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>
 <?php endif; ?>
 <?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>
                <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>
@@ -148,7 +203,7 @@ foreach ( $cols as $col => $theme_name ) {
 
 <?php if ( $page_links ) : ?>
 <div class="tablenav">
 
 <?php if ( $page_links ) : ?>
 <div class="tablenav">
-<?php echo "<div class='tablenav-pages'>$page_links</div>"; ?>
+<?php echo "<div class='tablenav-pages'>$page_links_text</div>"; ?>
 <br class="clear" />
 </div>
 <?php endif; ?>
 <br class="clear" />
 </div>
 <?php endif; ?>
diff --git a/wp-admin/tools.php b/wp-admin/tools.php
new file mode 100644 (file)
index 0000000..98be1ff
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Turbo Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once('admin.php');
+
+$title = __('Tools');
+wp_enqueue_script( 'wp-gears' );
+
+require_once('admin-header.php');
+
+screen_icon();
+?>
+<div class="wrap">
+<h2><?php echo wp_specialchars( $title ); ?></h2>
+
+<div class="tool-box">
+<?php
+if ( ! $is_opera ) {
+?>
+       <div id="gears-msg1">
+       <h3 class="title"><?php _e('Turbo:'); ?> <?php _e('Speed up WordPress'); ?></h3>
+       <p><?php _e('WordPress now has support for Gears, which adds new features to your web browser.'); ?><br />
+       <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a></p>
+       <p><?php _e('After you install and enable Gears, most of WordPress&#8217; images, scripts, and CSS files will be stored locally on your computer. This speeds up page load time.'); ?></p>
+       <p><strong><?php _e('Don&#8217;t install on a public or shared computer.'); ?></strong></p>
+       <div class="buttons"><button onclick="window.location = 'http://gears.google.com/?action=install&amp;return=<?php echo urlencode( admin_url() ); ?>';" class="button"><?php _e('Install Now'); ?></button></div>
+       </div>
+
+       <div id="gears-msg2" style="display:none;">
+       <h3 class="title"><?php _e('Turbo:'); ?> <?php _e('Gears Status'); ?></h3>
+       <p><?php _e('Gears is installed on this computer, but is not enabled for use with WordPress.'); ?></p>
+       <p><?php _e('To enable it click the button below.'); ?></p>
+       <p><strong><?php _e('Note: Do not enable Gears if this is a public or shared computer!'); ?></strong></p>
+       <div class="buttons"><button class="button" onclick="wpGears.getPermission();"><?php _e('Enable Gears'); ?></button></div>
+       </div>
+
+       <div id="gears-msg3" style="display:none;">
+       <h3 class="title"><?php _e('Turbo:'); ?> <?php _e('Gears Status'); ?></h3>
+       <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.');
+       elseif ( $is_safari )
+               _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
+       else
+               _e('Gears is installed and enabled on this computer. You can disable it from your browser&#8217;s Tools menu.');
+
+       ?></p>
+       <p><?php _e('If there are any errors try disabling Gears, reloading the page, and re-enabling Gears.'); ?></p>
+       <p><?php _e('Local storage status:'); ?> <span id="gears-wait"><span style="color:#f00;"><?php _e('Updating files:'); ?></span> <span id="gears-upd-number"></span></span></p>
+       </div>
+
+       <div id="gears-msg4" style="display:none;">
+       <h3 class="title"><?php _e('Turbo:'); ?> <?php _e('Gears Status'); ?></h3>
+       <p><?php _e('Your browser&#8217;s settings do not permit this website to use Google Gears.'); ?></p>
+       <p><?php
+
+       if ( $is_chrome )
+               _e('To allow it, change the Gears settings in your browser&#8217;s Options, Under the Hood menu and reload this page.');
+       elseif ( $is_safari )
+               _e('To allow it, change the Gears settings in the Safari menu and reload this page.');
+       else
+               _e('To allow it, change the Gears settings in your browser&#8217;s Tools menu and reload this page.');
+
+       ?></p>
+       <p><strong><?php _e('Note: Do not enable Gears if this is a public or shared computer!'); ?></strong></p>
+       </div>
+       <script type="text/javascript">wpGears.message();</script>
+<?php } else {
+       _e('Turbo is not available for your browser.');
+} ?>
+</div>
+
+<?php if ( current_user_can('publish_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>
+       <p class="pressthis"><a href="<?php echo htmlspecialchars( get_shortcut_link() ); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
+</div>
+<?php endif; ?>
+</div>
+<?php
+include('admin-footer.php');
+?>
diff --git a/wp-admin/update-core.php b/wp-admin/update-core.php
new file mode 100644 (file)
index 0000000..2584009
--- /dev/null
@@ -0,0 +1,230 @@
+<?php
+/**
+ * Update Core administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** 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.'));
+
+function list_core_update( $update ) {
+       $version_string = 'en_US' == $update->locale ?
+                       $update->current : sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
+       $current = false;
+       if ( !isset($update->response) || 'latest' == $update->response )
+               $current = true;
+       $submit = __('Upgrade Automatically');
+       $form_action = 'update-core.php?action=do-core-upgrade';
+       if ( 'development' == $update->response ) {
+               $message = __('You are using a development version of WordPress.  You can upgrade to the latest nightly build automatically or download the nightly build and install it manually:');
+               $download = __('Download nightly build');
+       } else {
+               if ( $current ) {
+                       $message = sprintf(__('You have the latest version of WordPress. You do not need to upgrade. However, if you want to re-install version %s, you can do so automatically or download the package and re-install manually:'), $version_string);
+                       $submit = __('Re-install Automatically');
+                       $form_action = 'update-core.php?action=do-core-reinstall';
+               } else {
+                       $message =      sprintf(__('You can upgrade to version %s automatically or download the package and install it manually:'), $version_string);
+               }
+               $download = sprintf(__('Download %s'), $version_string);
+       }
+
+       echo '<p>';
+       echo $message;
+       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;';
+       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" />';
+               else
+                       echo '<input id="undismiss" class="button" type="submit" value="' . attribute_escape(__('Bring back this update')) . '" name="undismiss" />';
+       echo '</p>';
+       echo '</form>';
+
+}
+
+function dismissed_updates() {
+       $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'));
+       ?>
+       <script type="text/javascript">
+
+               jQuery(function($) {
+                       $('dismissed-updates').show();
+                       $('#show-dismissed').toggle(function(){$(this).text('<?php echo $hide_text; ?>');}, function() {$(this).text('<?php echo $show_text; ?>')});
+                       $('#show-dismissed').click(function() { $('#dismissed-updates').toggle('slow');});
+               });
+       </script>
+       <?php
+               echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
+               echo '<ul id="dismissed-updates" class="core-updates dismissed">';
+               foreach( (array) $dismissed as $update) {
+                       echo '<li>';
+                       list_core_update( $update );
+                       echo '</li>';
+               }
+               echo '</ul>';
+       }
+}
+
+/**
+ * Display upgrade WordPress for downloading latest or upgrading automatically form.
+ *
+ * @since 2.7
+ *
+ * @return null
+ */
+function core_upgrade_preamble() {
+       $updates = get_core_updates();
+?>
+       <div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php _e('Upgrade WordPress'); ?></h2>
+<?php
+       if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
+               echo '<h3>';
+               _e('You have the latest version of WordPress. You do not need to upgrade');
+               echo '</h3>';
+       } else {
+               echo '<div class="updated fade"><p>';
+               _e('<strong>Important:</strong> before upgrading, please <a href="http://codex.wordpress.org/WordPress_Backups">backup your database and files</a>.');
+               echo '</p></div>';
+
+               echo '<h3 class="response">';
+               _e( 'There is a new version of WordPress available for upgrade' );
+               echo '</h3>';
+       }
+
+       echo '<ul class="core-updates">';
+       $alternate = true;
+       foreach( (array) $updates as $update ) {
+               $class = $alternate? ' class="alternate"' : '';
+               $alternate = !$alternate;
+               echo "<li $class>";
+               list_core_update( $update );
+               echo '</li>';
+       }
+       echo '</ul>';
+       dismissed_updates();
+       echo '</div>';
+}
+
+
+/**
+ * Upgrade WordPress core display.
+ *
+ * @since 2.7
+ *
+ * @return null
+ */
+function do_core_upgrade( $reinstall = false ) {
+       global $wp_filesystem;
+
+       if ( $reinstall )
+               $url = 'update-core.php?action=do-core-reinstall';
+       else
+               $url = 'update-core.php?action=do-core-upgrade';
+       $url = wp_nonce_url($url, 'upgrade-core');
+       if ( false === ($credentials = request_filesystem_credentials($url)) )
+               return;
+
+       $version = isset( $_POST['version'] )? $_POST['version'] : false;
+       $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
+       $update = find_core_update( $version, $locale );
+       if ( !$update )
+               return;
+
+
+       if ( ! WP_Filesystem($credentials) ) {
+               request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+               return;
+       }
+?>
+       <div class="wrap">
+       <?php screen_icon(); ?>
+       <h2><?php _e('Upgrade WordPress'); ?></h2>
+<?php
+       if ( $wp_filesystem->errors->get_error_code() ) {
+               foreach ( $wp_filesystem->errors->get_error_messages() as $message )
+                       show_message($message);
+               echo '</div>';
+               return;
+       }
+
+       if ( $reinstall )
+               $update->response = 'reinstall';
+
+       $result = wp_update_core($update, 'show_message');
+
+       if ( is_wp_error($result) ) {
+               show_message($result);
+               if ('up_to_date' != $result->get_error_code() )
+                       show_message( __('Installation Failed') );
+       } else {
+               show_message( __('WordPress upgraded successfully') );
+       }
+       echo '</div>';
+}
+
+function do_dismiss_core_update() {
+       $version = isset( $_POST['version'] )? $_POST['version'] : false;
+       $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
+       $update = find_core_update( $version, $locale );
+       if ( !$update )
+               return;
+       dismiss_core_update( $update );
+       wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
+}
+
+function do_undismiss_core_update() {
+       $version = isset( $_POST['version'] )? $_POST['version'] : false;
+       $locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
+       $update = find_core_update( $version, $locale );
+       if ( !$update )
+               return;
+       undismiss_core_update( $version, $locale );
+       wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
+}
+
+$action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
+
+if ( 'upgrade-core' == $action ) {
+       $title = __('Upgrade WordPress');
+       $parent_file = 'tools.php';
+       require_once('admin-header.php');
+       core_upgrade_preamble();
+       include('admin-footer.php');
+} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
+       check_admin_referer('upgrade-core');
+       $title = __('Upgrade WordPress');
+       $parent_file = 'tools.php';
+       // do the (un)dismiss actions before headers,
+       // so that they can redirect
+       if ( isset( $_POST['dismiss'] ) )
+               do_dismiss_core_update();
+       elseif ( isset( $_POST['undismiss'] ) )
+       do_undismiss_core_update();
+       require_once('admin-header.php');
+       if ( 'do-core-reinstall' == $action )
+               $reinstall = true;
+       else
+               $reinstall = false;
+       if ( isset( $_POST['upgrade'] ) )
+               do_core_upgrade($reinstall);
+       include('admin-footer.php');
+
+}?>
index 5fd02e062b7cae510b99d9546f6bc4860e07c83f..a60aa6e4420fc798c8dbd335c01811cd654cfe9a 100644 (file)
@@ -1,6 +1,19 @@
 <?php
 <?php
+/**
+ * Send blog links to pingomatic.com to update.
+ *
+ * You can disable this feature by deleting the option 'use_linksupdate' or
+ * setting the option to false. If no links exist, then no links are sent.
+ *
+ * Snoopy is included, but is not used. Fsockopen() is used instead to send link
+ * URLs.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** Load WordPress Bootstrap */
 require_once('../wp-load.php');
 require_once('../wp-load.php');
-require_once( ABSPATH . 'wp-includes/class-snoopy.php');
 
 if ( !get_option('use_linksupdate') )
        wp_die(__('Feature disabled.'));
 
 if ( !get_option('use_linksupdate') )
        wp_die(__('Feature disabled.'));
@@ -14,31 +27,30 @@ $link_uris = urlencode( join( $link_uris, "\n" ) );
 
 $query_string = "uris=$link_uris";
 
 
 $query_string = "uris=$link_uris";
 
-$http_request  = "POST /updated-batch/ HTTP/1.0\r\n";
-$http_request .= "Host: api.pingomatic.com\r\n";
-$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_option('blog_charset')."\r\n";
-$http_request .= 'Content-Length: ' . strlen($query_string) . "\r\n";
-$http_request .= 'User-Agent: WordPress/' . $wp_version . "\r\n";
-$http_request .= "\r\n";
-$http_request .= $query_string;
-
-$response = '';
-if ( false !== ( $fs = @fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5) ) ) {
-       fwrite($fs, $http_request);
-       while ( !feof($fs) )
-               $response .= fgets($fs, 1160); // One TCP-IP packet
-       fclose($fs);
-
-       $response = explode("\r\n\r\n", $response, 2);
-       $body = trim( $response[1] );
-       $body = str_replace(array("\r\n", "\r"), "\n", $body);
-
-       $returns = explode("\n", $body);
-
-       foreach ($returns as $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;
-}
+$options = array();
+$options['timeout'] = 30;
+$options['body'] = $query_string;
+
+$options['headers'] = array(
+       'content-type' => 'application/x-www-form-urlencoded; charset='.get_option('blog_charset'),
+       'content-length' => strlen( $query_string ),
+);
+
+$response = wp_remote_get('http://api.pingomatic.com/updated-batch/', $options);
+
+if ( is_wp_error( $response ) )
+       wp_die(__('Request Failed.'));
+
+if ( $response['response']['code'] != 200 )
+       wp_die(__('Request Failed.'));
+
+$body = str_replace(array("\r\n", "\r"), "\n", $response['body']);
+$returns = explode("\n", $body);
+
+foreach ($returns as $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;
+
 ?>
 ?>
index c3cd28924a099a5b85a63a8b9567d2049991b9a1..803f50e27d3d0b71f2c9f2461123b7bf58125576 100644 (file)
@@ -1,94 +1,24 @@
 <?php
 <?php
-
+/**
+ * Update Plugin/Theme administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** 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.'));
 
 require_once('admin.php');
 
 if ( ! current_user_can('update_plugins') )
        wp_die(__('You do not have sufficient permissions to update plugins for this blog.'));
 
-function request_filesystem_credentials($form_post, $type = '', $error = false) {
-       $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error);
-       if ( '' !== $req_cred )
-               return $req_cred;
-
-       if ( empty($type) )
-               $type = get_filesystem_method();
-
-       if ( 'direct' == $type )
-               return true;
-               
-       if( ! $credentials = get_option('ftp_credentials') )
-               $credentials = array();
-       // 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['ssl']      = defined('FTP_SSL')  ? FTP_SSL  : ( isset($_POST['ssl'])      ? $_POST['ssl']      : $credentials['ssl']);
-
-       if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) {
-               $stored_credentials = $credentials;
-               unset($stored_credentials['password']);
-               update_option('ftp_credentials', $stored_credentials);
-               return $credentials;
-       }
-       $hostname = '';
-       $username = '';
-       $password = '';
-       $ssl = '';
-       if ( !empty($credentials) )
-               extract($credentials, EXTR_OVERWRITE);
-       if( $error )
-               echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.') . '</p></div>';
-?>
-<form action="<?php echo $form_post ?>" method="post">
-<div class="wrap">
-<h2><?php _e('FTP Connection Information') ?></h2>
-<p><?php _e('To perform the requested update, FTP 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) ?>"<?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>
-<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>
-</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>
-</tr>
-<tr valign="top">
-<th scope="row"><label for="ssl"><?php _e('Use SSL:') ?></label></th>
-<td>
-<select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>>
-<?php
-foreach ( array(0 => __('No'), 1 => __('Yes')) as $key => $value ) :
-       $selected = ($ssl == $value) ? 'selected="selected"' : '';
-       echo "\n\t<option value='$key' $selected>" . $value . '</option>';
-endforeach;
-?>
-</select>
-</td>
-</tr>
-</table>
-<p class="submit">
-<input type="submit" name="submit" value="<?php _e('Proceed'); ?>" />
-</p>
-</div>
-</form>
-<?php
-       return false;
-}
-
-function show_message($message) {
-       if( is_wp_error($message) ){
-               if( $message->get_error_data() )
-                       $message = $message->get_error_message() . ': ' . $message->get_error_data();
-               else 
-                       $message = $message->get_error_message();
-       }
-       echo "<p>$message</p>\n";
-}
-
+/**
+ * Plugin upgrade display.
+ *
+ * @since 2.5
+ *
+ * @param string $plugin Plugin
+ */
 function do_plugin_upgrade($plugin) {
        global $wp_filesystem;
 
 function do_plugin_upgrade($plugin) {
        global $wp_filesystem;
 
@@ -97,7 +27,10 @@ function do_plugin_upgrade($plugin) {
                return;
 
        if ( ! WP_Filesystem($credentials) ) {
                return;
 
        if ( ! WP_Filesystem($credentials) ) {
-               request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
+               $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;
        }
 
                return;
        }
 
@@ -116,13 +49,74 @@ function do_plugin_upgrade($plugin) {
 
        if ( is_wp_error($result) ) {
                show_message($result);
 
        if ( is_wp_error($result) ) {
                show_message($result);
-               show_message( __('Installation Failed') );
+               show_message( __('Plugin upgrade Failed') );
        } else {
        } else {
-               //Result is the new plugin file relative to WP_PLUGIN_DIR
-               show_message( __('Plugin upgraded successfully') );     
+               $plugin_file = $result;
+               show_message( __('Plugin upgraded successfully') );
                if( $result && $was_activated ){
                        show_message(__('Attempting reactivation of the plugin'));
                if( $result && $was_activated ){
                        show_message(__('Attempting reactivation of the plugin'));
-                       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 '<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>';
                }
        }
        echo '</div>';
@@ -130,34 +124,25 @@ function do_plugin_upgrade($plugin) {
 
 if ( isset($_GET['action']) ) {
        $plugin = isset($_GET['plugin']) ? trim($_GET['plugin']) : '';
 
 if ( isset($_GET['action']) ) {
        $plugin = isset($_GET['plugin']) ? trim($_GET['plugin']) : '';
+       $theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
+       $action = isset($_GET['action']) ? $_GET['action'] : '';
 
 
-       if ( 'upgrade-plugin' == $_GET['action'] ) {
+       if ( 'upgrade-plugin' == $action ) {
                check_admin_referer('upgrade-plugin_' . $plugin);
                $title = __('Upgrade Plugin');
                $parent_file = 'plugins.php';
                require_once('admin-header.php');
                do_plugin_upgrade($plugin);
                include('admin-footer.php');
                check_admin_referer('upgrade-plugin_' . $plugin);
                $title = __('Upgrade Plugin');
                $parent_file = 'plugins.php';
                require_once('admin-header.php');
                do_plugin_upgrade($plugin);
                include('admin-footer.php');
-       } elseif ('activate-plugin' == $_GET['action'] ) {
+       } elseif ('activate-plugin' == $action ) {
                check_admin_referer('activate-plugin_' . $plugin);
                if( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
                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'] ); 
+                       wp_redirect( 'update.php?action=activate-plugin&failure=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
                        activate_plugin($plugin);
                        activate_plugin($plugin);
-                       wp_redirect( 'update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] ); 
+                       wp_redirect( 'update.php?action=activate-plugin&success=true&plugin=' . $plugin . '&_wpnonce=' . $_GET['_wpnonce'] );
                        die();
                }
                        die();
                }
-                       ?><!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 _e('Plugin Reactivation'); ?> &#8212; <?php _e('WordPress'); ?></title>
-<?php
-wp_admin_css( 'global', true );
-wp_admin_css( 'colors', true );
-?>
-</head>
-<body>
-<?php
+               iframe_header( __('Plugin Reactivation'), true );
                if( isset($_GET['success']) )
                        echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
 
                if( isset($_GET['success']) )
                        echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
 
@@ -167,7 +152,14 @@ wp_admin_css( 'colors', true );
                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
                        include(WP_PLUGIN_DIR . '/' . $plugin);
                }
                        @ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
                        include(WP_PLUGIN_DIR . '/' . $plugin);
                }
-               echo "</body></html>";
+               iframe_footer();
+       } elseif ( 'upgrade-theme' == $action ) {
+               check_admin_referer('upgrade-theme_' . $theme);
+               $title = __('Upgrade Theme');
+               $parent_file = 'themes.php';
+               require_once('admin-header.php');
+               do_theme_upgrade($theme);
+               include('admin-footer.php');
        }
 }
 
        }
 }
 
index 86b0b75af04284270b616fd4f331d746e7cdc91c..ca14a59c83b09cd6257a64ecceec8b66d154c6f6 100644 (file)
@@ -1,5 +1,13 @@
 <?php
 <?php
-// Deprecated.  Use includes/upgrade.php.
+/**
+ * WordPress Upgrade Functions. Old file, must not be used. Include
+ * wp-admin/includes/upgrade.php instead.
+ *
+ * @deprecated 2.5
+ * @package WordPress
+ * @subpackage Administration
+ */
+
 _deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php' );
 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 ?>
 _deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php' );
 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 ?>
index cf5c30516df12518edb879ce461811d1d7bd84d3..e26a92e367384093bac65cbaa9005fd07eeb7275 100644 (file)
@@ -1,14 +1,38 @@
 <?php
 <?php
+/**
+ * Upgrade WordPress Page.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/**
+ * We are upgrading WordPress.
+ *
+ * @since unknown
+ * @var bool
+ */
 define('WP_INSTALLING', true);
 
 define('WP_INSTALLING', true);
 
+/** Load WordPress Bootstrap */
 require('../wp-load.php');
 require('../wp-load.php');
+
 timer_start();
 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 
 timer_start();
 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
 
-if (isset($_GET['step']))
-       $step = (int) $_GET['step'];
+if ( isset($_GET['step']) )
+       $step = $_GET['step'];
 else
        $step = 0;
 else
        $step = 0;
+
+// Do it.  No output.
+if ( 'upgrade_db' === $step ) {
+       wp_upgrade();
+       die('0');
+}
+
+$step = (int) $step;
+
 @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">
 @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">
@@ -21,7 +45,7 @@ else
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
 
 <body>
 <h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
 
-<?php if ( get_option('db_version') == $wp_db_version ) : ?>
+<?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>
 
 <h2><?php _e('No Upgrade Required'); ?></h2>
 <p><?php _e('Your WordPress database is already up-to-date!'); ?></p>
@@ -68,4 +92,4 @@ endswitch;
 endif;
 ?>
 </body>
 endif;
 ?>
 </body>
-</html>
\ No newline at end of file
+</html>
index cf6c1916cbaeec4e2b1c22c0809c5961ad4c9099..7b57f6495c3f561729c48e6d04238552e848571e 100644 (file)
 <?php
 <?php
+/**
+ * Media Library administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 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.'));
 
-// Handle bulk deletes
-if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
+if ( isset($_GET['find_detached'] ) ) {
        check_admin_referer('bulk-media');
        check_admin_referer('bulk-media');
-       foreach( (array) $_GET['delete'] as $post_id_del ) {
-               $post_del = & get_post($post_id_del);
 
 
-               if ( !current_user_can('delete_post', $post_id_del) )
-                       wp_die( __('You are not allowed to delete this post.') );
+       if ( ! current_user_can('edit_posts') )
+               wp_die( __('You are not allowed to scan for lost attachments.') );
 
 
-               if ( $post_del->post_type == 'attachment' )
-                       if ( ! wp_delete_attachment($post_id_del) )
-                               wp_die( __('Error in deleting...') );
+       $all_posts = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'post' OR post_type = 'page'");
+       $all_att = $wpdb->get_results("SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'attachment'");
+
+       $lost = array();
+       foreach ( (array) $all_att as $att ) {
+               if ( $att->post_parent > 0 && ! in_array($att->post_parent, $all_posts) )
+                       $lost[] = $att->ID;
        }
        }
+       $_GET['detached'] = 1;
+
+} elseif ( isset($_GET['found_post_id']) && isset($_GET['media']) ) {
+       check_admin_referer('bulk-media');
+
+       if ( ! ( $parent_id = (int) $_GET['found_post_id'] ) )
+               return;
+
+       $parent = &get_post($parent_id);
+       if ( !current_user_can('edit_post', $parent_id) )
+               wp_die( __('You are not allowed to edit this post.') );
+
+       $attach = array();
+       foreach( (array) $_GET['media'] as $att_id ) {
+               $att_id = (int) $att_id;
+
+               if ( !current_user_can('edit_post', $att_id) )
+                       continue;
+
+               $attach[] = $att_id;
+       }
+
+       if ( ! empty($attach) ) {
+               $attach = implode(',', $attach);
+               $attached = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ($attach)", $parent_id) );
+       }
+
+       if ( isset($attached) ) {
+               $location = 'upload.php';
+               if ( $referer = wp_get_referer() ) {
+                       if ( false !== strpos($referer, 'upload.php') )
+                               $location = $referer;
+               }
 
 
-       $location = 'upload.php';
-       if ( $referer = wp_get_referer() ) {
-               if ( false !== strpos($referer, 'upload.php') )
-                       $location = $referer;
+               $location = add_query_arg( array( 'detached' => 1, 'attached' => $attached ) , $location );
+               wp_redirect($location);
+               exit;
        }
 
        }
 
-       $location = add_query_arg('message', 2, $location);
-       $location = remove_query_arg('posted', $location);
-       wp_redirect($location);
-       exit;
-} elseif ( !empty($_GET['_wp_http_referer']) ) {
-       wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI'])));
-       exit;
+} elseif ( isset($_GET['action']) && isset($_GET['media']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) {
+       check_admin_referer('bulk-media');
+       $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2'];
+
+       if ( 'delete' == $doaction ) {
+               foreach( (array) $_GET['media'] as $post_id_del ) {
+                       $post_del = & get_post($post_id_del);
+
+                       if ( !current_user_can('delete_post', $post_id_del) )
+                               wp_die( __('You are not allowed to delete this post.') );
+
+                       if ( $post_del->post_type == 'attachment' )
+                               if ( ! wp_delete_attachment($post_id_del) )
+                                       wp_die( __('Error in deleting...') );
+               }
+
+               $location = 'upload.php';
+               if ( $referer = wp_get_referer() ) {
+                       if ( false !== strpos($referer, 'upload.php') )
+                               $location = $referer;
+               }
+
+               $location = add_query_arg('message', 2, $location);
+               $location = remove_query_arg('posted', $location);
+               wp_redirect($location);
+               exit;
+       }
+} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
+        wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
+        exit;
 }
 
 $title = __('Media Library');
 }
 
 $title = __('Media Library');
-$parent_file = 'edit.php';
-wp_enqueue_script( 'admin-forms' );
+$parent_file = 'upload.php';
+
+if ( ! isset( $_GET['paged'] ) || $_GET['paged'] < 1 )
+       $_GET['paged'] = 1;
 
 
-list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
+if ( isset($_GET['detached']) ) {
 
 
-if ( is_singular() )
-       wp_enqueue_script( 'admin-comments' );
+       if ( !empty($lost) ) {
+               $start = ( $_GET['paged'] - 1 ) * 50;
+               $page_links_total = ceil(count($lost) / 50);
+               $lost = implode(',', $lost);
 
 
-require_once('admin-header.php');
+               $orphans = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN ($lost) LIMIT $start, 50" );
+       } else {
+               $start = ( $_GET['paged'] - 1 ) * 25;
+               $orphans = $wpdb->get_results( "SELECT SQL_CALC_FOUND_ROWS * FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent < 1 LIMIT $start, 25" );
+               $page_links_total = ceil($wpdb->get_var( "SELECT FOUND_ROWS()" ) / 25);
+       }
 
 
-if ( !isset( $_GET['paged'] ) )
-       $_GET['paged'] = 1;
+       $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)')),
+                       );
+       $post_mime_types = apply_filters('post_mime_types', $post_mime_types);
 
 
+       $avail_post_mime_types = get_available_post_mime_types('attachment');
+
+       if ( isset($_GET['post_mime_type']) && !array_intersect( (array) $_GET['post_mime_type'], array_keys($post_mime_types) ) )
+               unset($_GET['post_mime_type']);
+
+} else {
+       list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
+}
+
+require_once('admin-header.php'); ?>
+
+<?php
+if ( isset($_GET['posted']) && (int) $_GET['posted'] ) {
+       $_GET['message'] = '1';
+       $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
+}
+
+if ( isset($_GET['attached']) && (int) $_GET['attached'] ) {
+       $attached = (int) $_GET['attached'];
+       $message = sprintf( __ngettext('Reattached %d attachment', 'Reattached %d attachments', $attached), $attached );
+       $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']);
+}
+
+$messages[1] = __('Media attachment updated.');
+$messages[2] = __('Media deleted.');
+$messages[3] = __('Error saving media attachment.');
+
+if ( isset($_GET['message']) && (int) $_GET['message'] ) {
+       $message = $messages[$_GET['message']];
+       $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
+}
 ?>
 
 ?>
 
+<?php do_action('restrict_manage_posts'); ?>
+
 <div class="wrap">
 <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>
 
 
-<form id="posts-filter" action="" method="get">
-<h2><?php
-if ( is_singular() ) {
-       printf(__('Comments on %s'), apply_filters( "the_title", $post->post_title));
-} else {
-       $post_mime_type_label = _c('Manage Media|manage media header');
-       if ( isset($_GET['post_mime_type']) && in_array( $_GET['post_mime_type'], array_keys($post_mime_types) ) )
-        $post_mime_type_label = $post_mime_types[$_GET['post_mime_type']][1];
-       if ( $post_listing_pageable && !is_archive() && !is_search() )
-               $h2_noun = is_paged() ? sprintf(__( 'Previous %s' ), $post_mime_type_label) : sprintf(__('Latest %s'), $post_mime_type_label);
-       else
-               $h2_noun = $post_mime_type_label;
-       // Use $_GET instead of is_ since they can override each other
-       $h2_author = '';
-       $_GET['author'] = (int) $_GET['author'];
-       if ( $_GET['author'] != 0 ) {
-               if ( $_GET['author'] == '-' . $user_ID ) { // author exclusion
-                       $h2_author = ' ' . __('by other authors');
-               } else {
-                       $author_user = get_userdata( get_query_var( 'author' ) );
-                       $h2_author = ' ' . sprintf(__('by %s'), wp_specialchars( $author_user->display_name ));
-               }
-       }
-       $h2_search = isset($_GET['s'])   && $_GET['s']   ? ' ' . sprintf(__('matching &#8220;%s&#8221;'), wp_specialchars( get_search_query() ) ) : '';
-       $h2_cat    = isset($_GET['cat']) && $_GET['cat'] ? ' ' . sprintf( __('in &#8220;%s&#8221;'), single_cat_title('', false) ) : '';
-       $h2_tag    = isset($_GET['tag']) && $_GET['tag'] ? ' ' . sprintf( __('tagged with &#8220;%s&#8221;'), single_tag_title('', false) ) : '';
-       $h2_month  = isset($_GET['m'])   && $_GET['m']   ? ' ' . sprintf( __('during %s'), single_month_title(' ', false) ) : '';
-       printf( _c( '%1$s%2$s%3$s%4$s%5$s%6$s|You can reorder these: 1: Posts, 2: by {s}, 3: matching {s}, 4: in {s}, 5: tagged with {s}, 6: during {s}' ), $h2_noun, $h2_author, $h2_search, $h2_cat, $h2_tag, $h2_month );
+<?php
+if ( isset($message) ) { ?>
+<div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
+<?php
 }
 }
-?></h2>
+?>
 
 <ul class="subsubsub">
 <?php
 $type_links = array();
 $_num_posts = (array) wp_count_attachments();
 
 <ul class="subsubsub">
 <?php
 $type_links = array();
 $_num_posts = (array) wp_count_attachments();
+$_total_posts = array_sum( $_num_posts );
 $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];
-$class = empty($_GET['post_mime_type']) ? ' class="current"' : '';
-$type_links[] = "<li><a href=\"upload.php\"$class>".__('All Types')."</a>";
+               $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>';
 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 ( !empty($_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=\"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( __ngettext( $label[2][0], $label[2][1], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</a>';
 }
 }
-echo implode(' | </li>', $type_links) . '</li>';
+$class = isset($_GET['detached']) ? ' class="current"' : '';
+$type_links[] = '<li><a href="upload.php?detached=1"' . $class . '>' . __('Unattached') . '</a>';
+
+echo implode( " |</li>\n", $type_links) . '</li>';
 unset($type_links);
 ?>
 </ul>
 
 unset($type_links);
 ?>
 </ul>
 
-<?php
-if ( isset($_GET['posted']) && $_GET['posted'] ) : $_GET['posted'] = (int) $_GET['posted']; ?>
-<div id="message" class="updated fade"><p><strong><?php _e('Your media has been saved.'); ?></strong> <a href="<?php echo get_permalink( $_GET['posted'] ); ?>"><?php _e('View media'); ?></a> | <a href="media.php?action=edit&amp;attachment_id=<?php echo $_GET['posted']; ?>"><?php _e('Edit media'); ?></a></p></div>
-<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
-endif;
-
-$messages[1] = __('Media updated.');
-$messages[2] = __('Media deleted.');
-
-if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
-endif;
-?>
-
-<p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Media' ); ?>:</label>
-       <input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
+<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" />
 </p>
        <input type="submit" value="<?php _e( 'Search Media' ); ?>" class="button" />
 </p>
+</form>
 
 
-<?php do_action('restrict_manage_posts'); ?>
-
+<form id="posts-filter" action="" method="get">
 <div class="tablenav">
 <div class="tablenav">
-
 <?php
 <?php
+if ( ! isset($page_links_total) )
+       $page_links_total =  $wp_query->max_num_pages;
+
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'paged', '%#%' ),
        'format' => '',
 $page_links = paginate_links( array(
        'base' => add_query_arg( 'paged', '%#%' ),
        'format' => '',
-       'total' => $wp_query->max_num_pages,
+       'prev_text' => __('&laquo;'),
+       'next_text' => __('&raquo;'),
+       'total' => $page_links_total,
        'current' => $_GET['paged']
 ));
 
        'current' => $_GET['paged']
 ));
 
-if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
-?>
-
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
+if ( $page_links ) : ?>
+<div class="tablenav-pages"><?php $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
+       number_format_i18n( ( $_GET['paged'] - 1 ) * $wp_query->query_vars['posts_per_page'] + 1 ),
+       number_format_i18n( min( $_GET['paged'] * $wp_query->query_vars['posts_per_page'], $wp_query->found_posts ) ),
+       number_format_i18n( $wp_query->found_posts ),
+       $page_links
+); echo $page_links_text; ?></div>
+<?php endif; ?>
+
+<div class="alignleft actions">
+<select name="action" class="select-action">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<option value="delete"><?php _e('Delete'); ?></option>
+<?php if ( isset($orphans) ) { ?>
+<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" />
 <?php wp_nonce_field('bulk-media'); ?>
 <?php wp_nonce_field('bulk-media'); ?>
-<?php
 
 
-if ( !is_singular() ) :
+<?php
+if ( ! is_singular() && ! isset($_GET['detached']) ) {
        $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
 
        $arc_result = $wpdb->get_results( $arc_query );
        $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
 
        $arc_result = $wpdb->get_results( $arc_query );
@@ -182,18 +282,106 @@ foreach ($arc_result as $arc_row) {
 
 <input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
 
 
 <input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" />
 
-<?php endif; // is_singular ?>
+<?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" />
+<?php } ?>
 
 </div>
 
 <br class="clear" />
 </div>
 
 
 </div>
 
 <br class="clear" />
 </div>
 
-<br class="clear" />
+<div class="clear"></div>
 
 
-<?php include( 'edit-attachment-rows.php' ); ?>
+<?php if ( isset($orphans) ) { ?>
+<table class="widefat" cellspacing="0">
+<thead>
+<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>
+</tr>
+</thead>
 
 
-</form>
+<tfoot>
+<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>
+</tr>
+</tfoot>
+
+<tbody id="the-list" class="list:post">
+<?php
+       if ( $orphans ) {
+               foreach ( $orphans as $post ) {
+                       $class = 'alternate' == $class ? '' : 'alternate';
+                       $att_title = wp_specialchars( _draft_or_post_title($post->ID) );
+?>
+       <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>
+
+               <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>
+<?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 />
+               <?php echo strtoupper(preg_replace('/^.*?\.(\w+)$/', '$1', get_attached_file($post->ID))); ?>
+
+               <p>
+               <?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>';
+               if ( current_user_can('edit_post', $post->ID) )
+                       $actions['attach'] = '<a href="#the-list" onclick="findPosts.open(\'media[]\',\''.$post->ID.'\');return false;">'.__('Attach').'</a>';
+               $action_count = count($actions);
+               $i = 0;
+               foreach ( $actions as $action => $link ) {
+                       ++$i;
+                       ( $i == $action_count ) ? $sep = '' : $sep = ' | ';
+                       echo "<span class='$action'>$link$sep</span>";
+               } ?>
+               </p></td>
+
+<?php  if ( '0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name ) {
+                       $t_time = $h_time = __('Unpublished');
+               } else {
+                       $t_time = get_the_time(__('Y/m/d g:i:s A'));
+                       $m_time = $post->post_date;
+                       $time = get_post_time( 'G', true );
+                       if ( ( abs($t_diff = time() - $time) ) < 86400 ) {
+                               if ( $t_diff < 0 )
+                                       $h_time = sprintf( __('%s from now'), human_time_diff( $time ) );
+                               else
+                                       $h_time = sprintf( __('%s ago'), human_time_diff( $time ) );
+                       } else {
+                               $h_time = mysql2date(__('Y/m/d'), $m_time);
+                       }
+               } ?>
+               <td><?php echo $h_time ?></td>
+       </tr>
+<?php  }
+
+       } else { ?>
+       <tr><td colspan="5"><?php _e('No posts found.') ?></td></tr>
+<?php } ?>
+</tbody>
+</table>
+
+<?php find_posts_div();
+
+} else {
+       include( 'edit-attachment-rows.php' );
+} ?>
 
 <div id="ajax-response"></div>
 
 
 <div id="ajax-response"></div>
 
@@ -201,50 +389,47 @@ foreach ($arc_result as $arc_row) {
 
 <?php
 if ( $page_links )
 
 <?php
 if ( $page_links )
-       echo "<div class='tablenav-pages'>$page_links</div>";
+       echo "<div class='tablenav-pages'>$page_links_text</div>";
 ?>
 
 ?>
 
+<div class="alignleft actions">
+<select name="action2" class="select-action">
+<option value="-1" selected="selected"><?php _e('Bulk Actions'); ?></option>
+<option value="delete"><?php _e('Delete'); ?></option>
+<?php if ( isset($orphans) ) { ?>
+<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" />
 </div>
 
 <br class="clear" />
 </div>
 
 <br class="clear" />
-
-<?php
-if ( 1 == count($posts) && is_singular() ) :
-       
-       $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
-       if ( $comments ) :
-               // Make sure comments, post, and post_author are cached
-               update_comment_cache($comments);
-               $post = get_post($id);
-               $authordata = get_userdata($post->post_author);
-       ?>
-
+</div>
+</form>
 <br class="clear" />
 
 <br class="clear" />
 
-<table class="widefat" style="margin-top: .5em">
-<thead>
-  <tr>
-    <th scope="col"><?php _e('Comment') ?></th>
-    <th scope="col"><?php _e('Date') ?></th>
-    <th scope="col"><?php _e('Actions') ?></th>
-  </tr>
-</thead>
-<tbody id="the-comment-list" class="list:comment">
-<?php
-        foreach ($comments as $comment)
-                _wp_comment_row( $comment->comment_ID, 'detail', false, false );
-?>
-</tbody>
-</table>
+</div>
 
 
-<?php
+<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>
 
 
-endif; // comments
-endif; // posts;
+<?php
 
 
+include('admin-footer.php');
 ?>
 ?>
-
-</div>
-
-<?php include('admin-footer.php'); ?>
index e7a30cd5150edbfb25a6f5bfd60d5dbb5ffa1685..0cedd29c1ceaa973d883312ef77ee4a2264807fa 100644 (file)
@@ -1,5 +1,12 @@
 <?php
 <?php
-
+/**
+ * Edit user administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 
 if ( defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE )
 require_once('admin.php');
 
 if ( defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE )
@@ -7,62 +14,59 @@ if ( defined('IS_PROFILE_PAGE') && IS_PROFILE_PAGE )
 else
        $is_profile_page = false;
 
 else
        $is_profile_page = false;
 
+/**
+ * Display JavaScript for profile page.
+ *
+ * @since 2.5.0
+ */
 function profile_js ( ) {
 ?>
 <script type="text/javascript">
 function profile_js ( ) {
 ?>
 <script type="text/javascript">
-       function check_pass_strength ( ) {
+(function($){
 
 
-               var pass = jQuery('#pass1').val();
-               var user = jQuery('#user_login').val();
+       function check_pass_strength () {
 
 
-               // get the result as an object, i'm tired of typing it
-               var res = jQuery('#pass-strength-result');
+               var pass = $('#pass1').val();
+               var user = $('#user_login').val();
 
 
-               var strength = passwordStrength(pass, user);
+               $('#pass-strength-result').removeClass('short bad good strong');
+               if ( ! pass ) {
+                       $('#pass-strength-result').html( pwsL10n.empty );
+                       return;
+               }
 
 
-               jQuery(res).removeClass('short bad good strong');
+               var strength = passwordStrength(pass, user);
 
 
-               if ( strength == pwsL10n.bad ) {
-                       jQuery(res).addClass('bad');
-                       jQuery(res).html( pwsL10n.bad );
-               }
-               else if ( strength == pwsL10n.good ) {
-                       jQuery(res).addClass('good');
-                       jQuery(res).html( pwsL10n.good );
-               }
-               else if ( strength == pwsL10n.strong ) {
-                       jQuery(res).addClass('strong');
-                       jQuery(res).html( pwsL10n.strong );
-               }
-               else {
+               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
                        // this catches 'Too short' and the off chance anything else comes along
-                       jQuery(res).addClass('short');
-                       jQuery(res).html( pwsL10n.short );
-               }
+                       $('#pass-strength-result').addClass('short').html( pwsL10n.short );
 
        }
 
        }
-       
-       function update_nickname ( ) {
-               
-               var nickname = jQuery('#nickname').val();
-               var display_nickname = jQuery('#display_nickname').val();
-               
+
+       function update_nickname () {
+
+               var nickname = $('#nickname').val();
+               var display_nickname = $('#display_nickname').val();
+
                if ( nickname == '' ) {
                if ( nickname == '' ) {
-                       jQuery('#display_nickname').remove();
+                       $('#display_nickname').remove();
                }
                }
-               jQuery('#display_nickname').val(nickname).html(nickname);
-               
+               $('#display_nickname').val(nickname).html(nickname);
+
        }
 
        }
 
-       jQuery(function($) { 
-               $('#pass1').keyup( check_pass_strength ) 
+       $(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')});
                $('.color-palette').click(function(){$(this).siblings('input[name=admin_color]').attr('checked', 'checked')});
-       } );
-       
-       jQuery(document).ready( function() {
-               jQuery('#pass1,#pass2').attr('autocomplete','off');
-               jQuery('#nickname').blur(update_nickname);
     });
     });
+})(jQuery);
 </script>
 <?php
 }
 </script>
 <?php
 }
@@ -86,13 +90,32 @@ $wp_http_referer = remove_query_arg(array('update', 'delete_count'), stripslashe
 
 $user_id = (int) $user_id;
 
 
 $user_id = (int) $user_id;
 
-if ( !$user_id )
+if ( !$user_id ) {
        if ( $is_profile_page ) {
                $current_user = wp_get_current_user();
                $user_id = $current_user->ID;
        } else {
                wp_die(__('Invalid user ID.'));
        }
        if ( $is_profile_page ) {
                $current_user = wp_get_current_user();
                $user_id = $current_user->ID;
        } else {
                wp_die(__('Invalid user ID.'));
        }
+} elseif ( !get_userdata($user_id) ) {
+       wp_die( __('Invalid user ID.') );
+}
+
+/**
+ * Optional SSL preference that can be turned on by hooking to the 'personal_options' action.
+ *
+ * @since 2.7.0
+ *
+ * @param object $user User data object
+ */
+function use_ssl_preference($user) {
+?>
+       <tr>
+               <th scope="row"><?php _e('Use https')?></th>
+               <td><label for="use_ssl"><input name="use_ssl" type="checkbox" id="use_ssl" value="1" <?php checked('1', $user->use_ssl); ?> /> <?php _e('Always use https when visiting the admin'); ?></label></td>
+       </tr>
+<?php
+}
 
 switch ($action) {
 case 'switchposts':
 
 switch ($action) {
 case 'switchposts':
@@ -110,13 +133,14 @@ 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 ) {
+if ($is_profile_page)
        do_action('personal_options_update');
        do_action('personal_options_update');
-}
+else
+       do_action('edit_user_profile_update');
 
 $errors = edit_user($user_id);
 
 
 $errors = edit_user($user_id);
 
-if( !is_wp_error( $errors ) ) {
+if ( !is_wp_error( $errors ) ) {
        $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);
        $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);
@@ -127,7 +151,7 @@ default:
 $profileuser = get_user_to_edit($user_id);
 
 if ( !current_user_can('edit_user', $user_id) )
 $profileuser = get_user_to_edit($user_id);
 
 if ( !current_user_can('edit_user', $user_id) )
-               wp_die(__('You do not have permission to edit this user.'));
+       wp_die(__('You do not have permission to edit this user.'));
 
 include ('admin-header.php');
 ?>
 
 include ('admin-header.php');
 ?>
@@ -136,11 +160,11 @@ include ('admin-header.php');
 <div id="message" class="updated fade">
        <p><strong><?php _e('User updated.') ?></strong></p>
        <?php if ( $wp_http_referer && !$is_profile_page ) : ?>
 <div id="message" class="updated fade">
        <p><strong><?php _e('User updated.') ?></strong></p>
        <?php if ( $wp_http_referer && !$is_profile_page ) : ?>
-       <p><a href="users.php"><?php _e('&laquo; Back to Authors and Users'); ?></a></p>
+       <p><a href="users.php"><?php _e('&larr; Back to Authors and Users'); ?></a></p>
        <?php endif; ?>
 </div>
 <?php endif; ?>
        <?php endif; ?>
 </div>
 <?php endif; ?>
-<?php if ( is_wp_error( $errors ) ) : ?>
+<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
 <div class="error">
        <ul>
        <?php
 <div class="error">
        <ul>
        <?php
@@ -152,9 +176,10 @@ include ('admin-header.php');
 <?php endif; ?>
 
 <div class="wrap" id="profile-page">
 <?php endif; ?>
 
 <div class="wrap" id="profile-page">
-<h2><?php $is_profile_page? _e('Your Profile and Personal Options') : _e('Edit User'); ?></h2>
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
 
 
-<form name="profile" id="your-profile" action="" method="post">
+<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); ?>" />
 <?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); ?>" />
@@ -170,9 +195,10 @@ include ('admin-header.php');
 <?php if ( rich_edit_exists() ) : // don't bother showing the option if the editor has been removed ?>
        <tr>
                <th scope="row"><?php _e('Visual Editor')?></th>
 <?php if ( rich_edit_exists() ) : // 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="true" <?php checked('true', $profileuser->rich_editing); ?> /> <?php _e('Use the visual editor when writing'); ?></label></td>
+               <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>
 <?php endif; ?>
        </tr>
 <?php endif; ?>
+<?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>
 <tr>
 <th scope="row"><?php _e('Admin Color Scheme')?></th>
 <td><fieldset><legend class="hidden"><?php _e('Admin Color Scheme')?></legend>
@@ -184,24 +210,29 @@ 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); ?> />
        <table class="color-palette">
        <tr>
 <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); ?> />
        <table class="color-palette">
        <tr>
-       <?php
-       foreach ( $color_info->colors as $html_color ): ?>
+       <?php foreach ( $color_info->colors as $html_color ): ?>
        <td style="background-color: <?php echo $html_color ?>" title="<?php echo $color ?>">&nbsp;</td>
        <?php endforeach; ?>
        </tr>
        </table>
        <td style="background-color: <?php echo $html_color ?>" title="<?php echo $color ?>">&nbsp;</td>
        <?php endforeach; ?>
        </tr>
        </table>
-       
+
        <label for="admin_color_<?php echo $color; ?>"><?php echo $color_info->name ?></label>
 </div>
        <label for="admin_color_<?php echo $color; ?>"><?php echo $color_info->name ?></label>
 </div>
-<?php endforeach; ?>
+       <?php endforeach; ?>
 </fieldset></td>
 </tr>
 </fieldset></td>
 </tr>
+<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>
+</tr>
+<?php
+endif;
+do_action('personal_options', $profileuser);
+?>
 </table>
 </table>
-
 <?php
 <?php
-       if ( $is_profile_page ) {
-               do_action('profile_personal_options');
-       }
+       if ( $is_profile_page )
+               do_action('profile_personal_options', $profileuser);
 ?>
 
 <h3><?php _e('Name') ?></h3>
 ?>
 
 <h3><?php _e('Name') ?></h3>
@@ -209,7 +240,7 @@ foreach ( $_wp_admin_css_colors as $color => $color_info ): ?>
 <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" /> <?php _e('Your username cannot be changed'); ?></td>
+               <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>
        </tr>
 
 <?php if ( !$is_profile_page ): ?>
        </tr>
 
 <?php if ( !$is_profile_page ): ?>
@@ -239,17 +270,17 @@ echo $role_list . '</select></td></tr>';
 
 <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 ?>" /></td>
+       <td><input type="text" name="first_name" id="first_name" value="<?php echo $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 ?>" /></td>
+       <td><input type="text" name="last_name" id="last_name" value="<?php echo $profileuser->last_name ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
        <th><label for="nickname"><?php _e('Nickname') ?></label></th>
 </tr>
 
 <tr>
        <th><label for="nickname"><?php _e('Nickname') ?></label></th>
-       <td><input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" /></td>
+       <td><input type="text" name="nickname" id="nickname" value="<?php echo $profileuser->nickname ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
 </tr>
 
 <tr>
@@ -281,27 +312,27 @@ echo $role_list . '</select></td></tr>';
 <table class="form-table">
 <tr>
        <th><label for="email"><?php _e('E-mail') ?></label></th>
 <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 ?>" /> <?php _e('Required'); ?></td>
+       <td><input type="text" name="email" id="email" value="<?php echo $profileuser->user_email ?>" class="regular-text" /> <?php _e('Required.');?></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 ?>" /></td>
+       <td><input type="text" name="url" id="url" value="<?php echo $profileuser->user_url ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
        <th><label for="aim"><?php _e('AIM') ?></label></th>
 </tr>
 
 <tr>
        <th><label for="aim"><?php _e('AIM') ?></label></th>
-       <td><input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" /></td>
+       <td><input type="text" name="aim" id="aim" value="<?php echo $profileuser->aim ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
        <th><label for="yim"><?php _e('Yahoo IM') ?></label></th>
 </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 ?>" /></td>
+       <td><input type="text" name="yim" id="yim" value="<?php echo $profileuser->yim ?>" class="regular-text" /></td>
 </tr>
 
 <tr>
        <th><label for="jabber"><?php _e('Jabber / Google Talk') ?></label></th>
 </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 ?>" /></td>
+       <td><input type="text" name="jabber" id="jabber" value="<?php echo $profileuser->jabber ?>" class="regular-text" /></td>
 </tr>
 </table>
 
 </tr>
 </table>
 
@@ -319,12 +350,12 @@ if ( $show_password_fields ) :
 ?>
 <tr>
        <th><label for="pass1"><?php _e('New Password'); ?></label></th>
 ?>
 <tr>
        <th><label for="pass1"><?php _e('New Password'); ?></label></th>
-       <td><input type="password" name="pass1" id="pass1" size="16" value="" /> <?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="" /> <?php _e("Type your new password again."); ?><br />
-               <?php if ( $is_profile_page ): ?>
-               <p><strong><?php _e('Password Strength'); ?></strong></p>
-               <div id="pass-strength-result"><?php _e('Too short'); ?></div> <?php _e('Hint: Use upper and lower case characters, numbers and symbols like !"?$%^&amp;( in your password.'); ?>
-               <?php endif; ?>
+       <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 ): ?>
+               <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; ?>
        </td>
 </tr>
 <?php endif; ?>
        </td>
 </tr>
 <?php endif; ?>
@@ -360,8 +391,8 @@ if ( $show_password_fields ) :
 <p class="submit">
        <input type="hidden" name="action" value="update" />
        <input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
 <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" value="<?php $is_profile_page? _e('Update Profile') : _e('Update User') ?>" name="submit" />
- </p>
+       <input type="submit" class="button-primary" value="<?php $is_profile_page? _e('Update Profile') : _e('Update User') ?>" name="submit" />
+</p>
 </form>
 </div>
 <?php
 </form>
 </div>
 <?php
diff --git a/wp-admin/user-new.php b/wp-admin/user-new.php
new file mode 100644 (file)
index 0000000..0c98ad8
--- /dev/null
@@ -0,0 +1,143 @@
+<?php
+/**
+ * New User Administration Panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
+require_once('admin.php');
+
+if ( !current_user_can('create_users') )
+       wp_die(__('Cheatin&#8217; uh?'));
+
+/** WordPress Registration API */
+require_once( ABSPATH . WPINC . '/registration.php');
+
+if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
+       check_admin_referer('add-user');
+
+       if ( ! current_user_can('create_users') )
+               wp_die(__('You can&#8217;t create users.'));
+
+       $user_id = add_user();
+
+       if ( is_wp_error( $user_id ) ) {
+               $add_user_errors = $user_id;
+       } else {
+               $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
+               $redirect = 'users.php?usersearch='. urlencode($new_user_login) . '&update=add';
+               wp_redirect( $redirect . '#user-' . $user_id );
+               die();
+       }
+}
+
+$title = __('Add New User');
+$parent_file = 'users.php';
+
+wp_enqueue_script('admin-users');
+
+require_once ('admin-header.php');
+
+?>
+<div class="wrap">
+<?php screen_icon(); ?>
+<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
+
+<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
+       <div class="error">
+               <ul>
+               <?php
+                       foreach ( $errors->get_error_messages() as $err )
+                               echo "<li>$err</li>\n";
+               ?>
+               </ul>
+       </div>
+<?php endif;
+
+if ( ! empty($messages) ) {
+       foreach ( $messages as $msg )
+               echo $msg;
+} ?>
+
+<?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
+       <div class="error">
+               <?php
+                       foreach ( $add_user_errors->get_error_messages() as $message )
+                               echo "<p>$message</p>";
+               ?>
+       </div>
+<?php endif; ?>
+<div id="ajax-response"></div>
+
+<?php
+       if ( get_option('users_can_register') )
+               echo '<p>' . sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), site_url('wp-register.php')) . '</p>';
+       else
+               echo '<p>' . sprintf(__('Users cannot currently <a href="%1$s">register themselves</a>, but you can manually create users here.'), admin_url('options-general.php#users_can_register')) . '</p>';
+?>
+<form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate">
+<?php wp_nonce_field('add-user') ?>
+<?php
+//Load up the passed data, else set to a default.
+foreach ( array('user_login' => 'login', 'first_name' => 'firstname', 'last_name' => 'lastname',
+                               'email' => 'email', 'url' => 'uri', 'role' => 'role') as $post_field => $var ) {
+       $var = "new_user_$var";
+       if ( ! isset($$var) )
+               $$var = isset($_POST[$post_field]) ? stripslashes($_POST[$post_field]) : '';
+}
+?>
+<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>
+       </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>
+       </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>
+       </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>
+       </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>
+       </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>
+               <td><input name="pass1" type="password" id="pass1" autocomplete="off" />
+               <br />
+               <input name="pass2" type="password" id="pass2" autocomplete="off"/></td>
+       </tr>
+<?php endif; ?>
+
+       <tr class="form-field">
+               <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
+               <td><select name="role" id="role">
+                       <?php
+                       if ( !$new_user_role )
+                               $new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
+                       wp_dropdown_roles($new_user_role);
+                       ?>
+                       </select>
+               </td>
+       </tr>
+</table>
+<p class="submit">
+       <input name="adduser" type="submit" id="addusersub" class="button-primary" value="<?php _e('Add User') ?>" />
+</p>
+</form>
+
+</div>
+
+<?php
+include('admin-footer.php');
+?>
\ No newline at end of file
index f032e4139191d8ec82b0a0b50c3c65979fa7acc2..61fd687dcaf5c01ff516531a2fd409d5979d50f8 100644 (file)
@@ -1,5 +1,15 @@
 <?php
 <?php
+/**
+ * Users administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once('admin.php');
 require_once('admin.php');
+
+/** WordPress Registration API */
 require_once( ABSPATH . WPINC . '/registration.php');
 
 if ( !current_user_can('edit_users') )
 require_once( ABSPATH . WPINC . '/registration.php');
 
 if ( !current_user_can('edit_users') )
@@ -8,14 +18,13 @@ if ( !current_user_can('edit_users') )
 $title = __('Users');
 $parent_file = 'users.php';
 
 $title = __('Users');
 $parent_file = 'users.php';
 
-$action = $_REQUEST['action'];
-$update = '';
+$update = $doaction = '';
+if ( isset($_REQUEST['action']) )
+       $doaction = $_REQUEST['action'] ? $_REQUEST['action'] : $_REQUEST['action2'];
 
 
-if ( empty($action) ) {
-       if ( isset($_GET['deleteit']) )
-               $action = 'delete';
-       elseif ( isset($_GET['changeit']) && !empty($_GET['new_role']) )
-               $action = 'promote';
+if ( empty($doaction) ) {
+       if ( isset($_GET['changeit']) && !empty($_GET['new_role']) )
+               $doaction = 'promote';
 }
 
 if ( empty($_REQUEST) ) {
 }
 
 if ( empty($_REQUEST) ) {
@@ -25,9 +34,10 @@ if ( empty($_REQUEST) ) {
        $referer = '<input type="hidden" name="wp_http_referer" value="' . attribute_escape($redirect) . '" />';
 } else {
        $redirect = 'users.php';
        $referer = '<input type="hidden" name="wp_http_referer" value="' . attribute_escape($redirect) . '" />';
 } else {
        $redirect = 'users.php';
+       $referer = '';
 }
 
 }
 
-switch ($action) {
+switch ($doaction) {
 
 case 'promote':
        check_admin_referer('bulk-users');
 
 case 'promote':
        check_admin_referer('bulk-users');
@@ -105,7 +115,7 @@ case 'delete':
 
        check_admin_referer('bulk-users');
 
 
        check_admin_referer('bulk-users');
 
-       if ( empty($_REQUEST['users']) ) {
+       if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
                wp_redirect($redirect);
                exit();
        }
                wp_redirect($redirect);
                exit();
        }
@@ -113,7 +123,10 @@ case 'delete':
        if ( !current_user_can('delete_users') )
                $errors = new WP_Error('edit_users', __('You can&#8217;t delete users.'));
 
        if ( !current_user_can('delete_users') )
                $errors = new WP_Error('edit_users', __('You can&#8217;t delete users.'));
 
-       $userids = $_REQUEST['users'];
+       if ( empty($_REQUEST['users']) )
+               $userids = array(intval($_REQUEST['user']));
+       else
+               $userids = $_REQUEST['users'];
 
        include ('admin-header.php');
 ?>
 
        include ('admin-header.php');
 ?>
@@ -122,12 +135,14 @@ case 'delete':
 <?php echo $referer; ?>
 
 <div class="wrap">
 <?php echo $referer; ?>
 
 <div class="wrap">
+<?php screen_icon(); ?>
 <h2><?php _e('Delete Users'); ?></h2>
 <p><?php _e('You have specified these users for deletion:'); ?></p>
 <ul>
 <?php
        $go_delete = false;
        foreach ( (array) $userids as $id ) {
 <h2><?php _e('Delete Users'); ?></h2>
 <p><?php _e('You have specified these users for deletion:'); ?></p>
 <ul>
 <?php
        $go_delete = false;
        foreach ( (array) $userids as $id ) {
+               $id = (int) $id;
                $user = new WP_User($id);
                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";
                $user = new WP_User($id);
                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";
@@ -163,23 +178,6 @@ case 'delete':
 
 break;
 
 
 break;
 
-case 'adduser':
-       check_admin_referer('add-user');
-
-       if ( ! current_user_can('create_users') )
-               wp_die(__('You can&#8217;t create users.'));
-
-       $user_id = add_user();
-       $update = 'add';
-       if ( is_wp_error( $user_id ) )
-               $add_user_errors = $user_id;
-       else {
-               $new_user_login = apply_filters('pre_user_login', sanitize_user(stripslashes($_REQUEST['user_login']), true));
-               $redirect = add_query_arg( array('usersearch' => urlencode($new_user_login), 'update' => $update), $redirect );
-               wp_redirect( $redirect . '#user-' . $user_id );
-               die();
-       }
-
 default:
 
        if ( !empty($_GET['_wp_http_referer']) ) {
 default:
 
        if ( !empty($_GET['_wp_http_referer']) ) {
@@ -188,72 +186,72 @@ default:
        }
 
        wp_enqueue_script('admin-users');
        }
 
        wp_enqueue_script('admin-users');
-       wp_enqueue_script('admin-forms');
 
        include('admin-header.php');
 
 
        include('admin-header.php');
 
+       $usersearch = isset($_GET['usersearch']) ? $_GET['usersearch'] : null;
+       $userspage = isset($_GET['userspage']) ? $_GET['userspage'] : null;
+       $role = isset($_GET['role']) ? $_GET['role'] : null;
+
        // Query the users
        // Query the users
-       $wp_user_search = new WP_User_Search($_GET['usersearch'], $_GET['userspage'], $_GET['role']);
+       $wp_user_search = new WP_User_Search($usersearch, $userspage, $role);
 
 
+       $messages = array();
        if ( isset($_GET['update']) ) :
                switch($_GET['update']) {
                case 'del':
                case 'del_many':
        if ( isset($_GET['update']) ) :
                switch($_GET['update']) {
                case 'del':
                case 'del_many':
-               ?>
-                       <?php $delete_count = (int) $_GET['delete_count']; ?>
-                       <div id="message" class="updated fade"><p><?php printf(__ngettext('%s user deleted', '%s users deleted', $delete_count), $delete_count); ?></p></div>
-               <?php
+                       $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>';
                        break;
                case 'add':
                        break;
                case 'add':
-               ?>
-                       <div id="message" class="updated fade"><p><?php _e('New user created.'); ?></p></div>
-               <?php
+                       $messages[] = '<div id="message" class="updated fade"><p>' . __('New user created.') . '</p></div>';
                        break;
                case 'promote':
                        break;
                case 'promote':
-               ?>
-                       <div id="message" class="updated fade"><p><?php _e('Changed roles.'); ?></p></div>
-               <?php
+                       $messages[] = '<div id="message" class="updated fade"><p>' . __('Changed roles.') . '</p></div>';
                        break;
                case 'err_admin_role':
                        break;
                case 'err_admin_role':
-               ?>
-                       <div id="message" class="error"><p><?php _e("The current user's role must have user editing capabilities."); ?></p></div>
-                       <div id="message" class="updated fade"><p><?php _e('Other user roles have been changed.'); ?></p></div>
-               <?php
+                       $messages[] = '<div id="message" class="error"><p>' . __("The current user'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':
                        break;
                case 'err_admin_del':
-               ?>
-                       <div id="message" class="error"><p><?php _e("You can't delete the current user."); ?></p></div>
-                       <div id="message" class="updated fade"><p><?php _e('Other users have been deleted.'); ?></p></div>
-               <?php
+                       $messages[] = '<div id="message" class="error"><p>' . __("You can't delete the current user.") . '</p></div>';
+                       $messages[] = '<div id="message" class="updated fade"><p>' . __('Other users have been deleted.') . '</p></div>';
                        break;
                }
        endif; ?>
 
                        break;
                }
        endif; ?>
 
-<?php if ( is_wp_error( $errors ) ) : ?>
+<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
        <div class="error">
                <ul>
                <?php
        <div class="error">
                <ul>
                <?php
-                       foreach ( $errors->get_error_messages() as $message )
-                               echo "<li>$message</li>";
+                       foreach ( $errors->get_error_messages() as $err )
+                               echo "<li>$err</li>\n";
                ?>
                </ul>
        </div>
                ?>
                </ul>
        </div>
-<?php endif; ?>
+<?php endif;
 
 
-<div class="wrap">
-<form id="posts-filter" action="" method="get">
-       <?php if ( $wp_user_search->is_search() ) : ?>
-               <h2><?php printf(__('Users Matching "%s"'), wp_specialchars($wp_user_search->search_term)); ?></h2>
-       <?php else : ?>
-               <h2><?php _e('Manage Users'); ?></h2>
-       <?php endif; ?>
+if ( ! empty($messages) ) {
+       foreach ( $messages as $msg )
+               echo $msg;
+} ?>
 
 
+<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>
+
+<div class="filter">
+<form id="list-filter" action="" method="get">
 <ul class="subsubsub">
 <?php
 $role_links = array();
 $avail_roles = array();
 $users_of_blog = get_users_of_blog();
 <ul class="subsubsub">
 <?php
 $role_links = array();
 $avail_roles = array();
 $users_of_blog = get_users_of_blog();
-//var_dump($users_of_blog);
+$total_users = count( $users_of_blog );
 foreach ( (array) $users_of_blog as $b_user ) {
        $b_roles = unserialize($b_user->meta_value);
        foreach ( (array) $b_roles as $b_role => $val ) {
 foreach ( (array) $users_of_blog as $b_user ) {
        $b_roles = unserialize($b_user->meta_value);
        foreach ( (array) $b_roles as $b_role => $val ) {
@@ -265,42 +263,52 @@ foreach ( (array) $users_of_blog as $b_user ) {
 unset($users_of_blog);
 
 $current_role = false;
 unset($users_of_blog);
 
 $current_role = false;
-$class = empty($_GET['role']) ? ' class="current"' : '';
-$role_links[] = "<li><a href=\"users.php\"$class>" . __('All Users') . "</a>";
-foreach ( $wp_roles->get_names() as $role => $name ) {
-       if ( !isset($avail_roles[$role]) )
+$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>';
+foreach ( $wp_roles->get_names() as $this_role => $name ) {
+       if ( !isset($avail_roles[$this_role]) )
                continue;
 
        $class = '';
 
                continue;
 
        $class = '';
 
-       if ( $role == $_GET['role'] ) {
-               $current_role = $_GET['role'];
+       if ( $this_role == $role ) {
+               $current_role = $role;
                $class = ' class="current"';
        }
 
        $name = translate_with_context($name);
                $class = ' class="current"';
        }
 
        $name = translate_with_context($name);
-       $name = sprintf(_c('%1$s (%2$s)|user role with count'), $name, $avail_roles[$role]);
-       $role_links[] = "<li><a href=\"users.php?role=$role\"$class>" . $name . '</a>';
+       $name = sprintf( _c('%1$s <span class="count">(%2$s)</span>|user role with count'), $name, $avail_roles[$this_role] );
+       $role_links[] = "<li><a href='users.php?role=$this_role'$class>$name</a>";
 }
 }
-echo implode(' |</li>', $role_links) . '</li>';
+echo implode( " |</li>\n", $role_links) . '</li>';
 unset($role_links);
 ?>
 </ul>
 unset($role_links);
 ?>
 </ul>
-       <p id="post-search">
-       <label class="hidden" for="post-search-input"><?php _e( 'Search Users' ); ?>:</label>
-       <input type="text" id="post-search-input" name="usersearch" value="<?php echo attribute_escape($wp_user_search->search_term); ?>" />
+</form>
+</div>
+
+<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" />
        <input type="submit" value="<?php _e( 'Search Users' ); ?>" class="button" />
-       </p>
+</p>
+</form>
 
 
+<form id="posts-filter" action="" method="get">
 <div class="tablenav">
 
 <?php if ( $wp_user_search->results_are_paged() ) : ?>
        <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?></div>
 <?php endif; ?>
 
 <div class="tablenav">
 
 <?php if ( $wp_user_search->results_are_paged() ) : ?>
        <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?></div>
 <?php endif; ?>
 
-<div class="alignleft">
-<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
-<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>
+<div class="alignleft actions">
+<select name="action">
+<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" />
 <?php wp_nonce_field('bulk-users'); ?>
 </div>
 <input type="submit" value="<?php _e('Change'); ?>" name="changeit" class="button-secondary" />
 <?php wp_nonce_field('bulk-users'); ?>
 </div>
@@ -308,8 +316,6 @@ unset($role_links);
 <br class="clear" />
 </div>
 
 <br class="clear" />
 </div>
 
-<br class="clear" />
-
        <?php if ( is_wp_error( $wp_user_search->search_errors ) ) : ?>
                <div class="error">
                        <ul>
        <?php if ( is_wp_error( $wp_user_search->search_errors ) ) : ?>
                <div class="error">
                        <ul>
@@ -325,20 +331,22 @@ unset($role_links);
 <?php if ( $wp_user_search->get_results() ) : ?>
 
        <?php if ( $wp_user_search->is_search() ) : ?>
 <?php if ( $wp_user_search->get_results() ) : ?>
 
        <?php if ( $wp_user_search->is_search() ) : ?>
-               <p><a href="users.php"><?php _e('&laquo; Back to All Users'); ?></a></p>
+               <p><a href="users.php"><?php _e('&larr; Back to All Users'); ?></a></p>
        <?php endif; ?>
 
        <?php endif; ?>
 
-<table class="widefat">
+<table class="widefat fixed" cellspacing="0">
 <thead>
 <tr class="thead">
 <thead>
 <tr class="thead">
-       <th scope="col" class="check-column"><input type="checkbox" /></th>
-       <th><?php _e('Username') ?></th>
-       <th><?php _e('Name') ?></th>
-       <th><?php _e('E-mail') ?></th>
-       <th><?php _e('Role') ?></th>
-       <th class="num"><?php _e('Posts') ?></th>
+<?php print_column_headers('users') ?>
 </tr>
 </thead>
 </tr>
 </thead>
+
+<tfoot>
+<tr class="thead">
+<?php print_column_headers('users', false) ?>
+</tr>
+</tfoot>
+
 <tbody id="users" class="list:user user-list">
 <?php
 $style = '';
 <tbody id="users" class="list:user user-list">
 <?php
 $style = '';
@@ -360,6 +368,14 @@ foreach ( $wp_user_search->get_results() as $userid ) {
        <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?></div>
 <?php endif; ?>
 
        <div class="tablenav-pages"><?php $wp_user_search->page_links(); ?></div>
 <?php endif; ?>
 
+<div class="alignleft actions">
+<select name="action2">
+<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" />
+</div>
+
 <br class="clear" />
 </div>
 
 <br class="clear" />
 </div>
 
@@ -369,95 +385,18 @@ foreach ( $wp_user_search->get_results() as $userid ) {
 </div>
 
 <?php
 </div>
 
 <?php
-       if ( is_wp_error($add_user_errors) ) {
-               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 = attribute_escape(stripslashes($_REQUEST[$formpost]));
-               }
-               unset($name);
+       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])) : '';
        }
        }
+       unset($name);
 ?>
 
 <br class="clear" />
 ?>
 
 <br class="clear" />
-<?php if ( current_user_can('create_users') ) { ?>
-
-<div class="wrap">
-<h2 id="add-new-user"><?php _e('Add New User') ?></h2>
-
-<?php if ( is_wp_error( $add_user_errors ) ) : ?>
-       <div class="error">
-               <?php
-                       foreach ( $add_user_errors->get_error_messages() as $message )
-                               echo "<p>$message</p>";
-               ?>
-       </div>
-<?php endif; ?>
-<div id="ajax-response"></div>
-
 <?php
 <?php
-       if ( get_option('users_can_register') )
-               echo '<p>' . sprintf(__('Users can <a href="%1$s">register themselves</a> or you can manually create users here.'), site_url('wp-register.php')) . '</p>';
-       else
-               echo '<p>' . sprintf(__('Users cannot currently <a href="%1$s">register themselves</a>, but you can manually create users here.'), admin_url('options-general.php#users_can_register')) . '</p>';
-?>
-<form action="#add-new-user" method="post" name="adduser" id="adduser" class="add:users: validate">
-<?php wp_nonce_field('add-user') ?>
-<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>
-       </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>
-       </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>
-       </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>
-       </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>
-       </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>
-               <td><input name="pass1" type="password" id="pass1" />
-               <br />
-               <input name="pass2" type="password" id="pass2" /></td>
-       </tr>
-<?php endif; ?>
-
-       <tr class="form-field">
-               <th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
-               <td><select name="role" id="role">
-                       <?php
-                       if ( !$new_user_role )
-                               $new_user_role = $current_role ? $current_role : get_option('default_role');
-                       wp_dropdown_roles($new_user_role);
-                       ?>
-                       </select>
-               </td>
-       </tr>
-</table>
-<p class="submit">
-       <?php echo $referer; ?>
-       <input name="adduser" type="submit" id="addusersub" value="<?php _e('Add User') ?>" />
-</p>
-</form>
-
-</div>
-
-<?php
-}
 break;
 
 break;
 
-} // end of the $action switch
+} // end of the $doaction switch
 
 include('admin-footer.php');
 ?>
 
 include('admin-footer.php');
 ?>
index 74922767f8f698e3eb366c76cc3738c670630e06..95e82814882746892e42ea9e8f0536268f06b082 100644 (file)
@@ -1,6 +1,15 @@
 <?php
 <?php
-
+/**
+ * Widgets administration panel.
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
+
+/** WordPress Administration Bootstrap */
 require_once( 'admin.php' );
 require_once( 'admin.php' );
+
+/** WordPress Administration Widgets API */
 require_once(ABSPATH . 'wp-admin/includes/widgets.php');
 
 if ( ! current_user_can('switch_themes') )
 require_once(ABSPATH . 'wp-admin/includes/widgets.php');
 
 if ( ! current_user_can('switch_themes') )
@@ -25,12 +34,13 @@ if ( isset($_GET['sidebar']) && isset($wp_registered_sidebars[$_GET['sidebar']])
        require_once( 'admin-header.php' );
 ?>
 
        require_once( 'admin-header.php' );
 ?>
 
-       <div class="error">
-               <p><?php _e( 'No Sidebars Defined' ); ?></p>
-       </div>
-
        <div class="wrap">
        <div class="wrap">
-               <p><?php _e( 'You are seeing this message because the theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://automattic.com/code/widgets/themes/">follow these instructions</a>.' ); /* TODO: article on codex */; ?></p>
+       <?php screen_icon(); ?>
+       <h2><?php echo wp_specialchars( $title ); ?></h2>
+               <div class="error">
+                       <p><?php _e( 'No Sidebars Defined' ); ?></p>
+               </div>
+               <p><?php _e( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="http://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ); ?></p>
        </div>
 
 <?php
        </div>
 
 <?php
@@ -92,9 +102,6 @@ if ( $http_post && isset($sidebars_widgets[$_POST['sidebar']]) ) {
        exit;
 }
 
        exit;
 }
 
-
-
-
 // What widget (if any) are we editing
 $edit_widget = -1;
 
 // What widget (if any) are we editing
 $edit_widget = -1;
 
@@ -132,7 +139,7 @@ if ( isset($_GET['add']) && $_GET['add'] ) {
                <h2><?php _e( 'Add Widget' ); ?></h2>
                <br />
                <form action="<?php echo clean_url( remove_query_arg( $query_args ) ); ?>" method="post">
                <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">
                        <ul class="widget-control-list">
                                <li class="widget-list-control-item">
                                        <div class="widget-top">
@@ -216,30 +223,22 @@ $show_values = array(
 
 $show = isset($_GET['show']) && isset($show_values[$_GET['show']]) ? attribute_escape( $_GET['show'] ) : false;
 
 
 $show = isset($_GET['show']) && isset($show_values[$_GET['show']]) ? attribute_escape( $_GET['show'] ) : false;
 
-
 $messages = array(
        'updated' => __('Changes saved.')
 );
 
 $messages = array(
        'updated' => __('Changes saved.')
 );
 
-require_once( 'admin-header.php' );
-
-if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
+require_once( 'admin-header.php' ); ?>
 
 
+<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-
 <?php endif; ?>
 
 <div class="wrap">
 <?php endif; ?>
 
 <div class="wrap">
+<?php screen_icon(); ?>
+<h2><?php echo wp_specialchars( $title ); ?></h2>
 
        <form id="widgets-filter" action="" method="get">
 
 
        <form id="widgets-filter" action="" method="get">
 
-       <h2><?php _e( 'Widgets' ); ?></h2>
-       <p id="widget-search">
-               <label class="hidden" for="widget-search-input"><?php _e( 'Search Widgets' ); ?>:</label>
-               <input type="text" id="widget-search-input" name="s" value="<?php echo attribute_escape( $widget_search ); ?>" />
-               <input type="submit" class="button" value="<?php _e( 'Search Widgets' ); ?>" />
-       </p>
-
        <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="widget-liquid-left-holder">
        <div id="available-widgets-filter" class="widget-liquid-left">
                <h3><label for="show"><?php _e('Available Widgets'); ?></label></h3>
@@ -308,7 +307,7 @@ if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
                <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 ?>" />
                <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" value="<?php _e( 'Save Changes' ); ?>" />
+                       <input type="submit" name="save-widgets" class="button-primary" value="<?php _e( 'Save Changes' ); ?>" />
 <?php
                        wp_nonce_field( 'edit-sidebar_' . $sidebar );
 ?>
 <?php
                        wp_nonce_field( 'edit-sidebar_' . $sidebar );
 ?>
@@ -316,12 +315,12 @@ if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) : ?>
        </div>
 
        </form>
        </div>
 
        </form>
+       <br class="clear" />
 
 </div>
 
 <?php do_action( 'sidebar_admin_page' ); ?>
 
 
 </div>
 
 <?php do_action( 'sidebar_admin_page' ); ?>
 
-<br class="clear" />
-
 <?php require_once( 'admin-footer.php' ); ?>
 
 <?php require_once( 'admin-footer.php' ); ?>
 
+
index 0699a87b923d4435d23e20bab9be72be9751da92..a2b3b9ac7e668a450d1a241cdc5384872acbd77d 100644 (file)
@@ -1,4 +1,12 @@
-.plugins .name {
+
+p, ul, ol, blockquote { font-size: 12px; }
+
+.plugins .name,
+#pass-strength-result.strong,
+#pass-strength-result.short,
+.button-highlighted,
+#quicktags #ed_strong,
+#ed_reply_toolbar #ed_reply_strong {
        font-weight: bold;
 }
 
        font-weight: bold;
 }
 
        padding: 0;
 }
 
        padding: 0;
 }
 
-.plugins .togl {
-       width: 150px;
-       border-right-width: 1px;
-       border-right-style: solid;
+.plugins .action-links { 
+       white-space: nowrap;
 }
 
 .import-system {
        font-size: 16px;
 }
 
 }
 
 .import-system {
        font-size: 16px;
 }
 
-#uploading {
-       border-style: none;
-       padding: 0;
-       margin-bottom: 16px;
-       height: 18em;
-       width: 100%;
-}
-
-form#upload th {
-       text-align: right;
-}
-
-form#upload #post_content, form#upload #post_title {
-       width: 250px;
-}
-
-.form-invalid input {
-       border-width: 1px !important;
-       border-style: solid !important;
-}
-
-
-form#upload #post_content {
-       height: 50px;
-}
-
-.attpreview {
-       width: 1px; /* hug */
-       text-align: center;
-}
-
 .anchors {
        margin: 10px 20px 10px 20px;
 }
 
 table#availablethemes {
 .anchors {
        margin: 10px 20px 10px 20px;
 }
 
 table#availablethemes {
-       border-spacing: 0px;
-       border: none;
-       border-top: 1px solid #ccc;
-       border-bottom: 1px solid #ccc;
+       border-spacing: 0;
+       border-width: 1px 0;
+       border-style: solid none;
        margin: 10px auto;
        margin: 10px auto;
+       width: 100%;
 }
 }
+
 td.available-theme {
        vertical-align: top;
        width: 240px;
 td.available-theme {
        vertical-align: top;
        width: 240px;
@@ -66,42 +42,42 @@ td.available-theme {
        padding: 20px;
        text-align: left;
 }
        padding: 20px;
        text-align: left;
 }
+
 table#availablethemes td {
 table#availablethemes td {
-       border: 1px solid #eee;
-       border-top: none;
-}
-table#availablethemes td.top {
-       border-top: none;
+       border-width: 0 1px 1px;
+       border-style: none solid solid;
 }
 }
-table#availablethemes td.right {
-       border-right: none;
-       border-left: none;
+
+table#availablethemes td.right,
+table#availablethemes td.left  {
+       border-right: 0 none;
+       border-left: 0 none;
 }
 }
+
 table#availablethemes td.bottom {
 table#availablethemes td.bottom {
-       border-bottom: none;
-}
-table#availablethemes td.left {
-       border-right: none;
-       border-left: none;
+       border-bottom: 0 none;
 }
 
 .available-theme a.screenshot {
        width: 240px;
        height: 180px;
        display: block;
 }
 
 .available-theme a.screenshot {
        width: 240px;
        height: 180px;
        display: block;
-       border: 1px solid #efefef;
+       border-width: 1px;
+       border-style: solid;
        margin-bottom: 10px;
        overflow: hidden;
 }
        margin-bottom: 10px;
        overflow: hidden;
 }
+
 .available-theme img {
        width: 240px;
 }
 .available-theme img {
        width: 240px;
 }
+
 .available-theme h3 {
        margin: 15px 0 5px;
 }
 
 #current-theme {
 .available-theme h3 {
        margin: 15px 0 5px;
 }
 
 #current-theme {
-       margin-top: 1em;
+       margin: 1em 0 1.5em;
 }
 
 #current-theme a {
 }
 
 #current-theme a {
@@ -120,7 +96,8 @@ table#availablethemes td.left {
 
 #current-theme img {
        float: left;
 
 #current-theme img {
        float: left;
-       border: 1px solid #666;
+       border-width: 1px;
+       border-style: solid;
        margin-right: 1em;
        margin-bottom: 1.5em;
        width: 150px;
        margin-right: 1em;
        margin-bottom: 1.5em;
        width: 150px;
@@ -129,23 +106,23 @@ table#availablethemes td.left {
 #TB_window #TB_title a.tb-theme-preview-link,
 #TB_window #TB_title a.tb-theme-preview-link:visited {
        font-weight: bold;
 #TB_window #TB_title a.tb-theme-preview-link,
 #TB_window #TB_title a.tb-theme-preview-link:visited {
        font-weight: bold;
-       color: #999;
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
-#TB_window #TB_title a.tb-theme-preview-link:hover,
-#TB_window #TB_title a.tb-theme-preview-link:focus {
-       color: #ccc;
-}
-
 .checkbox {
        border: none;
        margin: 0;
        padding: 0;
 }
 
 .checkbox {
        border: none;
        margin: 0;
        padding: 0;
 }
 
-.code {
-       font-family: "Courier New", Courier, monospace;
+.code, code {
+       font-family: Consolas, Monaco, Courier, monospace;
+}
+
+kbd, code {
+       padding: 1px 3px;
+       margin: 0 1px;
+       font-size: 11px;
 }
 
 .commentlist li {
 }
 
 .commentlist li {
@@ -156,7 +133,7 @@ table#availablethemes td.left {
 }
 
 .commentlist li li {
 }
 
 .commentlist li li {
-       border-bottom: 0px;
+       border-bottom: 0;
        padding: 0;
 }
 
        padding: 0;
 }
 
@@ -176,23 +153,112 @@ table#availablethemes td.left {
 }
 
 .quicktags, .search {
 }
 
 .quicktags, .search {
-       font: 12px Georgia, "Times New Roman", Times, serif;
+       font: 12px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
 }
 
 .submit {
 }
 
 .submit {
-       border-top: 1px solid #ccc;
-       padding: 1.5em 0 0 0;
-       margin: 10px 0 0 0;
-       -moz-border-radius-bottomleft: 3px;
-       -khtml-border-bottom-left-radius: 3px;
+       padding: 1.5em 0;
+       margin: 5px 0;
+       -moz-border-radius: 0 0 3px 3px;
        -webkit-border-bottom-left-radius: 3px;
        -webkit-border-bottom-left-radius: 3px;
-       border-bottom-left-radius: 3px;
-       -moz-border-radius-bottomright: 3px;
-       -khtml-border-bottom-right-radius: 3px;
        -webkit-border-bottom-right-radius: 3px;
        -webkit-border-bottom-right-radius: 3px;
+       -khtml-border-bottom-left-radius: 3px;
+       -khtml-border-bottom-right-radius: 3px;
+       border-bottom-left-radius: 3px;
        border-bottom-right-radius: 3px;
 }
 
        border-bottom-right-radius: 3px;
 }
 
+form p.submit a.cancel:hover {
+       text-decoration: none;
+}
+
+#submitdiv h3,
+#pagesubmitdiv h3 {
+       margin-bottom: 0 !important;
+}
+
+#misc-publishing-actions {
+       padding: 6px 0 16px 0;
+}
+
+.misc-pub-section {
+       padding: 6px;
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+}
+
+.misc-pub-section-last {
+       border-bottom: 0 none;
+}
+
+#minor-publishing-actions {
+       padding: 6px;
+       text-align: right;
+}
+
+#minor-publishing {
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+}
+
+#save-post {
+       float: left;
+}
+
+.preview {
+       float: right;
+}
+
+#major-publishing-actions {
+       padding: 6px;
+       clear: both;
+       border-top: none;
+}
+
+#minor-publishing-actions input,
+#major-publishing-actions input,
+#minor-publishing-actions .preview {
+       min-width: 80px;
+       text-align: center;
+}
+
+#delete-action {
+       line-height: 25px;
+       vertical-align: middle;
+       text-align: left;
+       float: left;
+}
+
+#publishing-action {
+       text-align: right;
+       float: right;
+}
+
+#post-body #minor-publishing {
+       padding-bottom: 10px;
+}
+
+#post-body #misc-publishing-actions {
+       padding: 0;
+}
+
+#post-body .misc-pub-section {
+       border-right-width: 1px;
+       border-right-style: solid;
+       border-bottom: 0 none;
+       min-height: 30px;
+       float: left;
+       max-width: 32%;
+}
+
+#post-body .misc-pub-section-last {
+       border-right: 0;
+}
+
+#sticky-span {
+       margin-left: 18px;
+}
+
 .side-info {
        margin: 0;
        padding: 4px;
 .side-info {
        margin: 0;
        padding: 4px;
@@ -213,49 +279,77 @@ table#availablethemes td.left {
        list-style: square;
 }
 
        list-style: square;
 }
 
-.submit input, .button, .button-secondary, .button-highlighted {
-       font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 3px 5px;
-       font-size: 12px;
-       line-height: 1.5em;
+.submit input,
+.button,
+.button-primary,
+.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;
+       padding: 2px 8px;
+       cursor: pointer;
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       cursor: pointer;
-       text-decoration: none;  
+       -moz-border-radius: 11px;
+       -khtml-border-radius: 11px;
+       -webkit-border-radius: 11px;
+       border-radius: 11px;
+       -moz-box-sizing: content-box;
+       -webkit-box-sizing: content-box;
+       -khtml-box-sizing: content-box;
+       box-sizing: content-box;
+}
+
+a.button,
+a.button-primary,
+a.button-secondary {
+       line-height: 1.2em;
+       -webkit-border-radius: 10px;
+       padding: 4px 10px;
 }
 
 }
 
-.button-highlighted {
-       font-weight: bold;
+#doaction,
+#doaction2 {
+       margin-right: 8px;
+}
+
+.tablenav select[name="action"],
+.tablenav select[name="action2"] {
+       width: 120px;
+}
+
+.tablenav select[name="m"] {
+       width: 120px;
+}
+
+.tablenav select#cat {
+       width: 150px;
 }
 
 #wpcontent select {
 }
 
 #wpcontent select {
-       font: 12px/20px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+       font: 11px/20px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
        padding: 2px;
        padding: 2px;
-
        border-width: 1px;
        border-style: solid;
        height: 2em;
        border-width: 1px;
        border-style: solid;
        height: 2em;
-       vertical-align:top;
+       vertical-align: top;
+}
+
+#wpcontent option {
+       padding: 2px;
 }
 
 .approve {
        display: none;
 }
 
 }
 
 .approve {
        display: none;
 }
 
-.unapproved .approve {
+.unapproved .approve, .spam .approve {
        display: inline;
 }
 
        display: inline;
 }
 
-.updated a {
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
-}
-
-
 .unapproved .unapprove {
        display: none;
 }
 .unapproved .unapprove {
        display: none;
 }
@@ -269,7 +363,6 @@ table#availablethemes td.left {
        line-height: 150%;
 }
 
        line-height: 150%;
 }
 
-
 table .vers {
        text-align: center;
 }
 table .vers {
        text-align: center;
 }
@@ -278,18 +371,25 @@ textarea.all-options, input.all-options {
        width: 250px;
 }
 
        width: 250px;
 }
 
-#postdiv, #titlediv, #guiddiv, #poststuff .stuffbox {
-       margin: 0 8px 0 0;
-       padding: 0;
+#namediv table {
+       width: 100%;
 }
 
 }
 
-#titlediv, #namediv, #poststuff #namediv {
-       margin-top: 10px;
+#namediv td.first {
+       width: 10px;
+       white-space: nowrap;
 }
 
 }
 
-#postdivrich {
-       margin: 0;
-       padding: 0;
+#namediv input {
+       width: 98%;
+}
+
+#namediv p {
+       margin: 10px 0;
+}
+
+#wpbody-content .metabox-holder {
+       padding-top: 10px;
 }
 
 #content {
 }
 
 #content {
@@ -298,100 +398,126 @@ textarea.all-options, input.all-options {
 }
 
 #editorcontainer #content {
 }
 
 #editorcontainer #content {
-       padding: 0;
+       padding: 6px;
        line-height: 150%;
        border: 0 none;
        outline: none;
        line-height: 150%;
        border: 0 none;
        outline: none;
+       -moz-box-sizing: border-box;
+       -webkit-box-sizing: border-box;
+       -khtml-box-sizing: border-box;
+       box-sizing: border-box;
 }
 
 }
 
-#editorcontainer {
-       padding: 6px;
-       border-style: none solid solid;
+#editorcontainer,
+#quicktags {
+       border-style: solid;
        border-width: 1px;
        border-collapse: separate;
        border-width: 1px;
        border-collapse: separate;
+       -moz-border-radius: 6px 6px 0 0;
+       -webkit-border-top-right-radius: 6px;
+       -webkit-border-top-left-radius: 6px;
+       -khtml-border-top-right-radius: 6px;
+       -khtml-border-top-left-radius: 6px;
+       border-top-right-radius: 6px;
+       border-top-left-radius: 6px;
 }
 
 #quicktags {
        padding: 0;
 }
 
 #quicktags {
        padding: 0;
-       border: 0 none;
+       margin-bottom: -3px;
+       border-bottom-width: 3px;
+       background-image: url("images/ed-bg.gif");
+       background-position: left top;
+       background-repeat: repeat-x;
 }
 
 #quicktags #ed_toolbar {
 }
 
 #quicktags #ed_toolbar {
-       padding: 2px 4px;
+       padding: 2px 4px 0;
 }
 
 }
 
-#ed_toolbar input {
-       margin: 3px 2px 2px;
-       padding: 2px 4px;
+#ed_toolbar input,
+#ed_reply_toolbar input {
+       margin: 3px 1px 4px;
        line-height: 18px;
        display: inline-block;
        line-height: 18px;
        display: inline-block;
+       border-width: 1px;
+       border-style: solid;
+       min-width: 26px;
+       padding: 2px 4px;
+       font-size: 12px;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
 }
 
 }
 
-#quicktags #ed_strong {
-       font-weight: bold;
+#ed_reply_toolbar input {
+       margin: 1px 2px 1px 1px;
 }
 
 }
 
-#quicktags #ed_link {
+#quicktags #ed_link,
+#ed_reply_toolbar #ed_reply_link {
        text-decoration: underline;
 }
 
        text-decoration: underline;
 }
 
-#quicktags #ed_del {
+#quicktags #ed_del,
+#ed_reply_toolbar #ed_reply_del {
        text-decoration: line-through;
 }
 
        text-decoration: line-through;
 }
 
-#quicktags #ed_em {
+#quicktags #ed_em,
+#ed_reply_toolbar #ed_reply_em {
        font-style: italic;
 }
 
        font-style: italic;
 }
 
-#quicktags #ed_code {
-       font-family: "Courier New", Courier, mono;
-       font-size: 1.1em;
-       vertical-align: top;
-}
-
-
-#attachmentlinks textarea {
-       width: 100%;
-       height: 2.5em;
-       margin-bottom: 6px;
-}
-
 #excerpt, .attachmentlinks {
        margin: 0;
        height: 4em;
        width: 98%;
 }
 
 #excerpt, .attachmentlinks {
        margin: 0;
        height: 4em;
        width: 98%;
 }
 
-.plugins p {
+/* post meta postbox */
+#postcustomstuff table,
+#postcustomstuff input,
+#postcustomstuff textarea {
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
 }
 
 }
 
-#login .fullwidth {
-       width: 320px;
+#postcustomstuff .updatemeta,
+#postcustomstuff .deletemeta {
+       margin: auto;
 }
 
 }
 
-#searchform fieldset {
-       float: left;
-       margin: 0 1.5ex 1em 0;
-       padding: 0;
+#postcustomstuff thead th {
+       padding: 5px 8px 8px;
 }
 
 }
 
-#searchform fieldset legend {
-       padding: 0 0 .2em 1px;
+#postcustom #postcustomstuff .submit,
+#pagecustomdiv #postcustomstuff .submit {
+       border: 0 none;
+       float: none;
+       padding: 5px 8px;
 }
 
 }
 
-#searchform #s {
-       padding: 4px 3px;
+#side-sortables #postcustom #postcustomstuff .submit,
+#side-sortables #pagecustomdiv #postcustomstuff .submit {
+       padding: 0 5px;
 }
 
 }
 
-#searchform #post-query-submit {
-       float: left;
-       margin: 14px 0 1em;
-       position: relative;
-       top: .35em;
+#side-sortables #postcustom #postcustomstuff td.left input,
+#side-sortables #pagecustomdiv #postcustomstuff td.left input {
+       margin: 3px 3px 0;
 }
 
 }
 
-#postcustomstuff .updatemeta, #postcustomstuff .deletemeta {
-       margin: auto;
+#side-sortables #postcustom #postcustomstuff #the-list textarea,
+#side-sortables #pagecustomdiv #postcustomstuff #the-list textarea {
+       height: 85px;
+       margin: 3px;
 }
 
 #postcustomstuff table {
 }
 
 #postcustomstuff table {
@@ -399,18 +525,40 @@ textarea.all-options, input.all-options {
        width: 100%;
        border-width: 1px;
        border-style: solid;
        width: 100%;
        border-width: 1px;
        border-style: solid;
+       border-spacing: 0;
 }
 
 }
 
-#postcustomstuff table input, #postcustomstuff table textarea {
+#postcustomstuff table input,
+#postcustomstuff table select,
+#postcustomstuff table textarea {
        width: 95%;
        width: 95%;
+       margin: 8px 0 8px 8px;
+}
+
+#postcustomstuff th.left,
+#postcustomstuff td.left {
+       width: 38%;
+}
+
+#postcustomstuff .submit input {
+       width: auto;
+}
+
+#postcustomstuff #newmeta .submit {
+       padding: 0 8px;
 }
 
 #postcustomstuff table #addmetasub {
        width: auto;
 }
 
 }
 
 #postcustomstuff table #addmetasub {
        width: auto;
 }
 
-#poststuff #post-body {
-       margin-right: 230px;
+#postcustomstuff #newmetaleft {
+       vertical-align: top;
+}
+
+#postcustomstuff #newmetaleft a {
+       padding: 0 10px;
+       text-decoration: none;
 }
 
 #save {
 }
 
 #save {
@@ -425,13 +573,9 @@ textarea.all-options, input.all-options {
        margin-right: 0;
 }
 
        margin-right: 0;
 }
 
-#template, #template div, #editcat, #addcat {
-       zoom: 1;
-}
-
 /* A handy div class for hiding controls.
 Some browsers will disable them when you
 /* A handy div class for hiding controls.
 Some browsers will disable them when you
-set display:none; */
+set display: none; */
 .zerosize {
        height: 0;
        width: 0;
 .zerosize {
        height: 0;
        width: 0;
@@ -448,7 +592,7 @@ set display:none; */
 }
 
 #your-profile legend {
 }
 
 #your-profile legend {
-       font-family: Georgia, "Times New Roman", Times, serif;
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
        font-size: 22px;
 }
 
        font-size: 22px;
 }
 
@@ -466,7 +610,6 @@ set display:none; */
        margin-left: 2em;
 }
 
        margin-left: 2em;
 }
 
-
 div.nav {
        height: 2em;
        padding: 7px 10px;
 div.nav {
        height: 2em;
        padding: 7px 10px;
@@ -478,17 +621,12 @@ div.nav {
        padding: 2px 4px;
 }
 
        padding: 2px 4px;
 }
 
-.page-numbers {
-       padding: 2px 4px;
-       margin-right: 3px;
-       border-width: 1px;
-       border-style: solid;
-}
-
-.page-numbers.current {
+a.page-numbers {
+       border-bottom-style: solid;
+       border-bottom-width: 2px;
        font-weight: bold;
        font-weight: bold;
-       border-width: 1px;
-       border-style: solid;
+       margin-right: 1px;
+       padding: 0 2px;
 }
 
 p.pagenav {
 }
 
 p.pagenav {
@@ -506,47 +644,64 @@ p.pagenav {
        font-weight: bold;
 }
 
        font-weight: bold;
 }
 
-.comment-column {
-       margin-left: 5px;
+.column-comment p {
+       margin: 0.6em 0;
 }
 
 }
 
-.tablenav a.button-secondary {
-       display: block;
-       margin: 1px 8px 0 0;
-}
-
-.tablenav .button-secondary {
-       padding: 2px 4px;
-       vertical-align: top;
+.column-author img, .column-username img {
+       float: left;
+       margin-right: 10px;
+       margin-top: 3px;
 }
 
 }
 
-.tablenav .tablenav-pages a.next, .tablenav .tablenav-pages a.prev {
-       text-decoration: underline;
+.tablenav a.button-secondary {
+       display: block;
+       margin: 3px 8px 0 0;
 }
 
 .tablenav {
 }
 
 .tablenav {
-       height: 2em;
-       padding: 7px 10px;
        clear: both;
        clear: both;
-       margin-bottom: -10px;
-       margin-top: 8px;
-       vertical-align: text-top;
+       height: 30px;
+       margin: 6px 0 4px;
+       vertical-align: middle;
 }
 
 .tablenav .tablenav-pages {
        float: right;
 }
 
 .tablenav .tablenav-pages {
        float: right;
-       height: 18px;
-       padding-top: 6px;
+       display: block;
+       cursor: default;
+       height: 30px;
+       line-height: 30px;
        font-size: 11px;
 }
 
        font-size: 11px;
 }
 
-.tablenav .tablenav-pages a {
+.tablenav .tablenav-pages a, .tablenav-pages span.current  {
        text-decoration: none;
        text-decoration: none;
+       border: none;
+       padding: 3px 6px;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 5px;
+       -khtml-border-radius: 5px;
+       -webkit-border-radius: 5px;
+       border-radius: 5px;
+}
+
+.tablenav .displaying-num {
+       margin-right: 10px;
+       font-size: 12px;
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       font-style: italic;
+}
+
+.tablenav .actions {
+       padding: 2px 8px 0 0;
 }
 
 td.media-icon {
        vertical-align: middle;
        text-align: center;
 }
 
 td.media-icon {
        vertical-align: middle;
        text-align: center;
+       width: 80px;
 }
 
 td.media-icon img {
 }
 
 td.media-icon img {
@@ -569,181 +724,351 @@ td.media-icon img {
 }
 
 #pass-strength-result {
 }
 
 #pass-strength-result {
-       padding: 3px 5px 3px 5px;
-       margin-top: 3px;
-       text-align: center;
-       border-width: 1px;
        border-style: solid;
        border-style: solid;
+       border-width: 1px;
+       float: left;
+       margin: 12px 5px 5px 1px;
+       padding: 3px 5px;
+       text-align: center;
+       width: 200px;
 }
 
 }
 
-a.view-comment-post-link {
-       position: absolute;
-       text-decoration:underline;
+.row-actions {
+       visibility: hidden;
+       padding: 2px 0 0;
+}
+
+tr:hover .row-actions,
+div.comment-item:hover .row-actions {
+       visibility: visible;
 }
 
 /* Admin Header */
 }
 
 /* Admin Header */
+#wphead-info {
+       margin: 0 0 0 15px;
+       padding-right: 15px;
+}
 
 #user_info {
 
 #user_info {
-       position: absolute;
-       right: 15px;
-       top: 11px;
-       font-size: 11px;
+       float: right;
+       font-size: 12px;
+       line-height: 46px;
+       height: 46px;
 }
 
 #user_info p {
        margin: 0;
        padding: 0;
 }
 
 #user_info p {
        margin: 0;
        padding: 0;
+       line-height: 46px;
 }
 
 #wphead {
 }
 
 #wphead {
-       border-top-width: 30px;
-       border-top-style: solid;
+       height: 46px;
 }
 
 }
 
-#wphead a, #dashmenu a, #adminmenu a, #submenu a, #sidemenu a, #taglist a, #catlist a {
+#wphead a,
+#adminmenu a,
+#sidemenu a,
+#taglist a,
+#catlist a,
+#show-settings a {
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
-#wphead #viewsite {
-       position: absolute;
-       margin-top: 12px;
-       margin-left: 10px;
-}
-#wphead #viewsite a {
-       font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 3px 4px;
-       display: block;
-       letter-spacing: normal;
-       border-width: 1px;
-       border-style: solid;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
+#header-logo {
+       float: left;
+       margin: 7px 0 0 15px;
 }
 
 #wphead h1 {
 }
 
 #wphead h1 {
-       font: normal 36px Georgia, "Times New Roman", Times, serif;
-       padding: 11px 170px 16px 12px;
+       font: normal 22px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       padding: 10px 8px 5px;
        margin: 0;
        margin: 0;
-       margin-right: 15%;
+       float: left;
 }
 
 }
 
-/* menu stuff */
+#wphead h1.long-title {
+       font: normal 18px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       padding: 12px 10px 5px;
+}
 
 
-#dashmenu {
-       margin: 0;
+#wphead h1 span {
+       font-size: 50%;
+}
+
+/* side admin menu */
+#adminmenu * {
+       -webkit-user-select: none;
+       -moz-user-select: none;
+       -khtml-user-select: none;
+       user-select: none;
+}
+
+#adminmenu .wp-submenu {
+       display: none;
        list-style: none;
        list-style: none;
-       position: absolute;
-       top: 7px;
-       left: 0;
-       font-size: 11px;
-       padding-left: 9px;
+       padding: 0;
+       margin: 0;
+       position: relative;
+       z-index: 2;
+       border-width: 1px 0 0;
+       border-style: solid none none;
 }
 
 }
 
-#dashmenu a {
-       padding: 5px 6px;
-       line-height: 220%;
-       margin-right: 8px;
+#adminmenu .wp-submenu a {
+       font: normal 11px/18px "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
 
 }
 
-#dashmenu a.current {
-       border: none;
-       -moz-border-radius-topleft: 3px;
-       -khtml-border-top-left-radius: 3px;
-       -webkit-border-top-left-radius: 3px;
-       border-top-left-radius: 3px;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-top-right-radius: 3px;
-       -webkit-border-top-right-radius: 3px;
-       border-top-right-radius: 3px;
+#adminmenu .wp-submenu li.current,
+#adminmenu .wp-submenu li.current a,
+#adminmenu .wp-submenu li.current a:hover {
+       font-weight: bold;
+}
+
+#adminmenu a.menu-top,
+#adminmenu .wp-submenu-head {
+       font: normal 13px/18px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+}
+
+#adminmenu div.wp-submenu-head {
+       display: none;
+}
+
+.folded #adminmenu div.wp-submenu-head,
+.folded #adminmenu li.wp-has-submenu div.sub-open {
+       display: block;
+}
+
+.folded #adminmenu a.menu-top,
+.folded #adminmenu .wp-submenu,
+.folded #adminmenu li.wp-menu-open .wp-submenu,
+.folded #adminmenu div.wp-menu-toggle {
+       display: none;
+}
+
+#adminmenu li.wp-menu-open .wp-submenu {
+       display: block;
 }
 
 }
 
-#adminmenu {
+#adminmenu div.wp-menu-image {
+       float: left;
+       width: 28px;
+       height: 28px;
+}
+
+#adminmenu li {
        margin: 0;
        margin: 0;
-       list-style: none;
-       padding-left: 11px;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+       padding: 0;
+       cursor: pointer;
 }
 
 #adminmenu a {
 }
 
 #adminmenu a {
-       font-size: 16px;
-       padding: 5px 7px;
-       line-height: 30px;
+       display: block;
+       line-height: 18px;
+       padding: 1px 5px 3px;
 }
 
 }
 
-#adminmenu a.current, #sidemenu a.current {
-       font-weight: normal;
-       padding-left: 6px;
-       padding-right: 6px;
-       -moz-border-radius-topleft: 4px;
-       -khtml-border-top-left-radius: 4px;
-       -webkit-border-top-left-radius: 4px;
-       border-top-left-radius: 4px;
-       -moz-border-radius-topright: 4px;
-       -khtml-border-top-right-radius: 4px;
-       -webkit-border-top-right-radius: 4px;
-       border-top-right-radius: 4px;
+#adminmenu li.menu-top {
+       min-height: 26px;
+}
+
+#adminmenu a.menu-top {
+       line-height: 18px;
+       min-width: 10em;
+       padding: 5px 5px;
+       border-width: 1px 1px 0;
+       border-style: solid solid none;
+}
+
+#adminmenu .wp-submenu a {
+       margin: 0;
+       padding-left: 12px;
+       border-width: 0 1px 0 0;
+       border-style: none solid none none;
+}
+
+#adminmenu .menu-top-last ul.wp-submenu {
+       border-width: 0 0 1px;
+       border-style: none none solid;
+}
+
+#adminmenu .wp-submenu li {
+       padding: 0;
+       margin: 0;
+}
+
+.folded #adminmenu li.menu-top {
+       width: 28px;
+       height: 30px;
+       overflow: hidden;
+       border-width: 1px 1px 0;
+       border-style: solid solid none;
+}
+
+#adminmenu .menu-top-first a.menu-top,
+.folded #adminmenu li.menu-top-first,
+#adminmenu .wp-submenu .wp-submenu-head {
+       border-width: 1px 1px 0;
+       border-style: solid solid none;
+       -moz-border-radius-topleft :6px;
+       -moz-border-radius-topright: 6px;
+       -webkit-border-top-right-radius: 6px;
+       -webkit-border-top-left-radius: 6px;
+       -khtml-border-top-right-radius: 6px;
+       -khtml-border-top-left-radius: 6px;
+       border-top-right-radius: 6px;
+       border-top-left-radius: 6px;
+}
+
+#adminmenu .menu-top-last a.menu-top,
+.folded #adminmenu li.menu-top-last {
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
+       -moz-border-radius-bottomleft: 6px;
+       -moz-border-radius-bottomright: 6px;
+       -webkit-border-bottom-right-radius: 6px;
+       -webkit-border-bottom-left-radius: 6px;
+       -khtml-border-bottom-right-radius: 6px;
+       -khtml-border-bottom-left-radius: 6px;
+       border-bottom-right-radius: 6px;
+       border-bottom-left-radius: 6px;
+}
+
+#adminmenu li.wp-menu-open a.menu-top-last {
+       border-bottom: 0 none;
+       -moz-border-radius-bottomright: 0;
+       -moz-border-radius-bottomleft: 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;
+}
+
+#adminmenu img.wp-menu-image {
+       float: left;
+       padding: 8px 6px 0;
+       opacity: 0.6;
+       filter: alpha(opacity=60);
 }
 
 }
 
-#adminmenu a.current {
-       border-bottom-width: 2px;
+#adminmenu li.menu-top:hover img.wp-menu-image,
+#adminmenu li.wp-has-current-submenu img.wp-menu-image {
+       opacity: 1;
+       filter: alpha(opacity=100);
 }
 
 }
 
-#sidemenu {
-       margin: -30px 15px 0 315px;
-       list-style: none;
-       position: relative;
-       float: right;
+.folded #adminmenu img.wp-menu-image {
+       padding: 7px 0 0 6px;
+}
+
+#adminmenu li.wp-menu-separator {
+       height: 21px;
+       padding: 0;
+       margin: 0;
+       cursor: w-resize;
+}
+
+.folded #adminmenu li.wp-menu-separator {
+       cursor: e-resize;
+}
+
+#adminmenu .wp-menu-separator-last {
+       height: 10px;
+       width: 1px;
+}
+
+#adminmenu .wp-submenu .wp-submenu-head {
+       border-width: 1px;
+       border-style: solid;
+       padding: 6px 4px 6px 10px;
+       cursor: default;
+}
+
+.folded #adminmenu .wp-submenu {
+       position: absolute;
+       margin: -1px 0 0 28px;
+       padding: 0 8px 8px;
+       z-index: 999;
+       border: 0 none;
+}
+
+.folded #adminmenu .wp-submenu ul {
+       width: 140px;
+       border-width: 0 0 1px;
+       border-style: none none solid;
+}
+
+.folded #adminmenu .wp-submenu li.wp-first-item {
+       border-top: 0 none;
+}
+
+.folded #adminmenu .wp-submenu a {
        padding-left: 10px;
        padding-left: 10px;
-       font-size:12px;
 }
 
 }
 
-#sidemenu a {
-       padding: 0 7px;
-       display: block;
-       float: left;
-       line-height: 28px;
-       border-top-width: 1px;
-       border-top-style: solid;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+.folded #adminmenu a.wp-has-submenu {
+       margin-left: 40px;
 }
 
 }
 
-#dashmenu li, #adminmenu li, #submenu li, #sidemenu li {
-       display: inline;
-       line-height: 200%;
-       list-style: none;
-       text-align: center;
-       white-space: nowrap;
-       margin: 0;
-       padding: 0;
+#adminmenu li.menu-top-last .wp-submenu ul {
+       border-width: 0 0 1px;
+       border-style: none none solid;
+}
+
+#adminmenu .wp-menu-toggle {
+       width: 22px;
+       clear: right;
+       float: right;
+       margin: 1px 0 0;
+       height: 27px;
+       padding: 1px 2px 0 0;
+       cursor: default;
 }
 
 }
 
-#submenu li {
-       padding: 0 0 8px 17px;
+#adminmenu li.wp-has-current-submenu ul {
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
 }
 }
+/* end side admin menu */
 
 
-#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
+/* comments/plugins bubble in menu */
+#adminmenu #awaiting-mod,
+#adminmenu span.update-plugins,
+#sidemenu li a span.update-plugins {
        position: absolute;
        position: absolute;
-       margin-left: -0.4em;
-       margin-top: 0.2em;
-       font-size: 0.7em;
-       background-repeat: no-repeat;
-       background-position: 0 bottom;
-       height: 0.9em;
-       width: 1em;
+       font-family: Helvetica, Arial, sans-serif;
+       font-size: 7pt;
+       font-weight: bold;
+       margin-top: 2px;
+       margin-left: 2px;
+       -moz-border-radius: 7px;
+       -khtml-border-radius: 7px;
+       -webkit-border-radius: 7px;
+       border-radius: 7px;
+}
+
+#adminmenu li #awaiting-mod span,
+#adminmenu li span.update-plugins span,
+#sidemenu li a span.update-plugins span {
+       float: left;
+       display: block;
+       height: 1.6em;
+       line-height: 1.6em;
+       padding: 0 6px;
 }
 
 }
 
-#adminmenu li a .count-0, #sidemenu li a .count-0 {
+#adminmenu li span.count-0,
+#sidemenu li a .count-0 {
        display: none;
 }
        display: none;
 }
+/* end menu stuff */
 
 
+/* comments bubble */
 .post-com-count-wrapper {
        min-width: 22px;
 .post-com-count-wrapper {
        min-width: 22px;
+       font-family: Helvetica, Arial, sans-serif;
 }
 
 .post-com-count {
 }
 
 .post-com-count {
@@ -758,16 +1083,18 @@ a.view-comment-post-link {
 }
 
 .post-com-count span {
 }
 
 .post-com-count span {
-       height: 1.3em;
-       line-height: 1.2em;
-       padding: 0 0.5em;
-       background-color: #bbb;
+       font-size: 9px;
+       font-weight: bild;
+       height: 1.7em;
+       line-height: 1.70em;
+       min-width: 0.7em;
+       padding: 0 6px;
        display: inline-block;
        cursor: pointer;
        display: inline-block;
        cursor: pointer;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
+       -moz-border-radius: 5px;
+       -khtml-border-radius: 5px;
+       -webkit-border-radius: 5px;
+       border-radius: 5px;
 }
 
 strong .post-com-count {
 }
 
 strong .post-com-count {
@@ -778,72 +1105,39 @@ strong .post-com-count {
        background-position: center -3px;
 }
 
        background-position: center -3px;
 }
 
-#adminmenu li a:hover #awaiting-mod, #sidemenu li a:hover #update-plugins {
-       background-position: -80px bottom;
-}
-
-#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
-       top: -0.8em;
-       right: 0;
-       position: absolute;
-       display: block;
-       height: 1.3em;
-       line-height: 1.3em;
-       padding: 0 0.6em;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-}
-
-#submenu {
-       margin: 0;
-       list-style: none;
-       padding: 6px 0 3px 0;
-}
-
-#submenu li {
-       font-size: 14px;
+.column-response .post-com-count {
+       float: left;
+       margin-right: 5px;
+       text-align: center;
 }
 
 }
 
-#minisub { /* for empty submenus */
-       height: 15px;
+.response-links {
+       margin: 4px 0;
 }
 
 }
 
-/* end menu stuff */
-
 /* Admin Footer */
 /* Admin Footer */
-
-html, body {
-       height:100%;
-}
-#wpwrap {
-       position: relative;
-       min-height: 100%;
-}
-#wpcontent{
-       padding-bottom: 95px;
-}
 #footer {
 #footer {
-       clear: both;
-       height: 65px;
-       padding: 10px 0 0 60px;
-       margin: 0;
-       position: relative;
-       margin-top: -75px;
+       margin-top: -45px;
+}
+
+#footer,
+#footer a {
        font-size: 12px;
        font-size: 12px;
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       font-style: italic;
 }
 
 #footer p {
        margin: 0;
 }
 
 #footer p {
        margin: 0;
-       padding: 7px 0;
+       padding: 15px;
+       line-height: 15px;
 }
 
 }
 
-#footer a {
+#footer a {
        text-decoration: none;
 }
 
        text-decoration: none;
 }
 
-#footer a:hover {
+#footer a:hover {
        text-decoration: underline;
 }
 
        text-decoration: underline;
 }
 
@@ -851,34 +1145,42 @@ html, body {
 
 .form-table {
        border-collapse: collapse;
 
 .form-table {
        border-collapse: collapse;
-       margin-top: 1em;
+       margin-top: 0.5em;
        width: 100%;
        margin-bottom: -8px;
        width: 100%;
        margin-bottom: -8px;
+       clear: both;
 }
 
 }
 
-.form-table td {
+.form-table td,
+#wpbody-content .describe td {
        margin-bottom: 9px;
        margin-bottom: 9px;
-       padding: 10px;
+       padding: 4px 10px 12px;
        line-height: 20px;
        line-height: 20px;
-       border-bottom-width: 8px;
-       border-bottom-style: solid;
        font-size: 11px;
 }
 
        font-size: 11px;
 }
 
-.form-table th {
+.form-table th,
+.form-wrap label {
+       font-weight: normal;
+       text-shadow: rgba(255,255,255,1) 0 1px 0;
+}
+
+.form-table th,
+#wpbody-content .describe th {
        vertical-align: top;
        text-align: left;
        padding: 10px;
        vertical-align: top;
        text-align: left;
        padding: 10px;
-       width: 150px;
-       border-bottom-width: 8px;
-       border-bottom-style: solid;
+       width: 200px;
 }
 
 .form-table th.th-full {
        width: auto;
 }
 
 }
 
 .form-table th.th-full {
        width: auto;
 }
 
-.form-table input, .form-table textarea {
+.form-table input,
+.form-table textarea,
+#wpbody-content .describe input,
+#wpbody-content .describe textarea {
        border-width: 1px;
        border-style: solid;
 }
        border-width: 1px;
        border-style: solid;
 }
@@ -886,6 +1188,7 @@ html, body {
 .form-table div.color-option {
        display: block;
        clear: both;
 .form-table div.color-option {
        display: block;
        clear: both;
+       margin-top: 12px;
 }
 
 .form-table input.tog {
 }
 
 .form-table input.tog {
@@ -897,14 +1200,27 @@ html, body {
 .form-table table.color-palette {
        vertical-align: bottom;
        float: left;
 .form-table table.color-palette {
        vertical-align: bottom;
        float: left;
-       margin: -3px 3px 8px;
+       margin: -8px 3px 8px;
 }
 
 .form-table .color-palette td {
 }
 
 .form-table .color-palette td {
-       border-bottom: none;
-       border: 1px solid #fff;
-       font-size: 1px;
-       line-height: 1px;
+       border-width: 1px 1px 0;
+       border-stile: solid solid none;
+       height: 10px;
+       line-height: 20px;
+       width: 10px;
+}
+
+textarea.large-text {
+       width: 99%;
+}
+
+.form-table input.regular-text {
+       width: 325px;
+}
+
+.form-table input.small-text {
+       width: 50px;
 }
 
 #profile-page .form-table textarea {
 }
 
 #profile-page .form-table textarea {
@@ -912,17 +1228,10 @@ html, body {
        margin-bottom: 6px;
 }
 
        margin-bottom: 6px;
 }
 
-#profile-page .form-table input[type=text] { 
+#profile-page .form-table input[type=text] {
        width: 300px;
 }
 
        width: 300px;
 }
 
-#pass-strength-result {
-       width: 197px;
-       float: left;
-       margin-right: 5px;
-       border: 1px solid #ccc !important;
-}
-
 #profile-page .form-table #rich_editing {
        margin-right: 5px
 }
 #profile-page .form-table #rich_editing {
        margin-right: 5px
 }
@@ -945,41 +1254,205 @@ table.form-table td .updated {
        font-size: 13px;
 }
 
        font-size: 13px;
 }
 
-/* Post Screen */
+/* divs for cats and tags pages */
 
 
-#tagsdiv #newtag {
-       margin-right: 5px;
-       width: 16em;
+.form-wrap {
+       margin: 10px 0;
+       width: 97%;
 }
 
 }
 
-#tagchecklist {
-       margin-left: 10px;
+.form-wrap p,
+.form-wrap label {
+       font-size: 11px;
+}
 
 
+.form-wrap label {
+       display: block;
+       padding: 2px;
        font-size: 12px;
        font-size: 12px;
-       overflow: auto;
 }
 
 }
 
-#tagchecklist strong {
-       margin-left: -8px;
-       position: absolute;
+.form-field input,
+.form-field textarea {
+       border-style: solid;
+       border-width: 1px;
+       width: 95%;
 }
 
 }
 
-#tagchecklist span {
-       margin-right: 25px;
-       display: block;
-       float: left;
-       font-size: 11px;
-       line-height: 1.8em;
-       white-space: nowrap;
-       cursor: default;
+.form-wrap p {
+       margin: 2px 0 5px;
 }
 
 }
 
-#tagchecklist span a {
-       margin: 6px 0pt 0pt -9px;
-       cursor: pointer;
-       width: 10px;
-       height: 10px;
-       display: block;
+.setting-description, .form-wrap p {
+       font-style: italic;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+}
+
+.form-wrap .form-field {
+       margin: 0 0 10px;
+       padding: 8px;
+}
+
+.col-wrap h3 {
+       margin: 12px 0;
+       font-size: 1.1em;
+}
+
+.col-wrap p.submit {
+       margin-top: -10px;
+}
+
+.tagcloud {
+       width: 97%;
+       margin: 0 0 40px;
+}
+
+.tagcloud h3 {
+       margin: 2px 0 12px;
+}
+
+/* Post Screen */
+#normal-sortables {
+       min-height: 50px;
+}
+
+.postbox {
+       position: relative;
+       min-width: 255px;
+       width: 99.5%;
+}
+
+#trackback_url {
+       width: 99%;
+}
+
+#normal-sortables .postbox .submit {
+       background: transparent none;
+       border: 0 none;
+       float: right;
+       padding: 0 12px;
+       margin: 0;
+}
+
+#normal-sortables .postbox #replyrow .submit {
+       float: none;
+       margin: 0;
+       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 {
+       border: 0 none;
+}
+
+#side-sortables .inside-submitbox .insidebox,
+.stuffbox .insidebox {
+       margin: 11px 0;
+}
+
+#side-sortables .comments-box,
+#side-sortables #show-comments {
+       display: none;
+}
+
+#post-body #tagsdiv #newtag {
+       margin-right: 5px;
+       width: 16em;
+}
+
+#side-info-column input#post_password {
+       width: 94%
+}
+
+#side-info-column #tagsdiv #newtag {
+       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;
+       -moz-border-radius: 0 0 6px 6px;
+       -webkit-border-bottom-left-radius: 6px;
+       -webkit-border-bottom-right-radius: 6px;
+       -khtml-border-bottom-left-radius: 6px;
+       -khtml-border-bottom-right-radius: 6px;
+       border-bottom-left-radius: 6px;
+       border-bottom-right-radius: 6px;
+}
+
+#editorcontent #post-status-info {
+       border: none;
+}
+
+#post-body-content .wp_themeSkin .mceStatusbar a.mceResize {
+       display: block;
+       float: right;
+       background: transparent url(images/resize.gif) no-repeat scroll right bottom;
+       width: 12px;
+       height: 12px;
+       cursor: se-resize;
+       margin: 0 2px;
+       position: relative;
+       right: 0;
+       top: 31px;
+}
+
+
+#pagesubmitdiv div.inside,
+#linksubmitdiv div.inside,
+ div.inside {
+       padding: 0;
+       margin: 0;
+}
+
+#comment-status-radio p {
+       margin: 3px 0 5px;
+}
+
+#comment-status-radio input {
+       margin: 2px 3px 5px 0;
+       vertical-align: middle;
+}
+
+#comment-status-radio label {
+       padding: 5px 0;
+}
+
+#tagchecklist {
+       margin-left: 10px;
+       font-size: 12px;
+       overflow: auto;
+}
+
+#tagchecklist strong {
+       margin-left: -8px;
+       position: absolute;
+}
+
+#tagchecklist span {
+       margin-right: 25px;
+       display: block;
+       float: left;
+       font-size: 11px;
+       line-height: 1.8em;
+       white-space: nowrap;
+       cursor: default;
+}
+
+#tagchecklist span a {
+       margin: 6px 0pt 0pt -9px;
+       cursor: pointer;
+       width: 10px;
+       height: 10px;
+       display: block;
        float: left;
        text-indent: -9999px;
        overflow: hidden;
        float: left;
        text-indent: -9999px;
        overflow: hidden;
@@ -989,6 +1462,7 @@ table.form-table td .updated {
 .howto {
        font-style: italic;
        display: block;
 .howto {
        font-style: italic;
        display: block;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
 
 .ac_results {
 }
 
 .ac_results {
@@ -1024,589 +1498,1445 @@ table.form-table td .updated {
        clear: left;
 }
 
        clear: left;
 }
 
-#poststuff h3 {
-       font-size: 14px;
+.ui-sortable .postbox h3 {
+       cursor: pointer;
+       -webkit-user-select: none;
+       -moz-user-select: none;
+       -khtml-user-select: none;
+       user-select: none;
+}
+
+.ui-sortable .postbox .hndle span {
+       padding: 6px 0;
+}
+
+.ui-sortable .postbox .hndle {
+       cursor: move;
+}
+
+.hndle a {
+       font-size: 11px;
+       font-weight: normal;
+}
+
+.meta-box-sortables .postbox .handlediv {
+       float: right;
+       width: 23px;
+       height: 26px;
+}
+
+.sortable-placeholder {
+       border-width: 1px;
+       border-style: dashed;
+       z-index: -1;
+}
+
+#poststuff h3,
+.metabox-holder h3 {
+       font-size: 12px;
        font-weight: bold;
        font-weight: bold;
-       padding: 7px;
-       margin: 0 0 10px;
+       padding: 7px 9px;
+       margin: 0;
+       line-height: 1;
 }
 
 }
 
-#poststuff .postbox, #poststuff .stuffbox {
-       margin-left: 20px;
-       padding: 2px;
+.metabox-holder .postbox,
+#poststuff .postbox,
+#poststuff .stuffbox {
        margin-bottom: 20px;
        margin-bottom: 20px;
-       margin-right: 8px;
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
+       line-height: 1;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
+}
+
+.metabox-holder .postbox h3,
+#poststuff .postbox h3,
+#poststuff .stuffbox h3 {
+       -moz-border-radius: 6px 6px 0 0;
+       -webkit-border-top-right-radius: 6px;
+       -webkit-border-top-left-radius: 6px;
+       -khtml-border-top-right-radius: 6px;
+       -khtml-border-top-left-radius: 6px;
+       border-top-right-radius: 6px;
+       border-top-left-radius: 6px;
+}
+
+.postbox table.form-table {
+       margin-bottom: 0;
+}
+
+.postbox input[type="text"],
+.postbox textarea,
+.stuffbox input[type="text"],
+.stuffbox textarea {
+       border-width: 1px;
+       border-style: solid;
+}
+
+#poststuff .inside,
+#poststuff .inside p {
+       font-size: 11px;
+       margin: 6px;
+}
+
+#poststuff .inside .submitbox p {
+       margin: 1em 0;
+}
+
+#post-visibility-select {
+       line-height: 1.5em;
+       margin-top: 3px;
+}
+
+#poststuff #submitdiv .inside {
+       margin: 0;
 }
 
 #titlediv, #poststuff .postarea {
 }
 
 #titlediv, #poststuff .postarea {
-       margin-left: 20px;
        margin-bottom: 20px;
        margin-bottom: 20px;
-       margin-right: 8px;
 }
 
 #titlediv {
        margin-bottom: 20px;
 }
 }
 
 #titlediv {
        margin-bottom: 20px;
 }
+#titlediv label { cursor: text; }
 
 #titlediv div.inside {
        margin: 0;
 }
 
 
 #titlediv div.inside {
        margin: 0;
 }
 
-#titlediv #title {
+#poststuff #titlewrap {
        border: 0;
        padding: 0;
        border: 0;
        padding: 0;
-       font-size: 1.7em;
-       width: 100%;
-       outline: none;
+
 }
 
 }
 
-#poststuff #titlewrap {
-       padding: 2px 3px;
+#titlediv #title {
+       padding: 3px 4px;
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
+       font-size: 1.7em;
+       width: 100%;
+       outline: none;
 }
 
 }
 
-#poststuff .inside {
-       margin: 0 12px 12px;
+#poststuff .inside-submitbox,
+#side-info-column .inside-submitbox {
+       margin: 0 3px;
        font-size: 11px;
 }
 
        font-size: 11px;
 }
 
-#link_name, #link_url, #link_description {
-       font-size: 1.7em;
-       padding: 4px 3px;
+input#link_description,
+input#link_url {
        width: 98%;
 }
 
        width: 98%;
 }
 
+#pending {
+       background: 0 none;
+       border: 0 none;
+       padding: 0;
+       font-size: 11px;
+       margin-top: -1px;
+}
+
 #edit-slug-box {
 #edit-slug-box {
+       height: 1em;
        margin-top: 8px;
        margin-top: 8px;
+       padding: 0 7px;
 }
 
 }
 
-#editable-post-name-full {display: none;}
+#editable-post-name-full {
+       display: none;
+}
 
 
-#editable-post-name input {width: 16em;}
+#editable-post-name input {
+       width: 16em;
+}
 
 
-#edit-slug-buttons a.save {
-       padding: 6px 4px;
-       margin-right: 4px;
-       text-decoration: none;
-       border-width: 1px;
-       border-style: solid;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       font-weight: bold;
+.postarea h3 label {
+       float: left;
 }
 
 }
 
-#poststuff #editor-toolbar {
+.postarea #add-media-button {
+       float: right;
+       margin: 7px 0pt 0pt;
        position: relative;
        position: relative;
+       right: 10px;
+}
+
+#poststuff #editor-toolbar {
        height: 30px;
        height: 30px;
-       margin-top: -41px;
 }
 
 }
 
-#poststuff #edButtonPreview, #poststuff #edButtonHTML {
+.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;
+}
+
+#poststuff #edButtonPreview,
+#poststuff #edButtonHTML {
        display: block;
        display: block;
-       height: 20px;
-       padding: 5px 5px 1px;
-       margin: 5px 8px 0 0;
+       height: 18px;
+       margin: 5px 5px 0 0;
+       padding: 4px 5px 2px;
        float: right;
        cursor: pointer;
        float: right;
        cursor: pointer;
-}
-
-#poststuff #editor-toolbar .active {
-       font-weight: bold;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-top-right-radius: 3px;
+       border-width: 1px;
+       border-style: solid;
+       -moz-border-radius: 3px 3px 0 0;
        -webkit-border-top-right-radius: 3px;
        -webkit-border-top-right-radius: 3px;
-       border-top-right-radius: 3px;
-       -moz-border-radius-topleft: 3px;
-       -khtml-border-top-left-radius: 3px;
        -webkit-border-top-left-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-top-left-radius: 3px;
 }
 
-#poststuff #media-buttons {
-       float: right;
-       margin-right: 20px;
-       margin-top: 8px;
+#poststuff #edButtonHTML {
+       margin-right: 15px;
+}
+
+#media-buttons {
        cursor: default;
        cursor: default;
-       line-height: 1;
-       height: 1.1em;
+       padding: 8px 8px 0;
 }
 
 }
 
-#poststuff #media-buttons a {
+#media-buttons a {
        cursor: pointer;
        cursor: pointer;
-       padding: 0 5px 2px 2px;
+       padding: 0 0 5px 10px;
 }
 
 }
 
-#poststuff #media-buttons img {
+#media-buttons img {
        vertical-align: middle;
 }
 
        vertical-align: middle;
 }
 
-#poststuff .togbox {
-       background-position: -10px 16px;
-       background-repeat: no-repeat;
-       display: block;
-       height: 37px;
-       margin-left: -21px;
-       margin-top: -10px;
-       overflow: hidden;
-       position: absolute;
-       text-indent: -9999px;
-       width: 12px;
-       -moz-border-radius-topleft: 3px;
-       -khtml-border-top-left-radius: 3px;
-       -webkit-border-top-left-radius: 3px;
-       border-top-left-radius: 3px;
-       -moz-border-radius-bottomleft: 3px;
-       -khtml-border-bottom-left-radius: 3px;
-       -webkit-border-bottom-left-radius: 3px;
-       border-bottom-left-radius: 3px;
+.submitbox .submit {
+       text-align: left;
+       padding: 12px 10px 10px;
+       font-size: 11px;
 }
 
 }
 
-#poststuff .closed .inside {
-       display: none;
+.submitbox .submitdelete {
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+       text-decoration: none;
+       padding: 1px 2px;
 }
 
 }
 
-#poststuff .closed h3 {
-       margin: 0;
+.inside-submitbox #post_status {
+       margin: 2px 0 2px -2px;
 }
 
 }
 
-#poststuff .closed .togbox {
-       background-position: 4px 15px;
+.submitbox .submit a:hover {
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
 }
 
 }
 
-.submitbox {
-       width: 220px;
-       float: right;
+.submitbox .submit input {
+       margin-bottom: 8px;
+       margin-right: 4px;
+       padding: 6px;
 }
 
 }
 
-.submitbox .inside strong {
-       font-size: 14px;
+#post-status-select {
+       line-height: 2.5em;
+       margin-top: 3px;
 }
 
 }
 
-.submitbox .submitdelete {
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
-       text-decoration: none;
-       margin-left: 8px;
-       padding-bottom: 1px;
+/* Categories */
+
+#category-adder {
+       margin-left: 120px;
+       padding: 4px 0;
 }
 
 }
 
+#category-adder h4 {
+       margin: 0 0 8px;
+}
 
 
-.submitbox #previewview {
-       padding: 15px 10px;
-       -moz-border-radius-topleft: 3px;
-       -khtml-border-top-left-radius: 3px;
-       -webkit-border-top-left-radius: 3px;
-       border-top-left-radius: 3px;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-top-right-radius: 3px;
+#side-info-column #category-adder {
+       margin: 0;
+}
+
+#post-body #category-add input, #category-add select {
+       width: 30%;
+}
+
+#side-info-column #category-add input {
+       width: 94%;
+}
+
+#side-info-column #category-add select {
+       width: 100%;
+}
+
+#category-add input#category-add-sumbit {
+       width: auto;
+}
+
+#post-body ul#category-tabs {
+       float: left;
+       width: 120px;
+       text-align: right;
+       /* Negative margin for the sake of those without JS: all tabs display */
+       margin: 0 -120px 0 0;
+       padding: 0;
+}
+
+#post-body ul#category-tabs li {
+       padding: 8px;
+}
+
+#post-body ul#category-tabs li.ui-tabs-selected {
+       -moz-border-radius: 3px 0 0 3px;
+       -webkit-border-top-left-radius: 3px;
+       -webkit-border-bottom-left-radius: 3px;
+       -khtml-border-top-left-radius: 3px;
+       -khtml-border-bottom-left-radius: 3px;
+       border-top-left-radius: 3px;
+       border-bottom-left-radius: 3px;
+}
+
+#post-body ul#category-tabs li.ui-tabs-selected a {
+       font-weight: bold;
+       text-decoration: none;
+}
+
+#categorydiv div.ui-tabs-panel,
+#linkcategorydiv div.ui-tabs-panel {
+       height: 150px;
+       overflow: auto;
+       padding: 0.5em 0.9em;
+}
+
+#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;
+}
+
+#side-info-column #category-tabs li {
+       display: inline;
+       padding-right: 8px;
+}
+
+#side-info-column #category-tabs a {
+       text-decoration: none;
+}
+
+#side-info-column #category-tabs {
+       margin-bottom: 3px;
+}
+
+#categorydiv ul,
+#linkcategorydiv ul {
+       list-style: none;
+       padding: 0;
+       margin: 0;
+}
+
+#categorydiv ul.categorychecklist ul,
+#linkcategorydiv ul.categorychecklist ul {
+       margin-left: 18px;
+}
+
+ul.categorychecklist li {
+       margin: 0;
+       padding: 0;
+       line-height: 19px;
+}
+
+#category-adder h4 {
+       margin-top: 4px;
+       margin-bottom: 0px;
+}
+
+#categorydiv .ui-tabs-panel {
+       border-width: 3px;
+       border-style: solid; 
+}
+
+ul#category-tabs {
+       margin-top: 12px;
+}
+
+ul#category-tabs li {
+       padding: 5px 8px;
+       -moz-border-radius: 3px 3px 0 0;
+       -webkit-border-top-left-radius: 3px;
        -webkit-border-top-right-radius: 3px;
        -webkit-border-top-right-radius: 3px;
+       -khtml-border-top-left-radius: 3px;
+       -khtml-border-top-right-radius: 3px;
+       border-top-left-radius: 3px;
        border-top-right-radius: 3px;
 }
 
        border-top-right-radius: 3px;
 }
 
-.submitbox #previewview a {
-       padding: 6px;
+/* positioning etc. */
+
+form#tags-filter {
+       position: relative;
+}
+
+p.search-box {
+       float: right;
+       margin: -5px 0 0;
+}
+
+.search-input {
+       border-width: 1px;
+       border-style: solid;
+       padding: 2px;
+}
+
+#posts-filter fieldset {
+       float: left;
+       margin: 0 1.5ex 1em 0;
+       padding: 0;
+}
+
+#posts-filter fieldset legend {
+       padding: 0 0 .2em 1px;
+}
+
+.bordertitle {
+       padding-bottom: 5px;
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+}
+
+/* Edit posts */
+
+td.post-title strong {
+       display: block;
+       margin-bottom: .2em;
+}
+
+td.post-title p {
+       margin: 6px 0;
+}
+
+/* Global classes */
+
+.wp-hidden-children .wp-hidden-child,
+.ui-tabs-hide {
+       display: none;
+}
+
+.commentlist .avatar {
+       vertical-align: text-top;
+}
+
+.defaultavatarpicker .avatar {
+       margin: 2px 0;
+       vertical-align: middle;
+}
+
+body.wp-admin {
+       min-width: 785px;
+}
+
+.view-switch {
+       float: right;
+       margin: 6px 8px 0;
+}
+
+.view-switch a {
        text-decoration: none;
        text-decoration: none;
-       font-weight: normal;
-       border-bottom: none;
-       font-size: 14px;
+}
+
+.filter {
+       float: left;
+       margin: -5px 0 0 10px;
+}
+
+.filter .subsubsub {
+       margin-left: -10px;
+       margin-top: 13px;
+}
+
+#the-comment-list td.comment p.comment-author {
+       margin-top: 0;
+       margin-left: 0;
+}
+
+#the-comment-list p.comment-author img {
+       float: left;
+       margin-right: 8px;
+}
+
+#the-comment-list p.comment-author strong a {
+       border: none;
+}
+
+#the-comment-list td {
+       vertical-align: top;
+}
+
+#the-comment-list td.comment {
+       word-wrap: break-word;
+}
+
+#the-comment-list .check-column {
+       padding-top: 8px;
+}
+
+#templateside ul li a {
+       text-decoration: none;
+}
+
+.tablenav .delete {
+       margin-right: 20px;
+}
+
+td.action-links, th.action-links {
+       text-align: right;
+}
+
+/* Diff */
+
+table.diff {
+       width: 100%;
+}
+
+table.diff col.content {
+       width: 50%;
+}
+
+table.diff tr {
+       background-color: transparent;
+}
+
+table.diff td, table.diff th {
+       padding: .5em;
+       font-family: Consolas, Monaco, Courier, monospace;
+       border: none;
+}
+
+table.diff .diff-deletedline del, table.diff .diff-addedline ins {
+       text-decoration: none;
+}
+
+#wp-word-count {
+       display: block;
+}
+
+fieldset {
+       border: 0;
+       padding: 0;
+       margin: 0;
+}
+
+.tool-box {
+       margin: 15px 0 35px;
+}
+
+.tool-box .buttons {
+       margin: 15px 0;
+}
+
+.tool-box .title {
+       margin: 8px 0;
+       font: 18px/24px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+}
+
+.pressthis a {
+       font-size: 1.2em;
+}
+
+#wp_editbtns,
+#wp_gallerybtns {
+       padding: 2px;
+       position: absolute;
+       display: none;
+       z-index: 999998;
+}
+
+#wp_editimgbtn,
+#wp_delimgbtn,
+#wp_editgallery,
+#wp_delgallery {
+       margin: 2px;
+       padding: 2px;
+       border-width: 1px;
+       border-style: solid;
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
 }
 
        -moz-border-radius: 3px;
        -khtml-border-radius: 3px;
        -webkit-border-radius: 3px;
        border-radius: 3px;
 }
 
-.submitbox .submit {
-       text-align: left;
-       padding: 12px 10px 10px 10px;
-       font-size: 11px;
+.settings-toggle {
+       text-align: right;
+       margin: 5px 7px 15px 0;
+       font-size: 12px;
+}
+
+.settings-toggle h3 {
+       margin: 0;
+}
+
+#timestampdiv select {
+       height: 20px;
+       line-height: 20px;
+       padding: 0;
+}
+
+#jj, #hh, #mn {
+       width: 2em;
+       padding: 1px;
+       font-size: 12px;
+}
+
+#aa {
+       width: 3.4em;
+       padding: 1px;
+       font-size: 12px;
+}
+
+.curtime #timestamp {
+       background-repeat: no-repeat;
+       background-position: left top;
+       padding-left: 18px;
+}
+
+#timestampdiv {
+       padding-top: 5px;
+       line-height: 23px;
+}
+
+#timestampdiv p {
+       margin: 8px 0 6px;
+}
+
+#timestampdiv input {
+       border-width: 1px;
+       border-style: solid;
+}
+
+/* media popup 0819 */
+#sidemenu {
+       margin: -30px 15px 0 315px;
+       list-style: none;
+       position: relative;
+       float: right;
+       padding-left: 10px;
+       font-size: 12px;
+}
+
+#sidemenu a {
+       padding: 0 7px;
+       display: block;
+       float: left;
+       line-height: 28px;
+       border-top-width: 1px;
+       border-top-style: solid;
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+}
+
+#sidemenu li {
+       display: inline;
+       line-height: 200%;
+       list-style: none;
+       text-align: center;
+       white-space: nowrap;
+       margin: 0;
+       padding: 0;
+}
+
+#sidemenu a.current {
+       font-weight: normal;
+       padding-left: 6px;
+       padding-right: 6px;
+       -moz-border-radius: 4px 4px 0 0;
+       -webkit-border-top-left-radius: 4px;
+       -webkit-border-top-right-radius: 4px;
+       -khtml-border-top-left-radius: 4px;
+       -khtml-border-top-right-radius: 4px;
+       border-top-left-radius: 4px;
+       border-top-right-radius: 4px;
+       border-width: 1px;
+       border-style: solid;
+}
+
+#sidemenu {
+       margin: -30px 15px 0 315px;
+       list-style: none;
+       position: relative;
+       float: right;
+       padding-left: 10px;
+       font-size: 12px;
+}
+
+#sidemenu a {
+       padding: 0 7px;
+       display: block;
+       float: left;
+       line-height: 28px;
+       border-top-width: 1px;
+       border-top-style: solid;
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+}
+
+#sidemenu li a .count-0 {
+       display: none;
+}
+
+/* reply to comments */
+#replyrow {
+       font-size: 11px;
+}
+
+#replyrow input {
+       border-width: 1px;
+       border-style: solid;
+}
+
+#replyrow td {
+       padding: 2px;
+}
+
+#replyrow #editorcontainer {
+       border: 0 none;
+}
+
+#replysubmit {
+       margin: 0;
+       padding: 3px 7px;
+}
+
+#replysubmit img.waiting,
+.inline-edit-save img.waiting,
+#commentstatusdiv img.waiting {
+       padding: 0 10px;
+       vertical-align: top;
+}
+
+#replysubmit .button {
+       margin-right: 5px;
+}
+
+#replyrow #editor-toolbar {
+       display: none;
+}
+
+#replyhead {
+       font-size: 12px;
+       font-weight: bold;
+       padding: 2px 10px 4px;
+}
+
+#edithead .inside {
+       float: left;
+       padding: 3px 0 2px 5px;
+       margin: 0;
+       text-align: center;
+       font-size: 11px;
+}
+
+#edithead .inside input {
+       width: 180px;
+       font-size: 11px;
+}
+
+#edithead label {
+       padding: 2px 0;
+}
+
+#replycontainer {
+       padding: 5px;
+       border: 0 none;
+       height: 120px;
+       overflow: hidden;
+       position: relative;
+}
+
+#replycontent {
+       resize: none;
+       margin: 0;
+       width: 100%;
+       height: 100%;
+       padding: 0;
+       line-height: 150%;
+       border: 0 none;
+       outline: none;
+       font-size: 12px;
+}
+
+#replyrow #ed_reply_toolbar {
+       margin: 0;
+       padding: 2px 3px;
+}
+
+/* show/hide settings */
+#screen-meta {
+       position: relative;
+       clear: both;
+}
+
+#screen-meta-links {
+       margin: 0 9px 0 0;
+}
+
+#screen-meta .invisible {
+       visibility: hidden;
+}
+
+#screen-options-link-wrap,
+#contextual-help-link-wrap {
+       float: right;
+       background: transparent url( images/screen-options-left.gif ) no-repeat 0 0;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       height: 22px;
+       padding: 0;
+       margin: 0 6px 0 0;
+}
+
+#screen-meta a.show-settings {
+       text-decoration: none;
+       z-index: 1;
+       padding: 0 16px 0 6px;
+       height: 22px;
+       line-height: 22px;
+       font-size: 10px;
+       display: block;
+       background-repeat: no-repeat;
+       background-position: right bottom;
+}
+
+#screen-meta a.show-settings {
+       background-image: url( images/screen-options-right.gif );
+}
+
+#screen-meta a.show-settings:hover {
+       text-decoration: none;
+}
+
+#screen-options-wrap h5,
+#contextual-help-wrap h5 {
+       margin: 8px 0;
+       font-size: 13px;
+}
+
+#screen-options-wrap,
+#contextual-help-wrap {
+       border-style: none solid solid;
+       border-top: 0 none;
+       border-width: 0 1px 1px;
+       margin: 0 15px;
+       padding: 8px 12px 12px;
+       -moz-border-radius: 0 0 0 4px;
+       -webkit-border-bottom-left-radius: 4px;
+       -khtml-border-bottom-left-radius: 4px;
+       border-bottom-left-radius: 4px;
+}
+
+.metabox-prefs label {
+       padding-right: 15px;
+       white-space: nowrap;
+       line-height: 30px;
+}
+
+.metabox-prefs label input {
+       margin: 0 5px 0 2px;
+}
+
+.metabox-prefs label a {
+       display: none;
+}
+
+/* Inline Editor
+       .quick-edit* is for Quick Edit
+       .bulk-edit* is for Bulk Edit
+       .inline-edit* is for everything
+*/
+/*     Layout */
+tr.inline-edit-row td {
+       padding: 0 0.5em;
+}
+
+#wpbody-content .inline-edit-row fieldset {
+       font-size: 12px;
+       float: left;
+       margin: 0;
+       padding: 0;
+       width: 100%;
+}
+
+#wpbody-content .inline-edit-row fieldset .inline-edit-col {
+       padding: 0 0.5em;
+}
+
+#wpbody-content .quick-edit-row-page fieldset.inline-edit-col-right .inline-edit-col {
+       border-width: 0 0 0 1px;
+       border-style: none none none solid;
+}
+
+#wpbody-content .quick-edit-row-post .inline-edit-col-left {
+       width: 40%;
+}
+
+#wpbody-content .quick-edit-row-post .inline-edit-col-right {
+       width: 39%;
+}
+
+#wpbody-content .inline-edit-row-post .inline-edit-col-center {
+       width: 20%;
+}
+
+#wpbody-content .quick-edit-row-page .inline-edit-col-left {
+       width: 50%;
+}
+
+#wpbody-content .quick-edit-row-page .inline-edit-col-right,
+#wpbody-content .bulk-edit-row-post .inline-edit-col-right {
+       width: 49%;
+}
+
+#wpbody-content .bulk-edit-row .inline-edit-col-left {
+       width: 30%;
+}
+
+#wpbody-content .bulk-edit-row-page .inline-edit-col-right {
+       width: 69%;
+}
+
+#wpbody-content .bulk-edit-row .inline-edit-col-bottom {
+       float: right;
+       width: 69%;
+}
+
+#wpbody-content .inline-edit-row-page .inline-edit-col-right,
+#owpbody-content .bulk-edit-row-post .inline-edit-col-right {
+       margin-top: 27px;
+}
+
+.inline-edit-row fieldset .inline-edit-group {
+       clear: both;
+}
+
+.inline-edit-row fieldset .inline-edit-group:after {
+       content: ".";
+       display: block;
+       height: 0;
+       clear: both;
+       visibility: hidden;
+}
+
+.inline-edit-row p.submit {
+       clear: both;
+       padding: 0.5em;
+       margin: 0.5em 0 0;
+}
+
+/*     Positioning */
+.inline-edit-row h4 {
+       margin: .2em 0;
+       padding: 0;
+       line-height: 23px;
+}
+.inline-edit-row fieldset span.title,
+.inline-edit-row fieldset span.checkbox-title {
+       margin: 0;
+       padding: 0;
+       line-height: 27px;
+}
+
+.inline-edit-row fieldset label,
+.inline-edit-row fieldset span.inline-edit-categories-label {
+       display: block;
+       margin: .2em 0;
+}
+
+.inline-edit-row fieldset label.inline-edit-tags {
+       margin-top: 0;
+}
+
+.inline-edit-row fieldset label.inline-edit-tags span.title {
+       margin: .2em 0;
+}
+
+.inline-edit-row fieldset label span.title {
+       display: block;
+       float: left;
+       width: 5em;
+}
+
+.inline-edit-row fieldset label span.input-text-wrap {
+       display: block;
+       margin-left: 5em;
+}
+
+.quick-edit-row-post fieldset.inline-edit-col-right label span.title {
+       width: auto;
+       padding-right: 0.5em;
 }
 
 }
 
-.submitbox .submit a:hover {
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+.inline-edit-row .input-text-wrap input[type=text] {
+       width: 100%;
 }
 
 }
 
-.submitbox .submit input {
-       margin-bottom: 8px;
-       margin-right: 3px;
-       padding: 6px 4px;
-       border: none;
+.inline-edit-row fieldset label input[type=checkbox] {
+       vertical-align: text-bottom;
 }
 
 }
 
-.submitbox #autosave .error {
-       margin-top: 10px;
+.inline-edit-row fieldset label textarea {
+       width: 100%;
+       height: 4em;
 }
 
 }
 
-/* Categories */
+#wpbody-content .bulk-edit-row fieldset .inline-edit-group label {
+       max-width: 50%;
+}
 
 
-#categorydiv #category-adder {
-       margin-left: 120px;
-       padding: 4px 0;
+#wpbody-content .quick-edit-row fieldset .inline-edit-group label.alignleft:first-child {
+       margin-right: 0.5em
 }
 
 }
 
-#category-add input, #category-add select {
-       width: 30%;
+/*     Styling */
+.inline-edit-row h4 {
+       text-transform: uppercase;
 }
 
 }
 
-#category-add input#category-add-sumbit {
-       width: auto;
+.inline-edit-row fieldset span.title,
+.inline-edit-row fieldset span.checkbox-title {
+       font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
+       font-style: italic;
+       line-height: 1.8em;
+}
+
+/*     Specific Elements */
+.inline-edit-row fieldset input[type="text"],
+.inline-edit-row fieldset textarea {
+       border-style: solid;
+       border-width: 1px;
 }
 
 }
 
-#categorydiv ul#category-tabs {
+.inline-edit-row fieldset .inline-edit-date {
        float: left;
        float: left;
-       width: 120px;
-       text-align: right;
-       /* Negative margin for the sake of those without JS: all tabs display */
-       margin: 0 -120px 0 0;
-       padding: 0;
 }
 
 }
 
-ul#category-tabs li {
-       padding: 8px;
+.inline-edit-row fieldset input[name=jj],
+.inline-edit-row fieldset input[name=hh],
+.inline-edit-row fieldset input[name=mn] {
+       font-size: 12px;
+       width: 2.1em;
 }
 
 }
 
-ul#category-tabs li.ui-tabs-selected {
-       -moz-border-radius-topleft: 3px;
-       -khtml-border-top-left-radius: 3px;
-       -webkit-border-top-left-radius: 3px;
-       border-top-left-radius: 3px;
-       -moz-border-radius-bottomleft: 3px;
-       -khtml-border-bottom-left-radius: 3px;
-       -webkit-border-bottom-left-radius: 3px;
-       border-bottom-left-radius: 3px;
+.inline-edit-row fieldset input[name=aa] {
+       font-size: 12px;
+       width: 3.5em;
 }
 
 }
 
-ul#category-tabs li.ui-tabs-selected a {
-       color: #333;
-       font-weight: bold;
-       text-decoration: none;
+.inline-edit-row fieldset label input.inline-edit-password-input {
+       width: 8em;
 }
 
 }
 
-div.ui-tabs-panel {
-       margin: 0 5px 0 120px;
-       padding: .5em .9em;
-       height: 10em;
-       overflow: auto;
-       border-width: 4px;
+ul.cat-checklist {
+       height: 12em;
+       border-style: solid;
+       border-width: 1px;
+       overflow-y: scroll;
+       padding: 0 5px;
+       margin: 0 0 5px;
+}
+
+#bulk-titles {
+       display: block;
+       height: 12em;
        border-style: solid;
        border-style: solid;
+       border-width: 1px;
+       overflow-y: scroll;
+       padding: 0 5px;
+       margin: 0 0 5px;
 }
 
 }
 
-#categorydiv ul {
-       list-style: none;
-       padding: 0;
+.inline-edit-row fieldset ul.cat-checklist li,
+.inline-edit-row fieldset ul.cat-checklist input {
        margin: 0;
 }
 
        margin: 0;
 }
 
-#categorydiv ul.categorychecklist ul {
-       margin-left: 18px;
+.inline-edit-row fieldset ul.cat-checklist label,
+.inline-edit-row .catshow,
+.inline-edit-row .cathide,
+.inline-edit-row #bulk-titles div {
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
+       font-style: normal;
+       font-size: 11px;
 }
 
 }
 
-ul.categorychecklist li {
-       margin: 0;
-       padding: 0;
-       line-height: 19px;
+table .inline-edit-row fieldset ul.cat-hover {
+       height: auto;
+       max-height: 30em;
+       overflow-y: auto;
+       position: absolute;
 }
 
 }
 
-#linkcategorydiv #category-adder {
-       margin-left: 120px;
-       padding: 4px 0;
+.inline-edit-row fieldset label input.inline-edit-menu-order-input {
+       width: 3em;
 }
 
 }
 
-#category-adder h4 {
-       margin: 0;
+.inline-edit-row fieldset label input.inline-edit-slug-input {
+       width: 75%;
 }
 
 }
 
-#linkcategorydiv ul#category-tabs {
+.quick-edit-row-post fieldset label.inline-edit-status {
        float: left;
        float: left;
-       width: 120px;
-       text-align: right;
-       /* Negative margin for the sake of those without JS: all tabs display */
-       margin: 0 -120px 0 0;
-       padding: 0;
 }
 
 }
 
-#linkcategorydiv ul {
-       list-style: none;
-       padding: 0;
-       margin: 0;
+#bulk-titles {
+       line-height: 140%;
+}
+#bulk-titles div {
+       margin: 0.2em 0.3em;
 }
 
 }
 
-#linkcategorydiv ul.categorychecklist ul {
-       margin-left: 18px;
+#bulk-titles div a {
+       cursor: pointer;
+       display: block;
+       float: left;
+       height: 10px;
+       margin: 3px 3px 0 -2px;
+       overflow: hidden;
+       position: relative;
+       text-indent: -9999px;
+       width: 10px;
 }
 
 }
 
-/* pasitioning etc. */
-form#tags-filter {
-        position: relative;
+/* Media library */
+#wpbody-content #media-items .describe {
+       border-collapse: collapse;
+       width: 100%;
+       border-top-style: solid;
+       border-top-width: 1px;
+       clear: both;
+       cursor: default;
+       padding: 5px;
+       width: 100%;
 }
 
 }
 
-p#tag-search {
-        position: absolute;
-        right: 0;
-        top: 0;
-        margin: 0;
+#wpbody-content .describe .media-item-info tr {
+       background-color: transparent;
 }
 
 }
 
-form#posts-filter {
-        position: relative;
+#wpbody-content .filename {
+       margin-left: 10px;
 }
 
 }
 
-p#post-search {
-        position: absolute;
-        right: 0;
-        top: 0;
-        margin: 0;
+#wpbody-content .media-item .thumbnail {
+       max-height: 128px;
+       max-width: 128px;
 }
 
 }
 
-#post-search .button, #widget-search .button {
-       padding: 3px;
+#wpbody-content .media-upload-form label {
+       display: block;
        font-size: 13px;
        font-size: 13px;
+       margin: 0.5em;
 }
 
 }
 
-#posts-filter fieldset {
-       float: left;
-       margin: 0 1.5ex 1em 0;
-       padding: 0;
+abbr.required {
+       border: medium none;
+       text-decoration: none;
 }
 
 }
 
-#posts-filter fieldset legend {
-       padding: 0 0 .2em 1px;
+#wpbody-content .describe input[type="text"],
+#wpbody-content .describe textarea {
+       width: 460px;
 }
 
 }
 
-.bordertitle {
-       padding-bottom: 5px;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+#wpbody-content .describe p.help {
+       margin: 0;
+       padding: 0;
 }
 
 }
 
-/* Global classes */
-.wp-hidden-children .wp-hidden-child { display: none; }
-.wp-no-js-hidden { display: none; }
-.ui-tabs-hide { display: none; }
+.describe-toggle-on, .describe-toggle-off {
+       display: block;
+       line-height: 36px;
+       float: right;
+       margin-right: 20px;
+}
 
 
-.commentlist .avatar {
-       vertical-align:text-top;
+.describe-toggle-off {
+       display: none;
 }
 
 }
 
-.defaultavatarpicker .avatar {
-       margin: 2px 0;
-       vertical-align: middle;
+#wpbody-content .media-item {
+       border-bottom-style: solid;
+       border-bottom-width: 1px;
+       min-height: 36px;
+       position: relative;
+       width: 100%;
 }
 
 }
 
-body.minwidth {
-       min-width: 808px;
+#wpbody-content #media-items {
+       border-style: solid solid none;
+       border-width: 1px;
+       width: 670px;
 }
 
 }
 
-ul.view-switch {
-       float: right;
-       list-style: none;
-       margin: -23px 5px -2px 0;
-       position: relative;
+#wpbody-content #media-items .filename {
+       float: left;
+       line-height: 36px;
+       margin-left: 10px;
+       max-width: 430px;
+       overflow: hidden;
 }
 
 }
 
-ul.view-switch li {
+.media-item .pinkynail {
        float: left;
        float: left;
-       margin: 0;
-       font-size: 11px;
-       padding: 4px 6px;
-       font-weight: bold;
+       height: 32px;
+       margin: 2px;
+       max-width: 40px;
+       max-height: 40px;
 }
 
 }
 
-ul.view-switch a {
-       text-decoration: none;
+.media-item  .startopen,
+.media-item .startclosed {
+       display: none;
 }
 
 }
 
-ul.view-switch li.current {
-       border: none;
-       -moz-border-radius-topleft: 3px;
-       -khtml-border-top-left-radius: 3px;
-       -webkit-border-top-left-radius: 3px;
-       border-top-left-radius: 3px;
-       -moz-border-radius-topright: 3px;
-       -khtml-border-top-right-radius: 3px;
-       -webkit-border-top-right-radius: 3px;
-       border-top-right-radius: 3px;
+/* find posts */
+.find-box {
+       width: 400px;
+       height: 250px;
+       overflow: hidden;
+       padding: 33px 5px 50px;
+       position: absolute;
+       z-index: 1000;
 }
 
 }
 
+.find-box-head {
+       cursor: move;
+       font-weight: bold;
+       height: 2em;
+       line-height: 2em;
+       padding: 1px 12px;
+       position: absolute;
+       top: 5px;
+       width: 100%;
+}
 
 
-#the-comment-list .comment a {
-       padding-bottom: 1px;
-       text-decoration: none;
-       border-bottom-width: 1px;
-       border-bottom-style: solid;
+.find-box-inside {
+       overflow: auto;
+       width: 100%;
+       height: 100%;
 }
 
 }
 
+.find-box-search {
+       padding: 12px;
+       border-width: 1px;
+       border-style: none none solid;
+}
 
 
-#the-comment-list td.comment p.comment-author {
-       margin-top: 0;
-       margin-left: 0 ;
+#find-posts-response {
+       margin: 8px 0;
+       padding: 0 1px;
 }
 
 }
 
-#the-comment-list p.comment-author img {
-       float: left;
-       margin-right: 8px;
+#find-posts-response table {
+       width: 100%;
 }
 
 }
 
-#the-comment-list p.comment-author strong a {
-       border: none;
+#find-posts-response .found-radio {
+       padding: 8px 0 0 8px;
+       width: 15px;
 }
 
 }
 
-#the-comment-list td {
-       vertical-align: top;
+.find-box-buttons {
+       bottom: 12px;
+       left: 12px;
+       position: absolute;
 }
 
 }
 
-#the-comment-list td.comment {
-       width: 65%;
-       max-width: 460px;
-       word-wrap: break-word;
+.find-box-search label {
+       padding-right: 6px;
 }
 
 }
 
-#the-comment-list td.comment p {
-       margin-left: 8px;
+/* favorite-actions */
+#favorite-actions {
+       float: right;
+       margin: 11px 12px 0;
+       min-width: 130px;
+       position: relative;
 }
 
 }
 
-#the-comment-list .check-column {
-       padding-top: 8px;
+#favorite-first {
+       -moz-border-radius: 12px;
+       -khtml-border-radius: 12px;
+       -webkit-border-radius: 12px;
+       border-radius: 12px;
+       line-height: 15px;
+       padding: 3px 30px 4px 12px;
+       border-width: 1px;
+       border-style: solid;
 }
 
 }
 
-#templateside ul li a {
-       text-decoration: none;
+#favorite-inside {
+       margin: 0 0 0 0px;
+       padding: 0 1px 6px 1px;
+       border-width: 1px;
+       border-style: solid;
+       position: absolute;
+       z-index: 11;
+       display: none;
+       -moz-border-radius: 0 0 12px 12px;
+       -webkit-border-bottom-right-radius: 12px;
+       -webkit-border-bottom-left-radius: 12px;
+       -khtml-border-bottom-right-radius: 12px;
+       -khtml-border-bottom-left-radius: 12px;
+       border-bottom-right-radius: 12px;
+       border-bottom-left-radius: 12px;
 }
 
 }
 
-.curtime {
-       background-image: url(images/date-button.gif);
-       background-repeat: no-repeat;
-       background-position: left 2px;
-       padding-left: 18px;
+#favorite-actions a {
+       display: block;
+       text-decoration: none;
+       font-size: 11px;
 }
 
 }
 
-.tablenav .delete {
-       margin-right: 20px;
+#favorite-inside a {
+       padding: 3px 5px 3px 10px;
 }
 
 }
 
-#tTips {
-       display: none;
+#favorite-toggle {
+       height: 22px;
        position: absolute;
        position: absolute;
-       margin: 0;
-       padding: 0 0 8px 0;
-       background-image: url(images/tail.gif);
-       background-repeat: no-repeat;
-       background-position: 15px bottom;
-       background-color: transparent;
+       right: 0;
+       top: 1px;
+       width: 28px;
+}
+
+#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;
+       -khtml-border-bottom-right-radius: 0;
+       -khtml-border-bottom-left-radius: 0;
+       border-bottom-right-radius: 0;
+       border-bottom-left-radius: 0;
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
 }
 
 }
 
-#tTips p#tTips_inside {
-       margin: 0;
-       padding: 8px 12px;
-       text-align: center;
-       -moz-border-radius: 8px;
-       -khtml-border-radius: 8px;
-       -webkit-border-radius: 8px;
-       border-radius: 8px;
+#utc-time, #local-time {
+       padding-left: 25px;
+       font-style: italic;
+       font-family: "Lucida Grande", Verdana, Arial, "Bitstream Vera Sans", sans-serif;
 }
 
 }
 
-td.action-links, th.action-links {
-       text-align: right;
+ul#dismissed-updates {
+       display: none;
+}
+form.upgrade {
+       margin-top: 8px;
 }
 
 }
 
-#poststuff h3, #poststuff .closed h3 {
-       cursor: pointer;
-} 
-
-.hide-if-no-js {
-       display: none;
+#tagsdiv #the-tagcloud {
+       margin: 5px 5px 10px;
+       padding: 8px;
+       border-width: 1px;
+       border-style: solid;
+       line-height: 1.8em;
+       word-spacing: 3px;
+       -moz-border-radius: 6px;
+       -khtml-border-radius: 6px;
+       -webkit-border-radius: 6px;
+       border-radius: 6px;
 }
 
 }
 
-/* Diff */
+br.clear {
+       height: 2px;
+       line-height: 2px;
+}
 
 
-table.diff {
-       width: 100%;
+.swfupload {
+       margin: 5px 10px;
+       vertical-align: middle;
 }
 
 }
 
-table.diff col.content {
-       width: 50%;
+/* table.fixed column width */
+table.fixed {
+       table-layout: fixed;
 }
 
 }
 
-table.diff tr {
-       background-color: transparent;
+.fixed .column-date,
+.fixed .column-parent,
+.fixed .column-visible,
+.fixed .column-links {
+       width: 10%;
 }
 
 }
 
-table.diff td, table.diff th {
-       padding: .5em;
-       font-family: monospace;
-       border: none;
+.fixed .column-response,
+.fixed .column-author,
+.fixed .column-categories,
+.fixed .column-tags,
+.fixed .column-rel,
+.fixed .column-role {
+       width: 15%;
 }
 
 }
 
-table.diff .diff-deletedline del, table.diff .diff-addedline ins {
-       text-decoration: none;
+.fixed .column-comments {
+       width: 4em;
 }
 
 }
 
-#wp-word-count {
-       display: block;
+.fixed .column-slug {
+       width: 25%;
 }
 
 }
 
-fieldset {
-       border: 0;
-       padding: 0;
-       margin: 0;
+.fixed .column-posts {
+       width: 10%;
 }
 
 }
 
-.info-box {
-       top: 100px;
-       left: 50%;
-       margin-left: -225px;
-       height: 300px;
-       width: 450px;
-       border: 5px solid #ddd;
-       background: #f8f8f8;
-       position: absolute;
-       padding: 15px 15px 10px;
-       z-index: 1000;
-       display: none;
+.fixed .column-icon {
+       width: 80px;
 }
 
 }
 
-.info-box .submit {
-       position: absolute;
-       bottom: 15px;
-       width: 450px;
-       padding: 15px 0 0;
+#commentstatusdiv .fixed .column-author,
+#comments-form .fixed .column-author,
+#commentstatusdiv .fixed .column-date {
+       width: 20%;
 }
 
 }
 
-.info-box .gears-img {
-       float: right;
-       margin: 10px;
+.widefat th,
+.widefat td {
+       overflow: hidden;
 }
 
 }
 
-.info-box-title {
-       line-height: 2;
-       margin: 0;
-       padding: 0 7px;
+.widefat th {
+       text-shadow: rgba(255,255,255,0.8) 0 1px 0;
 }
 
 }
 
-#wp_editbtns {
-       padding: 2px;
-       position: absolute;
-       display: none;
-       z-index: 999998;
+.icon32 {
+       float: left;
+       height: 36px;
+       margin: 14px 6px 0 0;
+       width: 36px;
 }
 
 }
 
-#wp_editimgbtn, #wp_delimgbtn {
-       margin: 2px;
-       padding: 2px;
-       border: 1px solid #999;
-       background-color: #eee;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
+.key-labels label {
+       line-height: 24px;
 }
 
 }
 
-#wp_editimgbtn:hover, #wp_delimgbtn:hover {
-       border-color: #555;
-       background-color: #ccc;
+.subtitle {
+       font-size: 0.75em;
+       line-height: 1;
+       padding-left: 25px;
 }
 }
index 8244dab30d4843948bd21e4336500d09f825b4e2..15d924abb08fcb9331a070ba8695c807df998564 100644 (file)
@@ -46,8 +46,9 @@ $app_logging = 0;
 $always_authenticate = 1;
 
 /**
 $always_authenticate = 1;
 
 /**
- * log_app() - Writes logging info to a file.
+ * Writes logging info to a file.
  *
  *
+ * @since 2.2.0
  * @uses $app_logging
  * @package WordPress
  * @subpackage Logging
  * @uses $app_logging
  * @package WordPress
  * @subpackage Logging
@@ -67,16 +68,7 @@ function log_app($label,$msg) {
 
 if ( !function_exists('wp_set_current_user') ) :
 /**
 
 if ( !function_exists('wp_set_current_user') ) :
 /**
- * wp_set_current_user() - Sets the current WordPress User
- *
- * Pluggable function which is also found in pluggable.php.
- *
- * @see wp-includes/pluggable.php Documentation for this function.
- * @uses $current_user Global of current user to test whether $id is the same.
- *
- * @param int $id The user's ID
- * @param string $name Optional. The username of the user.
- * @return WP_User Current user's User object
+ * @ignore
  */
 function wp_set_current_user($id, $name = '') {
        global $current_user;
  */
 function wp_set_current_user($id, $name = '') {
        global $current_user;
@@ -91,10 +83,12 @@ function wp_set_current_user($id, $name = '') {
 endif;
 
 /**
 endif;
 
 /**
- * wa_posts_where_include_drafts_filter() - Filter to add more post statuses
+ * Filter to add more post statuses.
  *
  *
- * @param string $where SQL statement to filter
- * @return string Filtered SQL statement with added post_status for where clause
+ * @since 2.2.0
+ *
+ * @param string $where SQL statement to filter.
+ * @return string Filtered SQL statement with added post_status for where clause.
  */
 function wa_posts_where_include_drafts_filter($where) {
        $where = str_replace("post_status = 'publish'","post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'", $where);
  */
 function wa_posts_where_include_drafts_filter($where) {
        $where = str_replace("post_status = 'publish'","post_status = 'publish' OR post_status = 'future' OR post_status = 'draft' OR post_status = 'inherit'", $where);
@@ -104,37 +98,150 @@ function wa_posts_where_include_drafts_filter($where) {
 add_filter('posts_where', 'wa_posts_where_include_drafts_filter');
 
 /**
 add_filter('posts_where', 'wa_posts_where_include_drafts_filter');
 
 /**
- * @internal
- * Left undocumented to work on later. If you want to finish, then please do so.
+ * WordPress AtomPub API implementation.
  *
  * @package WordPress
  * @subpackage Publishing
  *
  * @package WordPress
  * @subpackage Publishing
+ * @since 2.2.0
  */
 class AtomServer {
 
  */
 class AtomServer {
 
+       /**
+        * ATOM content type.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $ATOM_CONTENT_TYPE = 'application/atom+xml';
        var $ATOM_CONTENT_TYPE = 'application/atom+xml';
+
+       /**
+        * Categories ATOM content type.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $CATEGORIES_CONTENT_TYPE = 'application/atomcat+xml';
        var $CATEGORIES_CONTENT_TYPE = 'application/atomcat+xml';
+
+       /**
+        * Service ATOM content type.
+        *
+        * @since 2.3.0
+        * @var string
+        */
        var $SERVICE_CONTENT_TYPE = 'application/atomsvc+xml';
 
        var $SERVICE_CONTENT_TYPE = 'application/atomsvc+xml';
 
+       /**
+        * ATOM XML namespace.
+        *
+        * @since 2.3.0
+        * @var string
+        */
        var $ATOM_NS = 'http://www.w3.org/2005/Atom';
        var $ATOM_NS = 'http://www.w3.org/2005/Atom';
+
+       /**
+        * ATOMPUB XML namespace.
+        *
+        * @since 2.3.0
+        * @var string
+        */
        var $ATOMPUB_NS = 'http://www.w3.org/2007/app';
 
        var $ATOMPUB_NS = 'http://www.w3.org/2007/app';
 
+       /**
+        * Entries path.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $ENTRIES_PATH = "posts";
        var $ENTRIES_PATH = "posts";
+
+       /**
+        * Categories path.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $CATEGORIES_PATH = "categories";
        var $CATEGORIES_PATH = "categories";
+
+       /**
+        * Media path.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $MEDIA_PATH = "attachments";
        var $MEDIA_PATH = "attachments";
+
+       /**
+        * Entry path.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $ENTRY_PATH = "post";
        var $ENTRY_PATH = "post";
+
+       /**
+        * Service path.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $SERVICE_PATH = "service";
        var $SERVICE_PATH = "service";
+
+       /**
+        * Media single path.
+        *
+        * @since 2.2.0
+        * @var string
+        */
        var $MEDIA_SINGLE_PATH = "attachment";
 
        var $MEDIA_SINGLE_PATH = "attachment";
 
+       /**
+        * ATOMPUB parameters.
+        *
+        * @since 2.2.0
+        * @var array
+        */
        var $params = array();
        var $params = array();
+
+       /**
+        * Supported ATOMPUB media types.
+        *
+        * @since 2.3.0
+        * @var array
+        */
        var $media_content_types = array('image/*','audio/*','video/*');
        var $media_content_types = array('image/*','audio/*','video/*');
+
+       /**
+        * ATOMPUB content type(s).
+        *
+        * @since 2.2.0
+        * @var array
+        */
        var $atom_content_types = array('application/atom+xml');
 
        var $atom_content_types = array('application/atom+xml');
 
+       /**
+        * ATOMPUB methods.
+        *
+        * @since 2.2.0
+        * @var unknown_type
+        */
        var $selectors = array();
 
        var $selectors = array();
 
-       // support for head
+       /**
+        * Whether to do output.
+        *
+        * Support for head.
+        *
+        * @since 2.2.0
+        * @var bool
+        */
        var $do_output = true;
 
        var $do_output = true;
 
+       /**
+        * PHP4 constructor - Sets up object properties.
+        *
+        * @since 2.2.0
+        * @return AtomServer
+        */
        function AtomServer() {
 
                $this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME']));
        function AtomServer() {
 
                $this->script_name = array_pop(explode('/',$_SERVER['SCRIPT_NAME']));
@@ -169,13 +276,18 @@ class AtomServer {
                );
        }
 
                );
        }
 
+       /**
+        * Handle ATOMPUB request.
+        *
+        * @since 2.2.0
+        */
        function handle_request() {
                global $always_authenticate;
 
                if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
                        $path = $_SERVER['ORIG_PATH_INFO'];
                else
        function handle_request() {
                global $always_authenticate;
 
                if( !empty( $_SERVER['ORIG_PATH_INFO'] ) )
                        $path = $_SERVER['ORIG_PATH_INFO'];
                else
-                       $path = $_SERVER['PATH_INFO']; 
+                       $path = $_SERVER['PATH_INFO'];
 
                $method = $_SERVER['REQUEST_METHOD'];
 
 
                $method = $_SERVER['REQUEST_METHOD'];
 
@@ -226,6 +338,11 @@ class AtomServer {
                $this->not_found();
        }
 
                $this->not_found();
        }
 
+       /**
+        * Retrieve XML for ATOMPUB service.
+        *
+        * @since 2.2.0
+        */
        function get_service() {
                log_app('function','get_service()');
 
        function get_service() {
                log_app('function','get_service()');
 
@@ -261,6 +378,11 @@ EOD;
                $this->output($service_doc, $this->SERVICE_CONTENT_TYPE);
        }
 
                $this->output($service_doc, $this->SERVICE_CONTENT_TYPE);
        }
 
+       /**
+        * Retrieve categories list in XML format.
+        *
+        * @since 2.2.0
+        */
        function get_categories_xml() {
                log_app('function','get_categories_xml()');
 
        function get_categories_xml() {
                log_app('function','get_categories_xml()');
 
@@ -284,8 +406,10 @@ EOD;
        $this->output($output, $this->CATEGORIES_CONTENT_TYPE);
 }
 
        $this->output($output, $this->CATEGORIES_CONTENT_TYPE);
 }
 
-       /*
-        * Create Post (No arguments)
+       /**
+        * Create new post.
+        *
+        * @since 2.2.0
         */
        function create_post() {
                global $blog_id, $user_ID;
         */
        function create_post() {
                global $blog_id, $user_ID;
@@ -357,6 +481,13 @@ EOD;
                $this->created($postID, $output);
        }
 
                $this->created($postID, $output);
        }
 
+       /**
+        * Retrieve post.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function get_post($postID) {
                global $entry;
 
        function get_post($postID) {
                global $entry;
 
@@ -370,6 +501,13 @@ EOD;
 
        }
 
 
        }
 
+       /**
+        * Update post.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function put_post($postID) {
                // checked for valid content-types (atom+xml)
                // quick check and exit
        function put_post($postID) {
                // checked for valid content-types (atom+xml)
                // quick check and exit
@@ -419,6 +557,13 @@ EOD;
                $this->ok();
        }
 
                $this->ok();
        }
 
+       /**
+        * Remove post.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function delete_post($postID) {
 
                // check for not found
        function delete_post($postID) {
 
                // check for not found
@@ -444,7 +589,14 @@ EOD;
 
        }
 
 
        }
 
-       function get_attachment($postID = NULL) {
+       /**
+        * Retrieve attachment.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Optional. Post ID.
+        */
+       function get_attachment($postID = null) {
                if( !current_user_can( 'upload_files' ) )
                        $this->auth_required( __( 'Sorry, you do not have permission to upload files.' ) );
 
                if( !current_user_can( 'upload_files' ) )
                        $this->auth_required( __( 'Sorry, you do not have permission to upload files.' ) );
 
@@ -458,6 +610,11 @@ EOD;
                }
        }
 
                }
        }
 
+       /**
+        * Create new attachment.
+        *
+        * @since 2.2.0
+        */
        function create_attachment() {
 
                $type = $this->get_accepted_content_type();
        function create_attachment() {
 
                $type = $this->get_accepted_content_type();
@@ -466,7 +623,7 @@ EOD;
                        $this->auth_required(__('You do not have permission to upload files.'));
 
                $fp = fopen("php://input", "rb");
                        $this->auth_required(__('You do not have permission to upload files.'));
 
                $fp = fopen("php://input", "rb");
-               $bits = NULL;
+               $bits = null;
                while(!feof($fp)) {
                        $bits .= fread($fp, 4096);
                }
                while(!feof($fp)) {
                        $bits .= fread($fp, 4096);
                }
@@ -512,6 +669,13 @@ EOD;
                log_app('function',"create_attachment($postID)");
        }
 
                log_app('function',"create_attachment($postID)");
        }
 
+       /**
+        * Update attachment.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function put_attachment($postID) {
                // checked for valid content-types (atom+xml)
                // quick check and exit
        function put_attachment($postID) {
                // checked for valid content-types (atom+xml)
                // quick check and exit
@@ -552,6 +716,13 @@ EOD;
                $this->ok();
        }
 
                $this->ok();
        }
 
+       /**
+        * Remove attachment.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function delete_attachment($postID) {
                log_app('function',"delete_attachment($postID). File '$location' deleted.");
 
        function delete_attachment($postID) {
                log_app('function',"delete_attachment($postID). File '$location' deleted.");
 
@@ -583,6 +754,13 @@ EOD;
                $this->ok();
        }
 
                $this->ok();
        }
 
+       /**
+        * Retrieve attachment from post.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function get_file($postID) {
 
                // check for not found
        function get_file($postID) {
 
                // check for not found
@@ -614,6 +792,13 @@ EOD;
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Upload file to blog and add attachment to post.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function put_file($postID) {
 
                // first check if user can upload
        function put_file($postID) {
 
                // first check if user can upload
@@ -662,7 +847,15 @@ EOD;
                $this->ok();
        }
 
                $this->ok();
        }
 
-       function get_entries_url($page = NULL) {
+       /**
+        * Retrieve entries URL.
+        *
+        * @since 2.2.0
+        *
+        * @param int $page Page ID.
+        * @return string
+        */
+       function get_entries_url($page = null) {
                if($GLOBALS['post_type'] == 'attachment') {
                        $path = $this->MEDIA_PATH;
                } else {
                if($GLOBALS['post_type'] == 'attachment') {
                        $path = $this->MEDIA_PATH;
                } else {
@@ -675,19 +868,47 @@ EOD;
                return $url;
        }
 
                return $url;
        }
 
-       function the_entries_url($page = NULL) {
+       /**
+        * Display entries URL.
+        *
+        * @since 2.2.0
+        *
+        * @param int $page Page ID.
+        */
+       function the_entries_url($page = null) {
                echo $this->get_entries_url($page);
        }
 
                echo $this->get_entries_url($page);
        }
 
+       /**
+        * Retrieve categories URL.
+        *
+        * @since 2.2.0
+        *
+        * @param mixed $deprecated Optional, not used.
+        * @return string
+        */
        function get_categories_url($deprecated = '') {
                return $this->app_base . $this->CATEGORIES_PATH;
        }
 
        function get_categories_url($deprecated = '') {
                return $this->app_base . $this->CATEGORIES_PATH;
        }
 
+       /**
+        * Display category URL.
+        *
+        * @since 2.2.0
+        */
        function the_categories_url() {
                echo $this->get_categories_url();
        }
 
        function the_categories_url() {
                echo $this->get_categories_url();
        }
 
-       function get_attachments_url($page = NULL) {
+       /**
+        * Retrieve attachment URL.
+        *
+        * @since 2.2.0
+        *
+        * @param int $page Page ID.
+        * @return string
+        */
+       function get_attachments_url($page = null) {
                $url = $this->app_base . $this->MEDIA_PATH;
                if(isset($page) && is_int($page)) {
                        $url .= "/$page";
                $url = $this->app_base . $this->MEDIA_PATH;
                if(isset($page) && is_int($page)) {
                        $url .= "/$page";
@@ -695,15 +916,37 @@ EOD;
                return $url;
        }
 
                return $url;
        }
 
-       function the_attachments_url($page = NULL) {
+       /**
+        * Display attachment URL.
+        *
+        * @since 2.2.0
+        *
+        * @param int $page Page ID.
+        */
+       function the_attachments_url($page = null) {
                echo $this->get_attachments_url($page);
        }
 
                echo $this->get_attachments_url($page);
        }
 
+       /**
+        * Retrieve service URL.
+        *
+        * @since 2.3.0
+        *
+        * @return string
+        */
        function get_service_url() {
                return $this->app_base . $this->SERVICE_PATH;
        }
 
        function get_service_url() {
                return $this->app_base . $this->SERVICE_PATH;
        }
 
-       function get_entry_url($postID = NULL) {
+       /**
+        * Retrieve entry URL.
+        *
+        * @since 2.7.0
+        *
+        * @param int $postID Post ID.
+        * @return string
+        */
+       function get_entry_url($postID = null) {
                if(!isset($postID)) {
                        global $post;
                        $postID = (int) $post->ID;
                if(!isset($postID)) {
                        global $post;
                        $postID = (int) $post->ID;
@@ -715,11 +958,26 @@ EOD;
                return $url;
        }
 
                return $url;
        }
 
-       function the_entry_url($postID = NULL) {
+       /**
+        * Display entry URL.
+        *
+        * @since 2.7.0
+        *
+        * @param int $postID Post ID.
+        */
+       function the_entry_url($postID = null) {
                echo $this->get_entry_url($postID);
        }
 
                echo $this->get_entry_url($postID);
        }
 
-       function get_media_url($postID = NULL) {
+       /**
+        * Retrieve media URL.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        * @return string
+        */
+       function get_media_url($postID = null) {
                if(!isset($postID)) {
                        global $post;
                        $postID = (int) $post->ID;
                if(!isset($postID)) {
                        global $post;
                        $postID = (int) $post->ID;
@@ -731,10 +989,24 @@ EOD;
                return $url;
        }
 
                return $url;
        }
 
-       function the_media_url($postID = NULL) {
+       /**
+        * Display the media URL.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
+       function the_media_url($postID = null) {
                echo $this->get_media_url($postID);
        }
 
                echo $this->get_media_url($postID);
        }
 
+       /**
+        * Set the current entry to post ID.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        */
        function set_current_entry($postID) {
                global $entry;
                log_app('function',"set_current_entry($postID)");
        function set_current_entry($postID) {
                global $entry;
                log_app('function',"set_current_entry($postID)");
@@ -752,19 +1024,44 @@ EOD;
                return;
        }
 
                return;
        }
 
+       /**
+        * Display posts XML.
+        *
+        * @since 2.2.0
+        *
+        * @param int $page Optional. Page ID.
+        * @param string $post_type Optional, default is 'post'. Post Type.
+        */
        function get_posts($page = 1, $post_type = 'post') {
                        log_app('function',"get_posts($page, '$post_type')");
                        $feed = $this->get_feed($page, $post_type);
                        $this->output($feed);
        }
 
        function get_posts($page = 1, $post_type = 'post') {
                        log_app('function',"get_posts($page, '$post_type')");
                        $feed = $this->get_feed($page, $post_type);
                        $this->output($feed);
        }
 
+       /**
+        * Display attachment XML.
+        *
+        * @since 2.2.0
+        *
+        * @param int $page Page ID.
+        * @param string $post_type Optional, default is 'attachment'. Post type.
+        */
        function get_attachments($page = 1, $post_type = 'attachment') {
        function get_attachments($page = 1, $post_type = 'attachment') {
-           log_app('function',"get_attachments($page, '$post_type')");
-           $GLOBALS['post_type'] = $post_type;
-           $feed = $this->get_feed($page, $post_type);
-           $this->output($feed);
+               log_app('function',"get_attachments($page, '$post_type')");
+               $GLOBALS['post_type'] = $post_type;
+               $feed = $this->get_feed($page, $post_type);
+               $this->output($feed);
        }
 
        }
 
+       /**
+        * Retrieve feed XML.
+        *
+        * @since 2.2.0
+        *
+        * @param int $page Page ID.
+        * @param string $post_type Optional, default is post. Post type.
+        * @return string
+        */
        function get_feed($page = 1, $post_type = 'post') {
                global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
                log_app('function',"get_feed($page, '$post_type')");
        function get_feed($page = 1, $post_type = 'post') {
                global $post, $wp, $wp_query, $posts, $wpdb, $blog_id;
                log_app('function',"get_feed($page, '$post_type')");
@@ -822,6 +1119,15 @@ EOD;
                return $feed;
        }
 
                return $feed;
        }
 
+       /**
+        * Display entry XML.
+        *
+        * @since 2.2.0
+        *
+        * @param int $postID Post ID.
+        * @param string $post_type Optional, default is post. Post type.
+        * @return string.
+        */
        function get_entry($postID, $post_type = 'post') {
                log_app('function',"get_entry($postID, '$post_type')");
                ob_start();
        function get_entry($postID, $post_type = 'post') {
                log_app('function',"get_entry($postID, '$post_type')");
                ob_start();
@@ -849,6 +1155,11 @@ EOD;
                return $entry;
        }
 
                return $entry;
        }
 
+       /**
+        * Display post content XML.
+        *
+        * @since 2.3.0
+        */
        function echo_entry() { ?>
 <entry xmlns="<?php echo $this->ATOM_NS ?>"
        xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
        function echo_entry() { ?>
 <entry xmlns="<?php echo $this->ATOM_NS ?>"
        xmlns:app="<?php echo $this->ATOMPUB_NS ?>" xml:lang="<?php echo get_option('rss_language'); ?>">
@@ -886,6 +1197,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
 </entry>
 <?php }
 
 </entry>
 <?php }
 
+       /**
+        * Set 'OK' (200) status header.
+        *
+        * @since 2.2.0
+        */
        function ok() {
                log_app('Status','200: OK');
                header('Content-Type: text/plain');
        function ok() {
                log_app('Status','200: OK');
                header('Content-Type: text/plain');
@@ -893,6 +1209,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'No Content' (204) status header.
+        *
+        * @since 2.2.0
+        */
        function no_content() {
                log_app('Status','204: No Content');
                header('Content-Type: text/plain');
        function no_content() {
                log_app('Status','204: No Content');
                header('Content-Type: text/plain');
@@ -901,6 +1222,13 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Display 'Internal Server Error' (500) status header.
+        *
+        * @since 2.2.0
+        *
+        * @param string $msg Optional. Status string.
+        */
        function internal_error($msg = 'Internal Server Error') {
                log_app('Status','500: Server Error');
                header('Content-Type: text/plain');
        function internal_error($msg = 'Internal Server Error') {
                log_app('Status','500: Server Error');
                header('Content-Type: text/plain');
@@ -909,6 +1237,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'Bad Request' (400) status header.
+        *
+        * @since 2.2.0
+        */
        function bad_request() {
                log_app('Status','400: Bad Request');
                header('Content-Type: text/plain');
        function bad_request() {
                log_app('Status','400: Bad Request');
                header('Content-Type: text/plain');
@@ -916,6 +1249,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'Length Required' (411) status header.
+        *
+        * @since 2.2.0
+        */
        function length_required() {
                log_app('Status','411: Length Required');
                header("HTTP/1.1 411 Length Required");
        function length_required() {
                log_app('Status','411: Length Required');
                header("HTTP/1.1 411 Length Required");
@@ -924,6 +1262,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'Unsupported Media Type' (415) status header.
+        *
+        * @since 2.2.0
+        */
        function invalid_media() {
                log_app('Status','415: Unsupported Media Type');
                header("HTTP/1.1 415 Unsupported Media Type");
        function invalid_media() {
                log_app('Status','415: Unsupported Media Type');
                header("HTTP/1.1 415 Unsupported Media Type");
@@ -931,6 +1274,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'Forbidden' (403) status header.
+        *
+        * @since 2.6.0
+        */
        function forbidden($reason='') {
                log_app('Status','403: Forbidden');
                header('Content-Type: text/plain');
        function forbidden($reason='') {
                log_app('Status','403: Forbidden');
                header('Content-Type: text/plain');
@@ -939,6 +1287,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'Not Found' (404) status header.
+        *
+        * @since 2.2.0
+        */
        function not_found() {
                log_app('Status','404: Not Found');
                header('Content-Type: text/plain');
        function not_found() {
                log_app('Status','404: Not Found');
                header('Content-Type: text/plain');
@@ -946,6 +1299,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'Not Allowed' (405) status header.
+        *
+        * @since 2.2.0
+        */
        function not_allowed($allow) {
                log_app('Status','405: Not Allowed');
                header('Allow: ' . join(',', $allow));
        function not_allowed($allow) {
                log_app('Status','405: Not Allowed');
                header('Allow: ' . join(',', $allow));
@@ -953,6 +1311,11 @@ list($content_type, $content) = prep_atom_text_construct(get_the_content()); ?>
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Display Redirect (302) content and set status headers.
+        *
+        * @since 2.3.0
+        */
        function redirect($url) {
 
                log_app('Status','302: Redirect');
        function redirect($url) {
 
                log_app('Status','302: Redirect');
@@ -978,7 +1341,11 @@ EOD;
 
        }
 
 
        }
 
-
+       /**
+        * Set 'Client Error' (400) status header.
+        *
+        * @since 2.2.0
+        */
        function client_error($msg = 'Client Error') {
                log_app('Status','400: Client Error');
                header('Content-Type: text/plain');
        function client_error($msg = 'Client Error') {
                log_app('Status','400: Client Error');
                header('Content-Type: text/plain');
@@ -986,6 +1353,13 @@ EOD;
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set created status headers (201).
+        *
+        * Sets the 'content-type', 'content-location', and 'location'.
+        *
+        * @since 2.2.0
+        */
        function created($post_ID, $content, $post_type = 'post') {
                log_app('created()::$post_ID',"$post_ID, $post_type");
                $edit = $this->get_entry_url($post_ID);
        function created($post_ID, $content, $post_type = 'post') {
                log_app('created()::$post_ID',"$post_ID, $post_type");
                $edit = $this->get_entry_url($post_ID);
@@ -1006,12 +1380,19 @@ EOD;
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Set 'Auth Required' (401) headers.
+        *
+        * @since 2.2.0
+        *
+        * @param string $msg Status header content and HTML content.
+        */
        function auth_required($msg) {
                log_app('Status','401: Auth Required');
                nocache_headers();
                header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
                header("HTTP/1.1 401 $msg");
        function auth_required($msg) {
                log_app('Status','401: Auth Required');
                nocache_headers();
                header('WWW-Authenticate: Basic realm="WordPress Atom Protocol"');
                header("HTTP/1.1 401 $msg");
-               header('Status: ' . $msg);
+               header('Status: 401 ' . $msg);
                header('Content-Type: text/html');
                $content = <<<EOD
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
                header('Content-Type: text/html');
                $content = <<<EOD
 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
@@ -1030,6 +1411,14 @@ EOD;
                exit;
        }
 
                exit;
        }
 
+       /**
+        * Display XML and set headers with content type.
+        *
+        * @since 2.2.0
+        *
+        * @param string $xml Display feed content.
+        * @param string $ctype Optional, default is 'atom+xml'. Feed content type.
+        */
        function output($xml, $ctype = 'application/atom+xml') {
                        status_header('200');
                        $xml = '<?xml version="1.0" encoding="' . strtolower(get_option('blog_charset')) . '"?>'."\n".$xml;
        function output($xml, $ctype = 'application/atom+xml') {
                        status_header('200');
                        $xml = '<?xml version="1.0" encoding="' . strtolower(get_option('blog_charset')) . '"?>'."\n".$xml;
@@ -1044,6 +1433,13 @@ EOD;
                        exit;
        }
 
                        exit;
        }
 
+       /**
+        * Sanitize content for database usage.
+        *
+        * @since 2.2.0
+        *
+        * @param array $array Sanitize array and multi-dimension array.
+        */
        function escape(&$array) {
                global $wpdb;
 
        function escape(&$array) {
                global $wpdb;
 
@@ -1058,8 +1454,12 @@ EOD;
                }
        }
 
                }
        }
 
-       /*
-        * Access credential through various methods and perform login
+       /**
+        * Access credential through various methods and perform login.
+        *
+        * @since 2.2.0
+        *
+        * @return bool
         */
        function authenticate() {
                log_app("authenticate()",print_r($_ENV, true));
         */
        function authenticate() {
                log_app("authenticate()",print_r($_ENV, true));
@@ -1069,6 +1469,11 @@ EOD;
                if(isset($_SERVER['HTTP_AUTHORIZATION'])) {
                        list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
                                explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
                if(isset($_SERVER['HTTP_AUTHORIZATION'])) {
                        list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
                                explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
+               } else if (isset($_SERVER['REDIRECT_REMOTE_USER'])) {
+                       // Workaround for setups that do not forward HTTP_AUTHORIZATION
+                       // See http://trac.wordpress.org/ticket/7361
+                       list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
+                               explode(':', base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6)));
                }
 
                // If Basic Auth is working...
                }
 
                // If Basic Auth is working...
@@ -1085,7 +1490,15 @@ EOD;
                return false;
        }
 
                return false;
        }
 
-       function get_accepted_content_type($types = NULL) {
+       /**
+        * Retrieve accepted content types.
+        *
+        * @since 2.2.0
+        *
+        * @param array $types Optional. Content Types.
+        * @return string
+        */
+       function get_accepted_content_type($types = null) {
 
                if(!isset($types)) {
                        $types = $this->media_content_types;
 
                if(!isset($types)) {
                        $types = $this->media_content_types;
@@ -1111,6 +1524,11 @@ EOD;
                $this->invalid_media();
        }
 
                $this->invalid_media();
        }
 
+       /**
+        * Process conditionals for posts.
+        *
+        * @since 2.2.0
+        */
        function process_conditionals() {
 
                if(empty($this->params)) return;
        function process_conditionals() {
 
                if(empty($this->params)) return;
@@ -1154,31 +1572,52 @@ EOD;
                }
        }
 
                }
        }
 
+       /**
+        * Convert RFC3339 time string to timestamp.
+        *
+        * @since 2.3.0
+        *
+        * @param string $str String to time.
+        * @return bool|int false if format is incorrect.
+        */
        function rfc3339_str2time($str) {
 
        function rfc3339_str2time($str) {
 
-           $match = false;
-           if(!preg_match("/(\d{4}-\d{2}-\d{2})T(\d{2}\:\d{2}\:\d{2})\.?\d{0,3}(Z|[+-]+\d{2}\:\d{2})/", $str, $match))
+               $match = false;
+               if(!preg_match("/(\d{4}-\d{2}-\d{2})T(\d{2}\:\d{2}\:\d{2})\.?\d{0,3}(Z|[+-]+\d{2}\:\d{2})/", $str, $match))
                        return false;
 
                        return false;
 
-           if($match[3] == 'Z')
+               if($match[3] == 'Z')
                        $match[3] == '+0000';
 
                        $match[3] == '+0000';
 
-           return strtotime($match[1] . " " . $match[2] . " " . $match[3]);
+               return strtotime($match[1] . " " . $match[2] . " " . $match[3]);
        }
 
        }
 
+       /**
+        * Retrieve published time to display in XML.
+        *
+        * @since 2.3.0
+        *
+        * @param string $published Time string.
+        * @return string
+        */
        function get_publish_time($published) {
 
        function get_publish_time($published) {
 
-           $pubtime = $this->rfc3339_str2time($published);
+               $pubtime = $this->rfc3339_str2time($published);
 
 
-           if(!$pubtime) {
+               if(!$pubtime) {
                        return array(current_time('mysql'),current_time('mysql',1));
                        return array(current_time('mysql'),current_time('mysql',1));
-           } else {
+               } else {
                        return array(date("Y-m-d H:i:s", $pubtime), gmdate("Y-m-d H:i:s", $pubtime));
                        return array(date("Y-m-d H:i:s", $pubtime), gmdate("Y-m-d H:i:s", $pubtime));
-           }
+               }
        }
 
 }
 
        }
 
 }
 
+/**
+ * AtomServer
+ * @var AtomServer
+ * @global object $server
+ */
 $server = new AtomServer();
 $server->handle_request();
 
 $server = new AtomServer();
 $server->handle_request();
 
index 9e20eb68ee2e0e5dda988f323ec11bbeb087d239..f7221f3fe8dda4eea0d5cb491f8676f71cdc7962 100644 (file)
@@ -1,21 +1,12 @@
 <?php
 /**
 <?php
 /**
- * Outputs the Atom feed XML format using the feed-atom.php file in wp-includes
- * folder. This file only sets the feed format and includes the feed-atom.php.
- *
- * This file is no longer used in WordPress and while it is not deprecated now.
- * This file will most likely be deprecated or removed in a later version.
- *
- * The link for the atom feed is /index.php?feed=atom with permalinks off.
+ * Redirects to the Atom feed
+ * This file is deprecated and only exists for backwards compatibility
  *
  * @package WordPress
  */
 
  *
  * @package WordPress
  */
 
-if (empty($wp)) {
-       require_once('./wp-load.php');
-       wp('feed=atom');
-}
-
-require (ABSPATH . WPINC . '/feed-atom.php');
+require( './wp-load.php' );
+wp_redirect( get_bloginfo( 'atom_url' ), 301 );
 
 ?>
\ No newline at end of file
 
 ?>
\ No newline at end of file
index 96ab8947a9c8e07a3a8acb63a4562415ece6d7a0..64cc8e3295661ffc2482f3c246af2540f16f7ebf 100644 (file)
@@ -32,14 +32,16 @@ if ( empty($status->comment_status) ) {
        exit;
 }
 
        exit;
 }
 
-$comment_author       = trim(strip_tags($_POST['author']));
-$comment_author_email = trim($_POST['email']);
-$comment_author_url   = trim($_POST['url']);
-$comment_content      = trim($_POST['comment']);
+$comment_author       = ( isset($_POST['author']) )  ? trim(strip_tags($_POST['author'])) : null;
+$comment_author_email = ( isset($_POST['email']) )   ? trim($_POST['email']) : null;
+$comment_author_url   = ( isset($_POST['url']) )     ? trim($_POST['url']) : null;
+$comment_content      = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;
 
 // If the user is logged in
 $user = wp_get_current_user();
 if ( $user->ID ) {
 
 // If the user is logged in
 $user = wp_get_current_user();
 if ( $user->ID ) {
+       if ( empty( $user->display_name ) )
+               $user->display_name=$user->user_login;
        $comment_author       = $wpdb->escape($user->display_name);
        $comment_author_email = $wpdb->escape($user->user_email);
        $comment_author_url   = $wpdb->escape($user->user_url);
        $comment_author       = $wpdb->escape($user->display_name);
        $comment_author_email = $wpdb->escape($user->user_email);
        $comment_author_url   = $wpdb->escape($user->user_url);
@@ -66,7 +68,9 @@ if ( get_option('require_name_email') && !$user->ID ) {
 if ( '' == $comment_content )
        wp_die( __('Error: please type a comment.') );
 
 if ( '' == $comment_content )
        wp_die( __('Error: please type a comment.') );
 
-$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'user_ID');
+$comment_parent = isset($_POST['comment_parent']) ? absint($_POST['comment_parent']) : 0;
+
+$commentdata = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content', 'comment_type', 'comment_parent', 'user_ID');
 
 $comment_id = wp_new_comment( $commentdata );
 
 
 $comment_id = wp_new_comment( $commentdata );
 
@@ -77,7 +81,7 @@ if ( !$user->ID ) {
        setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
 }
 
        setcookie('comment_author_url_' . COOKIEHASH, clean_url($comment->comment_author_url), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN);
 }
 
-$location = ( empty($_POST['redirect_to']) ? get_permalink($comment_post_ID) : $_POST['redirect_to'] ) . '#comment-' . $comment_id;
+$location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
 $location = apply_filters('comment_post_redirect', $location, $comment);
 
 wp_redirect($location);
 $location = apply_filters('comment_post_redirect', $location, $comment);
 
 wp_redirect($location);
index 9c3b230f626fd589702e27368df5984382f14c37..1c146b1472cbeaed4cd26a8648b5b267c9a89a0e 100644 (file)
@@ -1,23 +1,12 @@
 <?php
 /**
 <?php
 /**
- * Outputs the RSS2 XML format comment feed using the feed-rss2.php file in
- * wp-includes folder. This file only sets the feed format and includes the
- * feed-rss2-comments.php.
- *
- * This file is no longer used in WordPress and while it is not deprecated now.
- * This file will most likely be deprecated or removed in a later version.
- *
- * The link for the rss2 comment feed is /index.php?feed=rss2&withcomments=1
- * with permalinks off.
+ * Redirects to the Comments RSS2 feed
+ * This file is deprecated and only exists for backwards compatibility
  *
  * @package WordPress
  */
 
  *
  * @package WordPress
  */
 
-if (empty($wp)) {
-       require_once('./wp-load.php');
-       wp('feed=rss2&withcomments=1');
-}
-
-require (ABSPATH . WPINC . '/feed-rss2-comments.php');
+require( './wp-load.php' );
+wp_redirect( get_bloginfo( 'comments_rss2_url' ), 301 );
 
 ?>
\ No newline at end of file
 
 ?>
\ No newline at end of file
index f557e6d05ebe7d0af501b52465af5d60a1e392a3..c0013a38433652f7d4941a165dcecd7d360294d7 100644 (file)
@@ -1,31 +1,76 @@
 <?php\r
 <?php\r
-// ** MySQL settings ** //\r
-define('DB_NAME', 'putyourdbnamehere');    // The name of the database\r
-define('DB_USER', 'usernamehere');     // Your MySQL username\r
-define('DB_PASSWORD', 'yourpasswordhere'); // ...and password\r
-define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value\r
+/** \r
+ * The base configurations of the WordPress.\r
+ *\r
+ * This file has the following configurations: MySQL settings, Table Prefix,\r
+ * Secret Keys, WordPress Language, and ABSPATH. You can find more information by\r
+ * visiting {@link http://codex.wordpress.org/Editing_wp-config.php Editing\r
+ * wp-config.php} Codex page. You can get the MySQL settings from your web host.\r
+ *\r
+ * This file is used by the wp-config.php creation script during the\r
+ * installation. You don't have to use the web site, you can just copy this file\r
+ * to "wp-config.php" and fill in the values.\r
+ *\r
+ * @package WordPress\r
+ */\r
+\r
+// ** MySQL settings - You can get this info from your web host ** //\r
+/** The name of the database for WordPress */\r
+define('DB_NAME', 'putyourdbnamehere');\r
+\r
+/** MySQL database username */\r
+define('DB_USER', 'usernamehere');\r
+\r
+/** MySQL database password */\r
+define('DB_PASSWORD', 'yourpasswordhere');\r
+\r
+/** MySQL hostname */\r
+define('DB_HOST', 'localhost');\r
+\r
+/** Database Charset to use in creating database tables. */\r
 define('DB_CHARSET', 'utf8');\r
 define('DB_CHARSET', 'utf8');\r
+\r
+/** The Database Collate type. Don't change this if in doubt. */\r
 define('DB_COLLATE', '');\r
 \r
 define('DB_COLLATE', '');\r
 \r
-// Change each KEY to a different unique phrase.  You won't have to remember the phrases later,\r
-// so make them long and complicated.  You can visit http://api.wordpress.org/secret-key/1.1/\r
-// to get keys generated for you, or just make something up.  Each key should have a different phrase.\r
-define('AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.\r
-define('SECURE_AUTH_KEY', 'put your unique phrase here'); // Change this to a unique phrase.\r
-define('LOGGED_IN_KEY', 'put your unique phrase here'); // Change this to a unique phrase.\r
+/**#@+\r
+ * Authentication Unique Keys.\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
+ *\r
+ * @since 2.6.0\r
+ */\r
+define('AUTH_KEY', 'put your unique phrase here');\r
+define('SECURE_AUTH_KEY', 'put your unique phrase here');\r
+define('LOGGED_IN_KEY', 'put your unique phrase here');\r
+define('NONCE_KEY', 'put your unique phrase here');\r
+/**#@-*/\r
 \r
 \r
-// You can have multiple installations in one database if you give each a unique prefix\r
-$table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!\r
+/**\r
+ * WordPress Database Table prefix.\r
+ *\r
+ * You can have multiple installations in one database if you give each a unique\r
+ * prefix. Only numbers, letters, and underscores please!\r
+ */\r
+$table_prefix  = 'wp_';\r
 \r
 \r
-// Change this to localize WordPress.  A corresponding MO file for the\r
-// chosen language must be installed to wp-content/languages.\r
-// For example, install de.mo to wp-content/languages and set WPLANG to 'de'\r
-// to enable German language support.\r
+/**\r
+ * WordPress Localized Language, defaults to English.\r
+ *\r
+ * Change this to localize WordPress.  A corresponding MO file for the chosen\r
+ * language must be installed to wp-content/languages. For example, install\r
+ * de.mo to wp-content/languages and set WPLANG to 'de' to enable German\r
+ * language support.\r
+ */\r
 define ('WPLANG', '');\r
 \r
 /* That's all, stop editing! Happy blogging. */\r
 \r
 define ('WPLANG', '');\r
 \r
 /* That's all, stop editing! Happy blogging. */\r
 \r
+/** WordPress absolute path to the Wordpress directory. */\r
 if ( !defined('ABSPATH') )\r
        define('ABSPATH', dirname(__FILE__) . '/');\r
 if ( !defined('ABSPATH') )\r
        define('ABSPATH', dirname(__FILE__) . '/');\r
+\r
+/** Sets up WordPress vars and included files. */\r
 require_once(ABSPATH . 'wp-settings.php');\r
 ?>\r
 require_once(ABSPATH . 'wp-settings.php');\r
 ?>\r
index 21933883c678c827a9b0994709849997600f93f4..20034734795715c418aa3745b9239e64e84d1c7d 100644 (file)
@@ -2,8 +2,8 @@
 /*
 Plugin Name: Akismet
 Plugin URI: http://akismet.com/
 /*
 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(); ?></code> in your template. See also: <a href="http://wordpress.org/extend/plugins/stats/">WP Stats plugin</a>.
-Version: 2.1.8
+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
 Author: Matt Mullenweg
 Author URI: http://ma.tt/
 */
 Author: Matt Mullenweg
 Author URI: http://ma.tt/
 */
@@ -21,9 +21,19 @@ function akismet_init() {
 
        $akismet_api_port = 80;
        add_action('admin_menu', 'akismet_config_page');
 
        $akismet_api_port = 80;
        add_action('admin_menu', 'akismet_config_page');
+       add_action('admin_menu', 'akismet_stats_page');
 }
 add_action('init', 'akismet_init');
 
 }
 add_action('init', 'akismet_init');
 
+function akismet_admin_init() {
+       if ( function_exists( 'get_plugin_page_hook' ) )
+               $hook = get_plugin_page_hook( 'akismet-stats-display', 'index.php' );
+       else
+               $hook = 'dashboard_page_akismet-stats-display';
+       add_action('admin_head-'.$hook, 'akismet_stats_script');
+}
+add_action('admin_init', 'akismet_admin_init');
+
 if ( !function_exists('wp_nonce_field') ) {
        function akismet_nonce_field($action = -1) { return; }
        $akismet_nonce = -1;
 if ( !function_exists('wp_nonce_field') ) {
        function akismet_nonce_field($action = -1) { return; }
        $akismet_nonce = -1;
@@ -137,6 +147,43 @@ function akismet_conf() {
 <?php
 }
 
 <?php
 }
 
+function akismet_stats_page() {
+       if ( function_exists('add_submenu_page') )
+               add_submenu_page('index.php', __('Akismet Stats'), __('Akismet Stats'), 'manage_options', 'akismet-stats-display', 'akismet_stats_display');
+
+}
+
+function akismet_stats_script() {
+       ?>
+<script type="text/javascript">
+function resizeIframe() {
+    var height = document.documentElement.clientHeight;
+    height -= document.getElementById('akismet-stats-frame').offsetTop;
+    height += 100; // magic padding
+    
+    document.getElementById('akismet-stats-frame').style.height = height +"px";
+    
+};
+function resizeIframeInit() {
+       document.getElementById('akismet-stats-frame').onload = resizeIframe;
+       window.onresize = resizeIframe;
+}
+addLoadEvent(resizeIframeInit);
+</script><?php
+}
+
+
+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}";
+       ?>
+       <div class="wrap">
+       <iframe src="<?php echo $url; ?>" width="100%" height="100%" frameborder="0" id="akismet-stats-frame"></iframe>
+       </div>
+       <?php
+}
+
 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') );
@@ -263,6 +310,9 @@ add_action('wp_set_comment_status', 'akismet_submit_spam_comment');
 add_action('edit_comment', 'akismet_submit_spam_comment');
 add_action('preprocess_comment', 'akismet_auto_check_comment', 1);
 
 add_action('edit_comment', 'akismet_submit_spam_comment');
 add_action('preprocess_comment', 'akismet_auto_check_comment', 1);
 
+function akismet_spamtoham( $comment ) { akismet_submit_nonspam_comment( $comment->comment_ID ); }
+add_filter( 'comment_spam_to_approved', 'akismet_spamtoham' );
+
 // Total spam in queue
 // get_option( 'akismet_spam_count' ) is the total caught ever
 function akismet_spam_count( $type = false ) {
 // Total spam in queue
 // get_option( 'akismet_spam_count' ) is the total caught ever
 function akismet_spam_count( $type = false ) {
@@ -660,11 +710,14 @@ add_action('activity_box_end', 'akismet_stats');
 
 // WP 2.5+
 function akismet_rightnow() {
 
 // WP 2.5+
 function akismet_rightnow() {
-       global $submenu;
-       if ( isset( $submenu['edit-comments.php'] ) )
-               $link = 'edit-comments.php';
+       global $submenu, $wp_db_version;
+
+       if ( 8645 < $wp_db_version  ) // 2.7
+               $link = 'edit-comments.php?comment_status=spam';
+       elseif ( isset( $submenu['edit-comments.php'] ) )
+               $link = 'edit-comments.php?page=akismet-admin';
        else
        else
-               $link = 'edit.php';
+               $link = 'edit.php?page=akismet-admin';
 
        if ( $count = get_option('akismet_spam_count') ) {
                $intro = sprintf( __ngettext(
 
        if ( $count = get_option('akismet_spam_count') ) {
                $intro = sprintf( __ngettext(
@@ -681,9 +734,9 @@ function akismet_rightnow() {
                        'and there\'s <a href="%2$s">%1$s comment</a> in your spam queue right now.',
                        'and there are <a href="%2$s">%1$s comments</a> in your spam queue right now.',
                        $queue_count
                        'and there\'s <a href="%2$s">%1$s comment</a> in your spam queue right now.',
                        'and there are <a href="%2$s">%1$s comments</a> in your spam queue right now.',
                        $queue_count
-               ), number_format_i18n( $queue_count ), clean_url("$link?page=akismet-admin") );
+               ), number_format_i18n( $queue_count ), clean_url($link) );
        } else {
        } else {
-               $queue_text = sprintf( __( "but there's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), clean_url("$link?page=akismet-admin") );
+               $queue_text = sprintf( __( "but there's nothing in your <a href='%1\$s'>spam queue</a> at the moment." ), clean_url($link) );
        }
 
        $text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text );
        }
 
        $text = sprintf( _c( '%1$s %2$s|akismet_rightnow' ), $intro, $queue_text );
index abc5f97b8d7a2ab4f265ddf625a03e7fcf3a905f..08a01bbf3d8cf6b5809a97bf7014ba85ab1efb5d 100644 (file)
@@ -1,4 +1,9 @@
 <?php
 <?php
+/**
+ * @package Hello_Dolly
+ * @author Matt Mullenweg
+ * @version 1.5
+ */
 /*
 Plugin Name: Hello Dolly
 Plugin URI: http://wordpress.org/#
 /*
 Plugin Name: Hello Dolly
 Plugin URI: http://wordpress.org/#
@@ -8,8 +13,9 @@ Version: 1.5
 Author URI: http://ma.tt/
 */
 
 Author URI: http://ma.tt/
 */
 
-// These are the lyrics to Hello Dolly
-$lyrics = "Hello, Dolly
+function hello_dolly_get_lyric() {
+       /** These are the lyrics to Hello Dolly */
+       $lyrics = "Hello, Dolly
 Well, hello, Dolly
 It's so nice to have you back where you belong
 You're lookin' swell, Dolly
 Well, hello, Dolly
 It's so nice to have you back where you belong
 You're lookin' swell, Dolly
@@ -38,14 +44,16 @@ Dolly'll never go away
 Dolly'll never go away
 Dolly'll never go away again";
 
 Dolly'll never go away
 Dolly'll never go away again";
 
-// Here we split it into lines
-$lyrics = explode("\n", $lyrics);
-// And then randomly choose a line
-$chosen = wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
+       // Here we split it into lines
+       $lyrics = explode("\n", $lyrics);
+
+       // And then randomly choose a line
+       return wptexturize( $lyrics[ mt_rand(0, count($lyrics) - 1) ] );
+}
 
 // This just echoes the chosen line, we'll position it later
 function hello_dolly() {
 
 // This just echoes the chosen line, we'll position it later
 function hello_dolly() {
-       global $chosen;
+       $chosen = hello_dolly_get_lyric();
        echo "<p id='dolly'>$chosen</p>";
 }
 
        echo "<p id='dolly'>$chosen</p>";
 }
 
@@ -58,12 +66,11 @@ function dolly_css() {
        <style type='text/css'>
        #dolly {
                position: absolute;
        <style type='text/css'>
        #dolly {
                position: absolute;
-               top: 2.3em;
+               top: 4.5em;
                margin: 0;
                padding: 0;
                margin: 0;
                padding: 0;
-               right: 10px;
-               font-size: 16px;
-               color: #d54e21;
+               right: 215px;
+               font-size: 11px;
        }
        </style>
        ";
        }
        </style>
        ";
@@ -71,4 +78,4 @@ function dolly_css() {
 
 add_action('admin_head', 'dolly_css');
 
 
 add_action('admin_head', 'dolly_css');
 
-?>
\ No newline at end of file
+?>
index 4e0a6057e9b31520d48a3d7050bb2f9891db7ab2..fdcb8932252537f02137a59b26a74ff275aa4c66 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 <?php
-/* Don't remove these lines. */
-add_filter('comment_text', 'popuplinks');
-while( have_posts()) : the_post();
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+/**
+ * @package WordPress
+ * @subpackage Classic_Theme
+ */
+?><!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><?php echo get_option('blogname'); ?> - <?php echo sprintf(__("Comments on %s"), the_title('','',false)); ?></title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
      <title><?php echo get_option('blogname'); ?> - <?php echo sprintf(__("Comments on %s"), the_title('','',false)); ?></title>
@@ -19,6 +19,13 @@ while( have_posts()) : the_post();
 
 <h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>
 
 
 <h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>
 
+<?php
+/* Don't remove these lines. */
+add_filter('comment_text', 'popuplinks');
+if ( have_posts() ) :
+while( have_posts()) : the_post();
+?>
+
 <h2 id="comments"><?php _e("Comments"); ?></h2>
 
 <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>
 <h2 id="comments"><?php _e("Comments"); ?></h2>
 
 <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>
@@ -33,7 +40,7 @@ $commenter = wp_get_current_commenter();
 extract($commenter);
 $comments = get_approved_comments($id);
 $commentstatus = get_post($id);
 extract($commenter);
 $comments = get_approved_comments($id);
 $commentstatus = get_post($id);
-if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $commentstatus->post_password) {  // and it doesn't match the cookie
+if ( post_password_required($commentstatus) ) {  // and it doesn't match the cookie
        echo(get_the_password_form());
 } else { ?>
 
        echo(get_the_password_form());
 } else { ?>
 
@@ -42,7 +49,7 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
 <?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(__('Comment'), __('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(_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>
        </li>
 
 <?php } // end for each comment ?>
        </li>
 
 <?php } // end for each comment ?>
@@ -57,13 +64,11 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 <?php if ( $user_ID ) : ?>
 
 <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 get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php echo attribute_escape(__('Log out of this account')); ?>"><?php _e('Log out &raquo;'); ?></a></p>
+<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 else : ?>
        <p>
          <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
           <label for="author"><?php _e("Name"); ?></label>
 <?php else : ?>
        <p>
          <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
           <label for="author"><?php _e("Name"); ?></label>
-       <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"]); ?>" />
        </p>
 
        <p>
        </p>
 
        <p>
@@ -84,6 +89,8 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
        </p>
 
        <p>
        </p>
 
        <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!"); ?>" />
        </p>
        <?php do_action('comment_form', $post->ID); ?>
          <input name="submit" type="submit" tabindex="5" value="<?php _e("Say It!"); ?>" />
        </p>
        <?php do_action('comment_form', $post->ID); ?>
@@ -97,8 +104,11 @@ if (!empty($commentstatus->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH
 <div><strong><a href="javascript:window.close()"><?php _e("Close this window."); ?></a></strong></div>
 
 <?php // if you delete this the sky will fall on your head
 <div><strong><a href="javascript:window.close()"><?php _e("Close this window."); ?></a></strong></div>
 
 <?php // if you delete this the sky will fall on your head
-endwhile;
+endwhile; //endwhile have_posts()
+else: //have_posts()
 ?>
 ?>
+<p>Sorry, no posts matched your criteria.</p>
+<?php endif; ?>
 
 <!-- // this is just the end of the motor - don't touch that line either :) -->
 <?php //} ?>
 
 <!-- // this is just the end of the motor - don't touch that line either :) -->
 <?php //} ?>
index bf02bedd787013ff0e5d351ecd6878bf45eb6dfc..b3fe7291504986d8b7787fcc53cba93fab26253a 100644 (file)
@@ -1,4 +1,10 @@
-<?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Classic_Theme
+ */
+
+if ( post_password_required() ) : ?>
 <p><?php _e('Enter your password to view comments.'); ?></p>
 <?php return; endif; ?>
 
 <p><?php _e('Enter your password to view comments.'); ?></p>
 <?php return; endif; ?>
 
 <ol id="commentlist">
 
 <?php foreach ($comments as $comment) : ?>
 <ol id="commentlist">
 
 <?php foreach ($comments as $comment) : ?>
-       <li id="comment-<?php comment_ID() ?>">
+       <li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
        <?php echo get_avatar( $comment, 32 ); ?>
        <?php comment_text() ?>
        <?php echo get_avatar( $comment, 32 ); ?>
        <?php comment_text() ?>
-       <p><cite><?php comment_type(__('Comment'), __('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(_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>
        </li>
 
 <?php endforeach; ?>
        </li>
 
 <?php endforeach; ?>
@@ -43,7 +49,7 @@
 
 <?php if ( $user_ID ) : ?>
 
 
 <?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 get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>
+<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 : ?>
 
 
 <?php else : ?>
 
index 0894f78edaa84d3b804d4274a1589e7c25dff012..819ed428a3ddf4c71a3810f592b75093b466e573 100644 (file)
@@ -1,3 +1,9 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Classic_Theme
+ */
+?>
 <!-- begin footer -->
 </div>
 
 <!-- begin footer -->
 </div>
 
index a63850cc50240cc62152ea3eabea5ffb83ee55a8..40d4a46f8e19caf50fc7def8e33c738a26687272 100644 (file)
@@ -1,10 +1,14 @@
 <?php
 <?php
+/**
+ * @package WordPress
+ * @subpackage Classic_Theme
+ */
 if ( function_exists('register_sidebar') )
        register_sidebar(array(
 if ( function_exists('register_sidebar') )
        register_sidebar(array(
-        'before_widget' => '<li id="%1$s" class="widget %2$s">',
-        'after_widget' => '</li>',
-        'before_title' => '',
-        'after_title' => '',
-    ));
+               'before_widget' => '<li id="%1$s" class="widget %2$s">',
+               'after_widget' => '</li>',
+               'before_title' => '',
+               'after_title' => '',
+       ));
 
 ?>
 
 ?>
index 4a3e0b4f4660c05e4b478d948b0a928db77979ee..e08c95d05bfe8e1737342a7e22c5ae7c755f7487 100644 (file)
@@ -1,10 +1,16 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Classic_Theme
+ */
+?>
 <!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 profile="http://gmpg.org/xfn/11">
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('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 profile="http://gmpg.org/xfn/11">
        <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
 
-       <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>
+       <title><?php wp_title('&laquo;', true, 'right'); ?> <?php bloginfo('name'); ?></title>
 
        <style type="text/css" media="screen">
                @import url( <?php bloginfo('stylesheet_url'); ?> );
 
        <style type="text/css" media="screen">
                @import url( <?php bloginfo('stylesheet_url'); ?> );
index d6ca2ca4f96cc698820b5b46bcfef1f0a42a661f..6cb8c63f603b6d1aae11b4d0c52057a29d0ec437 100644 (file)
@@ -1,4 +1,8 @@
 <?php
 <?php
+/**
+ * @package WordPress
+ * @subpackage Classic_Theme
+ */
 get_header();
 ?>
 
 get_header();
 ?>
 
@@ -6,7 +10,7 @@ get_header();
 
 <?php the_date('','<h2>','</h2>'); ?>
 
 
 <?php the_date('','<h2>','</h2>'); ?>
 
-<div class="post" id="post-<?php the_ID(); ?>">
+<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
         <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
        <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_tags(__('Tags: '), ', ', ' &#8212; '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
 
         <h3 class="storytitle"><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h3>
        <div class="meta"><?php _e("Filed under:"); ?> <?php the_category(',') ?> &#8212; <?php the_tags(__('Tags: '), ', ', ' &#8212; '); ?> <?php the_author() ?> @ <?php the_time() ?> <?php edit_post_link(__('Edit This')); ?></div>
 
index a038b64bdf379ed3f178508b96a05e3ebd2cac6a..18188fff44c7a5d73ef271933ae181776459d4bf 100644 (file)
@@ -28,6 +28,16 @@ acronym, abbr, span.caps, h2, p, li, #header, #menu ul li, #menu ul ul li, #wp-c
        border-right: 1px solid #ddd;
 }
 
        border-right: 1px solid #ddd;
 }
 
+#commentlist li .avatar {
+       margin-right: 0;
+       margin-left: 12px;
+}
+
+#commentlist li .avatar {
+       margin-right: 0;
+       margin-left: 12px;
+}
+
 #content {
        margin: 30px 3em 0 13em;
        padding-right: 0;
 #content {
        margin: 30px 3em 0 13em;
        padding-right: 0;
index e4a680abb67f5e2cdf4a2ad78d2cf9130cf89561..0c8a12eac2926498a6ef60ce4da69511aea45e13 100644 (file)
@@ -1,4 +1,9 @@
-
+<?php
+/**
+ * @package WordPress
+ * @subpackage Classic_Theme
+ */
+?>
 <!-- begin sidebar -->
 <div id="menu">
 
 <!-- begin sidebar -->
 <div id="menu">
 
index 01a8e8a617e65e66fcfb87d1a513ee3dc511fb35..f9fee472adff2358c9bca86e07c195cab897de81 100644 (file)
@@ -1,4 +1,11 @@
-<?php get_header(); ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+get_header();
+?>
 
        <div id="content" class="narrowcolumn">
 
 
        <div id="content" class="narrowcolumn">
 
index 8ec2e2b58aa61f769f31633e820b8f3741fe19cc..3d4d8b8e9420879b4bbeeb83fc2041158c9c79eb 100644 (file)
@@ -1,4 +1,11 @@
-<?php get_header(); ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+get_header();
+?>
 
        <div id="content" class="narrowcolumn">
 
 
        <div id="content" class="narrowcolumn">
 
@@ -28,7 +35,7 @@
                </div>
 
                <?php while (have_posts()) : the_post(); ?>
                </div>
 
                <?php while (have_posts()) : the_post(); ?>
-               <div class="post">
+               <div <?php post_class() ?>>
                                <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
                                <small><?php the_time('l, F jS, Y') ?></small>
 
                                <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
                                <small><?php the_time('l, F jS, Y') ?></small>
 
                        <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
                        <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
                </div>
                        <div class="alignleft"><?php next_posts_link('&laquo; Older Entries') ?></div>
                        <div class="alignright"><?php previous_posts_link('Newer Entries &raquo;') ?></div>
                </div>
-
-       <?php else : ?>
-
-               <h2 class="center">Not Found</h2>
-               <?php include (TEMPLATEPATH . '/searchform.php'); ?>
-
-       <?php endif; ?>
+       <?php else :
+
+               if ( is_category() ) { // If this is a category archive
+                       printf("<h2 class='center'>Sorry, but there aren't any posts in the %s category yet.</h2>", single_cat_title('',false));
+               } else if ( is_date() ) { // If this is a date archive
+                       echo("<h2>Sorry, but there aren't any posts with this date.</h2>");
+               } else if ( is_author() ) { // If this is a category archive
+                       $userdata = get_userdatabylogin(get_query_var('author_name'));
+                       printf("<h2 class='center'>Sorry, but there aren't any posts by %s yet.</h2>", $userdata->display_name);
+               } else {
+                       echo("<h2 class='center'>No posts found.</h2>");
+               }
+               get_search_form();
+
+       endif;
+?>
 
        </div>
 
 
        </div>
 
index dba8dbd14927127a069f35b3df87876700c197ce..20428056be136f1a9fe918e764279679115063b4 100644 (file)
@@ -1,4 +1,8 @@
 <?php
 <?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
 /*
 Template Name: Archives
 */
 /*
 Template Name: Archives
 */
@@ -8,7 +12,7 @@ Template Name: Archives
 
 <div id="content" class="widecolumn">
 
 
 <div id="content" class="widecolumn">
 
-<?php include (TEMPLATEPATH . '/searchform.php'); ?>
+<?php get_search_form(); ?>
 
 <h2>Archives by Month:</h2>
        <ul>
 
 <h2>Archives by Month:</h2>
        <ul>
index a57ff21ce9bb7ca11daa9b547e1d2cb2ea952621..b54c07f3e46ddaec397bf3b4df7fe81750f8c922 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 <?php
-/* Don't remove these lines. */
-add_filter('comment_text', 'popuplinks');
-while ( have_posts()) : the_post();
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+?><!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><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title>
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
      <title><?php echo get_option('blogname'); ?> - Comments on <?php the_title(); ?></title>
@@ -19,6 +19,12 @@ while ( have_posts()) : the_post();
 
 <h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>
 
 
 <h1 id="header"><a href="" title="<?php echo get_option('blogname'); ?>"><?php echo get_option('blogname'); ?></a></h1>
 
+<?php
+/* Don't remove these lines. */
+add_filter('comment_text', 'popuplinks');
+if ( have_posts() ) :
+while ( have_posts() ) : the_post();
+?>
 <h2 id="comments">Comments</h2>
 
 <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>
 <h2 id="comments">Comments</h2>
 
 <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>
@@ -33,7 +39,7 @@ $commenter = wp_get_current_commenter();
 extract($commenter);
 $comments = get_approved_comments($id);
 $post = get_post($id);
 extract($commenter);
 $comments = get_approved_comments($id);
 $post = get_post($id);
-if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
+if ( post_password_required($post) ) {  // and it doesn't match the cookie
        echo(get_the_password_form());
 } else { ?>
 
        echo(get_the_password_form());
 } else { ?>
 
@@ -57,13 +63,11 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 <?php if ( $user_ID ) : ?>
 
 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
 <?php if ( $user_ID ) : ?>
-       <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out &raquo;</a></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" />
           <label for="author">Name</label>
 <?php else : ?>
        <p>
          <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
           <label for="author">Name</label>
-       <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"]); ?>" />
        </p>
 
        <p>
        </p>
 
        <p>
@@ -84,6 +88,8 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos
        </p>
 
        <p>
        </p>
 
        <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="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); ?>
@@ -97,9 +103,11 @@ if (!empty($post->post_password) && $_COOKIE['wp-postpass_'. COOKIEHASH] != $pos
 <div><strong><a href="javascript:window.close()">Close this window.</a></strong></div>
 
 <?php // if you delete this the sky will fall on your head
 <div><strong><a href="javascript:window.close()">Close this window.</a></strong></div>
 
 <?php // if you delete this the sky will fall on your head
-endwhile;
+endwhile; //endwhile have_posts()
+else: //have_posts()
 ?>
 ?>
-
+<p>Sorry, no posts matched your criteria.</p>
+<?php endif; ?>
 <!-- // this is just the end of the motor - don't touch that line either :) -->
 <?php //} ?>
 <p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>WordPress</strong></a></cite></p>
 <!-- // this is just the end of the motor - don't touch that line either :) -->
 <?php //} ?>
 <p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>WordPress</strong></a></cite></p>
index ec2f6c4f5c3dc5ec1799bffd8690ae8c230fef4b..94a677a92f3aa9f6c14c8aed0d8b98ce69c83b14 100644 (file)
@@ -1,54 +1,38 @@
-<?php // Do not delete these lines
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+// Do not delete these lines
        if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
                die ('Please do not load this page directly. Thanks!');
 
        if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
                die ('Please do not load this page directly. Thanks!');
 
-       if (!empty($post->post_password)) { // if there's a password
-               if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) {  // and it doesn't match the cookie
-                       ?>
-
-                       <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
-
-                       <?php
-                       return;
-               }
+       if ( post_password_required() ) { ?>
+               <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
+       <?php
+               return;
        }
        }
-
-       /* This variable is for alternating comment background */
-       $oddcomment = 'class="alt" ';
 ?>
 
 <!-- You can start editing here. -->
 
 ?>
 
 <!-- You can start editing here. -->
 
-<?php if ($comments) : ?>
+<?php if ( have_comments() ) : ?>
        <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
 
        <h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to &#8220;<?php the_title(); ?>&#8221;</h3>
 
-       <ol class="commentlist">
-
-       <?php foreach ($comments as $comment) : ?>
-
-               <li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>">
-                       <?php echo get_avatar( $comment, 32 ); ?>
-                       <cite><?php comment_author_link() ?></cite> Says:
-                       <?php if ($comment->comment_approved == '0') : ?>
-                       <em>Your comment is awaiting moderation.</em>
-                       <?php endif; ?>
-                       <br />
-
-                       <small class="commentmetadata"><a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?></small>
-
-                       <?php comment_text() ?>
-
-               </li>
-
-       <?php
-               /* Changes every other comment to a different class */
-               $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : '';
-       ?>
-
-       <?php endforeach; /* end for each comment */ ?>
+       <div class="navigation">
+               <div class="alignleft"><?php previous_comments_link() ?></div>
+               <div class="alignright"><?php next_comments_link() ?></div>
+       </div>
 
 
+       <ol class="commentlist">
+       <?php wp_list_comments(); ?>
        </ol>
 
        </ol>
 
+       <div class="navigation">
+               <div class="alignleft"><?php previous_comments_link() ?></div>
+               <div class="alignright"><?php next_comments_link() ?></div>
+       </div>
  <?php else : // this is displayed if there are no comments so far ?>
 
        <?php if ('open' == $post->comment_status) : ?>
  <?php else : // this is displayed if there are no comments so far ?>
 
        <?php if ('open' == $post->comment_status) : ?>
 
 <?php if ('open' == $post->comment_status) : ?>
 
 
 <?php if ('open' == $post->comment_status) : ?>
 
-<h3 id="respond">Leave a Reply</h3>
+<div id="respond">
+
+<h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
+
+<div class="cancel-comment-reply">
+       <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') && !$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>
@@ -74,7 +64,7 @@
 
 <?php if ( $user_ID ) : ?>
 
 
 <?php if ( $user_ID ) : ?>
 
-<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out &raquo;</a></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 : ?>
 
 
 <?php else : ?>
 
 <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="Submit Comment" />
 <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="Submit Comment" />
-<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
+<?php comment_id_fields(); ?>
 </p>
 <?php do_action('comment_form', $post->ID); ?>
 
 </form>
 
 <?php endif; // If registration required and not logged in ?>
 </p>
 <?php do_action('comment_form', $post->ID); ?>
 
 </form>
 
 <?php endif; // If registration required and not logged in ?>
+</div>
 
 <?php endif; // if you delete this the sky will fall on your head ?>
 
 <?php endif; // if you delete this the sky will fall on your head ?>
index 91cb69fdc99f613ecd3521fd1ef6a6ab9a2f1f1e..49ab67660d6dea787700b635b32bb7ab3a4496ac 100644 (file)
@@ -1,3 +1,9 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+?>
 
 <hr />
 <div id="footer">
 
 <hr />
 <div id="footer">
index e0451e7df441f72e8754e995d63743748c7edfae..340d23c333cbbbe6c990992cccc549d2d784df2b 100644 (file)
@@ -1,4 +1,9 @@
 <?php
 <?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
 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">',
@@ -7,6 +12,7 @@ if ( function_exists('register_sidebar') )
         'after_title' => '</h2>',
     ));
 
         'after_title' => '</h2>',
     ));
 
+/** @ignore */
 function kubrick_head() {
        $head = "<style type='text/css'>\n<!--";
        $output = '';
 function kubrick_head() {
        $head = "<style type='text/css'>\n<!--";
        $output = '';
@@ -357,8 +363,8 @@ function kubrick_theme_page() {
        if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>';
 ?>
 <div class='wrap'>
        if ( isset( $_REQUEST['saved'] ) ) echo '<div id="message" class="updated fade"><p><strong>'.__('Options saved.').'</strong></p></div>';
 ?>
 <div class='wrap'>
+       <h2><?php _e('Customize Header'); ?></h2>
        <div id="kubrick-header">
        <div id="kubrick-header">
-       <h2><?php _e('Header Image and Color'); ?></h2>
                <div id="headwrap">
                        <div id="header">
                                <div id="headerimg">
                <div id="headwrap">
                        <div id="header">
                                <div id="headerimg">
@@ -397,7 +403,7 @@ function kubrick_theme_page() {
                                <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()); ?>" />
                                <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="defbutton" value="<?php echo attribute_escape(__('Update Header')); ?>" onclick="cp.hidePopup('prettyplease')" /></p>
+                               <p class="submit"><input type="submit" name="submitform" class="button-primary" value="<?php echo attribute_escape(__('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>
                        <div id="colorPickerDiv" style="z-index: 100;background:#eee;border:1px solid #ccc;position:absolute;visibility:hidden;"> </div>
                        <div id="advanced">
index b881290554b7016dd433f426eb0cd9c10ffd870d..558689f624373d8d80eb706c6223963830dea767 100644 (file)
@@ -1,13 +1,20 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+?>
 <!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 profile="http://gmpg.org/xfn/11">
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('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 profile="http://gmpg.org/xfn/11">
 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
 
-<title><?php bloginfo('name'); ?> <?php if ( is_single() ) { ?> &raquo; Blog Archive <?php } ?> <?php wp_title(); ?></title>
+<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="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">
 <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
 
 <style type="text/css" media="screen">
@@ -23,6 +30,8 @@ if ( !empty($withcomments) && !is_single() ) {
 
 </style>
 
 
 </style>
 
+<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
+
 <?php wp_head(); ?>
 </head>
 <body>
 <?php wp_head(); ?>
 </head>
 <body>
index 5e039806af0ad3979e1c7891606e54f8d7639f5e..80dad8ace8383ac856b13e3a6e208d4a065dc75f 100644 (file)
@@ -1,4 +1,11 @@
-<?php get_header(); ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+get_header();
+?>
 
        <div id="content" class="widecolumn">
 
 
        <div id="content" class="widecolumn">
 
@@ -8,7 +15,7 @@
                        <h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h2>
                        <div class="entry">
                                <p class="attachment"><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a></p>
                        <h2><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a> &raquo; <?php the_title(); ?></h2>
                        <div class="entry">
                                <p class="attachment"><a href="<?php echo wp_get_attachment_url($post->ID); ?>"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a></p>
-                <div class="caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?></div>
+                               <div class="caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt(); // this is the "caption" ?></div>
 
                                <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
 
 
                                <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
 
index 75629d7011fbfd1fbaceacc8bf01142c2f292552..50bd3c370cc244d46b428b850e4f0c20890f4342 100644 (file)
@@ -1,5 +1,10 @@
 <?php
 <?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
 
 
+/** @ignore */
 $img = 'kubrickheader.jpg';
 
 // If we don't have image processing support, redirect.
 $img = 'kubrickheader.jpg';
 
 // If we don't have image processing support, redirect.
index 6b692ce2bc12ea6b508e4006470f6489a34a1a03..0d70c2305df51787000a1debf7af0dcc8f2090d0 100644 (file)
@@ -1,4 +1,10 @@
-<?php get_header(); ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+get_header(); ?>
 
        <div id="content" class="narrowcolumn">
 
 
        <div id="content" class="narrowcolumn">
 
@@ -6,7 +12,7 @@
 
                <?php while (have_posts()) : the_post(); ?>
 
 
                <?php while (have_posts()) : the_post(); ?>
 
-                       <div class="post" id="post-<?php the_ID(); ?>">
+                       <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
 
                                <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
                                <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small>
 
@@ -28,7 +34,7 @@
 
                <h2 class="center">Not Found</h2>
                <p class="center">Sorry, but you are looking for something that isn't here.</p>
 
                <h2 class="center">Not Found</h2>
                <p class="center">Sorry, but you are looking for something that isn't here.</p>
-               <?php include (TEMPLATEPATH . "/searchform.php"); ?>
+               <?php get_search_form(); ?>
 
        <?php endif; ?>
 
 
        <?php endif; ?>
 
index e253e09ba05fdd572c7f91599593f73921eacf17..81fdc008dba93fcd323531f442c87310ed1efb2e 100644 (file)
@@ -1,4 +1,9 @@
 <?php
 <?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
 /*
 Template Name: Links
 */
 /*
 Template Name: Links
 */
index a6e3ca6a2f325a87153aadebad3d159828af1d0b..bd77efb67992319d0f01092ce80499425a4c0614 100644 (file)
@@ -1,4 +1,10 @@
-<?php get_header(); ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+get_header(); ?>
 
        <div id="content" class="narrowcolumn">
 
 
        <div id="content" class="narrowcolumn">
 
index 910b65ec8acdcacdd94d81b33c8a31c4e6e2f6af..3e93ffce75973920931ace9cdfd1f7a38de8940c 100644 (file)
@@ -1,4 +1,10 @@
-<?php get_header(); ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+get_header(); ?>
 
        <div id="content" class="narrowcolumn">
 
 
        <div id="content" class="narrowcolumn">
 
@@ -14,7 +20,7 @@
 
                <?php while (have_posts()) : the_post(); ?>
 
 
                <?php while (have_posts()) : the_post(); ?>
 
-                       <div class="post">
+                       <div <?php post_class() ?>>
                                <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
                                <small><?php the_time('l, F jS, Y') ?></small>
 
                                <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
                                <small><?php the_time('l, F jS, Y') ?></small>
 
@@ -31,7 +37,7 @@
        <?php else : ?>
 
                <h2 class="center">No posts found. Try a different search?</h2>
        <?php else : ?>
 
                <h2 class="center">No posts found. Try a different search?</h2>
-               <?php include (TEMPLATEPATH . '/searchform.php'); ?>
+               <?php get_search_form(); ?>
 
        <?php endif; ?>
 
 
        <?php endif; ?>
 
diff --git a/wp-content/themes/default/searchform.php b/wp-content/themes/default/searchform.php
deleted file mode 100644 (file)
index 300a1c4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
-<label class="hidden" for="s"><?php _e('Search for:'); ?></label>
-<div><input type="text" value="<?php the_search_query(); ?>" name="s" id="s" />
-<input type="submit" id="searchsubmit" value="Search" />
-</div>
-</form>
index 36dea86f62bb0751793a18303ff8bffc9283a344..79c3122939d659bd0c5457ab0295567c32c20e75 100644 (file)
@@ -1,9 +1,15 @@
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+?>
        <div id="sidebar">
                <ul>
                        <?php   /* Widgetized sidebar, if you have the plugin installed. */
                                        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
                        <li>
        <div id="sidebar">
                <ul>
                        <?php   /* Widgetized sidebar, if you have the plugin installed. */
                                        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
                        <li>
-                               <?php include (TEMPLATEPATH . '/searchform.php'); ?>
+                               <?php get_search_form(); ?>
                        </li>
 
                        <!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
                        </li>
 
                        <!-- Author information is disabled per default. Uncomment and fill in your details if you want to use it.
index b3bf7863c765a7e674a6bc77b3646aa81ac7553f..5658bbf45c4ada04bdcf617dc2e6aebc71bb1d7e 100644 (file)
@@ -1,4 +1,11 @@
-<?php get_header(); ?>
+<?php
+/**
+ * @package WordPress
+ * @subpackage Default_Theme
+ */
+
+get_header();
+?>
 
        <div id="content" class="widecolumn">
 
 
        <div id="content" class="widecolumn">
 
@@ -9,7 +16,7 @@
                        <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
                </div>
 
                        <div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
                </div>
 
-               <div class="post" id="post-<?php the_ID(); ?>">
+               <div <?php post_class() ?> id="post-<?php the_ID(); ?>">
                        <h2><?php the_title(); ?></h2>
 
                        <div class="entry">
                        <h2><?php the_title(); ?></h2>
 
                        <div class="entry">
index b80a0ef8288f02bab02adc9d17c702c0c668bd9b..2edff6a4f8d1b0be7c5a39c9fa5c3c10dacfc04f 100644 (file)
@@ -65,11 +65,20 @@ body {
        text-align: center;
        }
 
        text-align: center;
        }
 
-.alt {
+.thread-alt {
        background-color: #f8f8f8;
        background-color: #f8f8f8;
-       border-top: 1px solid #ddd;
-       border-bottom: 1px solid #ddd;
-       }
+}
+.thread-even {
+       background-color: white;
+}
+.depth-1 {
+border: 1px solid #ddd;
+}
+
+.even, .alt {
+
+       border-left: 1px solid #ddd;
+}
 
 #footer {
        background: #eee url('images/kubrickfooter.jpg') no-repeat top;
 
 #footer {
        background: #eee url('images/kubrickfooter.jpg') no-repeat top;
@@ -134,10 +143,13 @@ h2, h2 a, h2 a:hover, h2 a:visited, h3, h3 a, h3 a:hover, h3 a:visited, #sidebar
 .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;
        }
+.commentlist li ul li {
+       font-size: 1em;
+}
 
 .commentlist li {
        font-weight: bold;
 
 .commentlist li {
        font-weight: bold;
-       }
+}
 
 .commentlist li .avatar { 
        float: right;
 
 .commentlist li .avatar { 
        float: right;
@@ -488,13 +500,22 @@ select {
        margin: 5px 5px 1px 0;
        }
 
        margin: 5px 5px 1px 0;
        }
 
+#commentform {
+       margin: 5px 10px 0 0;
+       }
 #commentform textarea {
        width: 100%;
        padding: 2px;
        }
 #commentform textarea {
        width: 100%;
        padding: 2px;
        }
-
+#respond:after {
+               content: "."; 
+           display: block; 
+           height: 0; 
+           clear: both; 
+           visibility: hidden;
+       }
 #commentform #submit {
 #commentform #submit {
-       margin: 0;
+       margin: 0 0 5px auto;
        float: right;
        }
 /* End Form Elements */
        float: right;
        }
 /* End Form Elements */
@@ -513,14 +534,20 @@ select {
        }
 
 .commentlist li {
        }
 
 .commentlist li {
-       margin: 15px 0 3px;
-       padding: 5px 10px 3px;
+       margin: 15px 0 10px;
+       padding: 5px 5px 10px 10px;
        list-style: none;
        list-style: none;
+
        }
        }
+.commentlist li ul li { 
+       margin-right: -5px;
+       margin-left: 10px;
+}
 
 .commentlist p {
        margin: 10px 5px 10px 0;
 
 .commentlist p {
        margin: 10px 5px 10px 0;
-       }
+}
+.children { padding: 0; }
 
 #commentform p {
        margin: 5px 0;
 
 #commentform p {
        margin: 5px 0;
index efd66c68b67ba590a27112ce9c5da2dac15ff89d..f7b3fa16b3c19c9017c1fb65f1da54900bb974d6 100644 (file)
@@ -23,31 +23,41 @@ require_once('./wp-load.php');
 if ( $_GET['check'] != wp_hash('187425') )
        exit;
 
 if ( $_GET['check'] != wp_hash('187425') )
        exit;
 
-if ( get_option('doing_cron') > time() )
-       exit;
-
-update_option('doing_cron', time() + 30);
+$local_time = time();
 
 $crons = _get_cron_array();
 
 $crons = _get_cron_array();
-$keys = array_keys($crons);
-if (!is_array($crons) || $keys[0] > time())
+$keys = array_keys( $crons );
+
+if (!is_array($crons) || $keys[0] > $local_time) {
+       update_option('doing_cron', 0);
        return;
        return;
+}
+
+foreach ($crons as $timestamp  => $cronhooks) {
+
+       if ( $timestamp > $local_time )
+               break;
 
 
-foreach ($crons as $timestamp => $cronhooks) {
-       if ($timestamp > time()) break;
        foreach ($cronhooks as $hook => $keys) {
        foreach ($cronhooks as $hook => $keys) {
-               foreach ($keys as $key => $args) {
-                       $schedule = $args['schedule'];
+
+               foreach ($keys as $k => $v) {
+
+                       $schedule = $v['schedule'];
+
                        if ($schedule != false) {
                        if ($schedule != false) {
-                               $new_args = array($timestamp, $schedule, $hook, $args['args']);
+                               $new_args = array($timestamp, $schedule, $hook, $v['args']);
                                call_user_func_array('wp_reschedule_event', $new_args);
                        }
                                call_user_func_array('wp_reschedule_event', $new_args);
                        }
-                       wp_unschedule_event($timestamp, $hook, $args['args']);
-                       do_action_ref_array($hook, $args['args']);
+
+                       wp_unschedule_event($timestamp, $hook, $v['args']);
+
+                       do_action_ref_array($hook, $v['args']);
                }
        }
 }
 
 update_option('doing_cron', 0);
 
                }
        }
 }
 
 update_option('doing_cron', 0);
 
-?>
\ No newline at end of file
+die();
+
+?>
index d4f1a5bff0bf7e7641fb2a5e4364b6fae61e855c..78daa6d226fb042f92607279ef1741f315378156 100644 (file)
@@ -1,24 +1,12 @@
 <?php
 /**
 <?php
 /**
- * Outputs the RSS2 feed XML format. This file is a shortcut or compatibility
- * layer for easily finding the RSS feed for the site. It loads WordPress using
- * the wp-blog-header.php file and running do_feed() function.
- *
- * @see do_feed() Used to display the RSS2 feed
- *
- * This file is no longer used in WordPress and while it is not deprecated now.
- * This file will most likely be deprecated or removed in a later version.
- *
- * The link for the rss2 feed is /index.php?feed=rss2 with permalinks off.
+ * Redirects to the RSS2 feed
+ * This file is deprecated and only exists for backwards compatibility
  *
  * @package WordPress
  */
 
  *
  * @package WordPress
  */
 
-if (empty($doing_rss)) {
-       $doing_rss = 1;
-       require(dirname(__FILE__) . '/wp-blog-header.php');
-}
-
-do_feed();
+require( './wp-load.php' );
+wp_redirect( get_bloginfo( 'rss2_url' ), 301 );
 
 
-?>
+?>
\ No newline at end of file
index c62b4bc0270671164ac21a1c5c90cdbede9de209..7cc6291c6d5c60aa235a5b133c6d0c690f837c1d 100644 (file)
@@ -381,7 +381,7 @@ function the_author_posts() {
  * link to the author's posts.
  *
  * @link http://codex.wordpress.org/Template_Tags/the_author_posts_link
  * link to the author's posts.
  *
  * @link http://codex.wordpress.org/Template_Tags/the_author_posts_link
- * @since 1.2
+ * @since 1.2.0
  * @uses $authordata The current author's DB object.
  * @uses get_author_posts_url()
  * @uses get_the_author()
  * @uses $authordata The current author's DB object.
  * @uses get_author_posts_url()
  * @uses get_the_author()
@@ -400,7 +400,7 @@ function the_author_posts_link($deprecated = '') {
 /**
  * Retrieve the URL to the author page of the author of the current post.
  *
 /**
  * Retrieve the URL to the author page of the author of the current post.
  *
- * @since 2.1
+ * @since 2.1.0
  * @uses $wp_rewrite WP_Rewrite
  * @return string The URL to the author's page.
  */
  * @uses $wp_rewrite WP_Rewrite
  * @return string The URL to the author's page.
  */
@@ -453,7 +453,7 @@ function get_author_name( $auth_id ) {
  * echo (boolean) (true): Set to false to return the output, instead of echoing.
  *
  * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
  * echo (boolean) (true): Set to false to return the output, instead of echoing.
  *
  * @link http://codex.wordpress.org/Template_Tags/wp_list_authors
- * @since 1.2
+ * @since 1.2.0
  * @param array $args The argument array.
  * @return null|string The output, if echo is set to false.
  */
  * @param array $args The argument array.
  * @return null|string The output, if echo is set to false.
  */
@@ -499,7 +499,7 @@ function wp_list_authors($args = '') {
                                $link .= ' ';
                                if (empty($feed_image))
                                        $link .= '(';
                                $link .= ' ';
                                if (empty($feed_image))
                                        $link .= '(';
-                               $link .= '<a href="' . get_author_rss_link(0, $author->ID, $author->user_nicename) . '"';
+                               $link .= '<a href="' . get_author_feed_link($author->ID) . '"';
 
                                if ( !empty($feed) ) {
                                        $title = ' title="' . $feed . '"';
 
                                if ( !empty($feed) ) {
                                        $title = ' title="' . $feed . '"';
index e687e5622af44a528d96c7a0d70483cfc67a9834..844f664f772a4b8633105e516ba99635df4371aa 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 /**
  */
 
 /**
- * The formatted output of a list of bookmarks
+ * The formatted output of a list of bookmarks.
  *
  * The $bookmarks array must contain bookmark objects and will be iterated over
  * to retrieve the bookmark to be used in the output.
  *
  * The $bookmarks array must contain bookmark objects and will be iterated over
  * to retrieve the bookmark to be used in the output.
  *             of the bookmark.
  * 'show_images' - Default is 1 (integer). Whether to show link image if
  *             available.
  *             of the bookmark.
  * 'show_images' - Default is 1 (integer). Whether to show link image if
  *             available.
+ * 'show_name' - Default is 0 (integer). Whether to show link name if
+ *             available.
  * 'before' - Default is '<li>' (string). The html or text to prepend to each
  *             bookmarks.
  * 'after' - Default is '</li>' (string). The html or text to append to each
  *             bookmarks.
  * 'before' - Default is '<li>' (string). The html or text to prepend to each
  *             bookmarks.
  * 'after' - Default is '</li>' (string). The html or text to append to each
  *             bookmarks.
+ * 'link_before' - Default is '' (string). The html or text to prepend to each
+ *             bookmarks inside the <a> tag.
+ * 'link_after' - Default is '' (string). The html or text to append to each
+ *             bookmarks inside the <a> tag.
  * 'between' - Default is '\n' (string). The string for use in between the link,
  *             description, and image.
  * 'show_rating' - Default is 0 (integer). Whether to show the link rating.
  *
  * 'between' - Default is '\n' (string). The string for use in between the link,
  *             description, and image.
  * 'show_rating' - Default is 0 (integer). Whether to show the link rating.
  *
- * @since 2.1
+ * @since 2.1.0
  * @access private
  * @usedby wp_list_bookmarks()
  *
  * @access private
  * @usedby wp_list_bookmarks()
  *
@@ -45,9 +51,9 @@
 function _walk_bookmarks($bookmarks, $args = '' ) {
        $defaults = array(
                'show_updated' => 0, 'show_description' => 0,
 function _walk_bookmarks($bookmarks, $args = '' ) {
        $defaults = array(
                'show_updated' => 0, 'show_description' => 0,
-               'show_images' => 1, 'before' => '<li>',
-               'after' => '</li>', 'between' => "\n",
-               'show_rating' => 0
+               'show_images' => 1, 'show_name' => 0,
+               'before' => '<li>', 'after' => '</li>', 'between' => "\n",
+               'show_rating' => 0, 'link_before' => '', 'link_after' => ''
        );
 
        $r = wp_parse_args( $args, $defaults );
        );
 
        $r = wp_parse_args( $args, $defaults );
@@ -92,15 +98,21 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 
                $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 ) {
                        if ( strpos($bookmark->link_image, 'http') !== false )
                                $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 ( $bookmark->link_image != null && $show_images ) {
                        if ( strpos($bookmark->link_image, 'http') !== false )
                                $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;
                } else {
                        $output .= $name;
                }
 
                } else {
                        $output .= $name;
                }
 
+               $output .= $link_after;
+
                $output .= '</a>';
 
                if ( $show_updated && $bookmark->recently_updated )
                $output .= '</a>';
 
                if ( $show_updated && $bookmark->recently_updated )
@@ -110,7 +122,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
                        $output .= $between . $desc;
 
                if ($show_rating) {
                        $output .= $between . $desc;
 
                if ($show_rating) {
-                       $output .= $between . get_linkrating($bookmark);
+                       $output .= $between . sanitize_bookmark_field('link_rating', $bookmark->link_rating, $bookmark->link_id, 'display');
                }
 
                $output .= "$after\n";
                }
 
                $output .= "$after\n";
@@ -120,7 +132,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
 }
 
 /**
 }
 
 /**
- * Retrieve or echo all of the bookmarks
+ * Retrieve or echo all of the bookmarks.
  *
  * List of default arguments are as follows:
  * 'orderby' - Default is 'name' (string). How to order the links by. String is
  *
  * List of default arguments are as follows:
  * 'orderby' - Default is 'name' (string). How to order the links by. String is
@@ -174,7 +186,7 @@ function _walk_bookmarks($bookmarks, $args = '' ) {
  *             passed to get_bookmarks().
  * @link http://codex.wordpress.org/Template_Tags/wp_list_bookmarks
  *
  *             passed to get_bookmarks().
  * @link http://codex.wordpress.org/Template_Tags/wp_list_bookmarks
  *
- * @since 2.1
+ * @since 2.1.0
  * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return
  *             the html
  * @uses get_terms() Gets all of the categories that are for links.
  * @uses _list_bookmarks() Used to iterate over all of the bookmarks and return
  *             the html
  * @uses get_terms() Gets all of the categories that are for links.
@@ -239,4 +251,4 @@ function wp_list_bookmarks($args = '') {
        echo $output;
 }
 
        echo $output;
 }
 
-?>
\ No newline at end of file
+?>
index 260dbafbe7c546ce5391653000e280368df61113..3a04a5cd6ec3d08250e5ab8572d91f1e4f96c69b 100644 (file)
@@ -9,7 +9,7 @@
 /**
  * Retrieve Bookmark data based on ID
  *
 /**
  * Retrieve Bookmark data based on ID
  *
- * @since 2.1
+ * @since 2.1.0
  * @uses $wpdb Database Object
  *
  * @param int $bookmark_id
  * @uses $wpdb Database Object
  *
  * @param int $bookmark_id
  * @param string $filter Optional, default is 'raw'.
  * @return array|object Type returned depends on $output value.
  */
  * @param string $filter Optional, default is 'raw'.
  * @return array|object Type returned depends on $output value.
  */
-function get_bookmark($bookmark_id, $output = OBJECT, $filter = 'raw') {
+function get_bookmark($bookmark, $output = OBJECT, $filter = 'raw') {
        global $wpdb;
 
        global $wpdb;
 
-       $link = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark_id));
-       $link->link_category = array_unique( wp_get_object_terms($link->link_id, 'link_category', 'fields=ids') );
+       if ( empty($bookmark) ) {
+               if ( isset($GLOBALS['link']) )
+                       $_bookmark = & $GLOBALS['link'];
+               else
+                       $_bookmark = null;
+       } elseif ( is_object($bookmark) ) {
+               wp_cache_add($bookmark->link_id, $bookmark, 'bookmark');
+               $_bookmark = $bookmark;
+       } else {
+               if ( isset($GLOBALS['link']) && ($GLOBALS['link']->link_id == $bookmark) ) {
+                       $_bookmark = & $GLOBALS['link'];
+               } elseif ( ! $_bookmark = wp_cache_get($bookmark, 'bookmark') ) {
+                       $_bookmark = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->links WHERE link_id = %d LIMIT 1", $bookmark));
+                       $_bookmark->link_category = array_unique( wp_get_object_terms($_bookmark->link_id, 'link_category', 'fields=ids') );
+                       wp_cache_add($_bookmark->link_id, $_bookmark, 'bookmark');
+               }
+       }
 
 
-       $link = sanitize_bookmark($link, $filter);
+       $_bookmark = sanitize_bookmark($_bookmark, $filter);
 
        if ( $output == OBJECT ) {
 
        if ( $output == OBJECT ) {
-               return $link;
+               return $_bookmark;
        } elseif ( $output == ARRAY_A ) {
        } elseif ( $output == ARRAY_A ) {
-               return get_object_vars($link);
+               return get_object_vars($_bookmark);
        } elseif ( $output == ARRAY_N ) {
        } elseif ( $output == ARRAY_N ) {
-               return array_values(get_object_vars($link));
+               return array_values(get_object_vars($_bookmark));
        } else {
        } else {
-               return $link;
+               return $_bookmark;
        }
 }
 
 /**
  * Retrieve single bookmark data item or field.
  *
        }
 }
 
 /**
  * Retrieve single bookmark data item or field.
  *
- * @since 2.3
+ * @since 2.3.0
  * @uses get_bookmark() Gets bookmark object using $bookmark as ID
  * @uses sanitize_bookmark_field() Sanitizes Bookmark field based on $context.
  *
  * @uses get_bookmark() Gets bookmark object using $bookmark as ID
  * @uses sanitize_bookmark_field() Sanitizes Bookmark field based on $context.
  *
@@ -67,7 +82,7 @@ function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
 /**
  * Retrieve bookmark data based on ID.
  *
 /**
  * Retrieve bookmark data based on ID.
  *
- * @since 2.0
+ * @since 2.0.0
  * @deprecated Use get_bookmark()
  * @see get_bookmark()
  *
  * @deprecated Use get_bookmark()
  * @see get_bookmark()
  *
@@ -106,7 +121,7 @@ function get_link($bookmark_id, $output = OBJECT, $filter = 'raw') {
  * 'exclude' - Default is empty string (string). Exclude other categories
  *             separated by commas.
  *
  * 'exclude' - Default is empty string (string). Exclude other categories
  *             separated by commas.
  *
- * @since 2.1
+ * @since 2.1.0
  * @uses $wpdb Database Object
  * @link http://codex.wordpress.org/Template_Tags/get_bookmarks
  *
  * @uses $wpdb Database Object
  * @link http://codex.wordpress.org/Template_Tags/get_bookmarks
  *
@@ -238,7 +253,7 @@ function get_bookmarks($args = '') {
 /**
  * Sanitizes all bookmark fields
  *
 /**
  * Sanitizes all bookmark fields
  *
- * @since 2.3
+ * @since 2.3.0
  *
  * @param object|array $bookmark Bookmark row
  * @param string $context Optional, default is 'display'. How to filter the
  *
  * @param object|array $bookmark Bookmark row
  * @param string $context Optional, default is 'display'. How to filter the
@@ -250,15 +265,22 @@ function sanitize_bookmark($bookmark, $context = 'display') {
                'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated',
                'link_rel', 'link_notes', 'link_rss', );
 
                'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated',
                'link_rel', 'link_notes', 'link_rss', );
 
-       $do_object = false;
-       if ( is_object($bookmark) )
+       if ( is_object($bookmark) ) {
                $do_object = true;
                $do_object = true;
+               $link_id = $bookmark->link_id;
+       } else {
+               $do_object = false;
+               $link_id = $bookmark['link_id'];
+       }
 
        foreach ( $fields as $field ) {
 
        foreach ( $fields as $field ) {
-               if ( $do_object )
-                       $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context);
-               else
-                       $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $bookmark['link_id'], $context);
+               if ( $do_object ) {
+                       if ( isset($bookmark->$field) )
+                               $bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context);
+               } else {
+                       if ( isset($bookmark[$field]) )
+                               $bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context);
+               }
        }
 
        return $bookmark;
        }
 
        return $bookmark;
@@ -279,7 +301,7 @@ function sanitize_bookmark($bookmark, $context = 'display') {
  * $field has the filter name and is passed the $value, $bookmark_id, and
  * $context respectively.
  *
  * $field has the filter name and is passed the $value, $bookmark_id, and
  * $context respectively.
  *
- * @since 2.3
+ * @since 2.3.0
  *
  * @param string $field The bookmark field
  * @param mixed $value The bookmark field value
  *
  * @param string $field The bookmark field
  * @param mixed $value The bookmark field value
@@ -331,16 +353,14 @@ function sanitize_bookmark_field($field, $value, $bookmark_id, $context) {
 }
 
 /**
 }
 
 /**
- * Deletes entire bookmark cache
+ * Deletes bookmark cache
  *
  *
- * @since 2.1
+ * @since 2.7.0
  * @uses wp_cache_delete() Deletes the contents of 'get_bookmarks'
  */
  * @uses wp_cache_delete() Deletes the contents of 'get_bookmarks'
  */
-function delete_get_bookmark_cache() {
+function clean_bookmark_cache($bookmark_id) {
+       wp_cache_delete( $bookmark_id, 'bookmark' );
        wp_cache_delete( 'get_bookmarks', 'bookmark' );
 }
        wp_cache_delete( 'get_bookmarks', 'bookmark' );
 }
-add_action( 'add_link', 'delete_get_bookmark_cache' );
-add_action( 'edit_link', 'delete_get_bookmark_cache' );
-add_action( 'delete_link', 'delete_get_bookmark_cache' );
 
 ?>
 
 ?>
index cfdab824e42826cd1b8284ef1411d0ceeb5fcf09..5eef60b13cc2f57b22cc03f3e4b00ee44f6a8627 100644 (file)
@@ -11,7 +11,7 @@
 /**
  * Adds data to the cache, if the cache key doesn't aleady exist.
  *
 /**
  * Adds data to the cache, if the cache key doesn't aleady exist.
  *
- * @since 2.0
+ * @since 2.0.0
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::add()
  *
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::add()
  *
@@ -35,7 +35,7 @@ function wp_cache_add($key, $data, $flag = '', $expire = 0) {
  * does not mean that plugins can't implement this function when they need to
  * make sure that the cache is cleaned up after WordPress no longer needs it.
  *
  * does not mean that plugins can't implement this function when they need to
  * make sure that the cache is cleaned up after WordPress no longer needs it.
  *
- * @since 2.0
+ * @since 2.0.0
  *
  * @return bool Always returns True
  */
  *
  * @return bool Always returns True
  */
@@ -46,7 +46,7 @@ function wp_cache_close() {
 /**
  * Removes the cache contents matching ID and flag.
  *
 /**
  * Removes the cache contents matching ID and flag.
  *
- * @since 2.0
+ * @since 2.0.0
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::delete()
  *
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::delete()
  *
@@ -63,7 +63,7 @@ function wp_cache_delete($id, $flag = '') {
 /**
  * Removes all cache items.
  *
 /**
  * Removes all cache items.
  *
- * @since 2.0
+ * @since 2.0.0
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::flush()
  *
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::flush()
  *
@@ -78,7 +78,7 @@ function wp_cache_flush() {
 /**
  * Retrieves the cache contents from the cache by ID and flag.
  *
 /**
  * Retrieves the cache contents from the cache by ID and flag.
  *
- * @since 2.0
+ * @since 2.0.0
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::get()
  *
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::get()
  *
@@ -96,7 +96,7 @@ function wp_cache_get($id, $flag = '') {
 /**
  * Sets up Object Cache Global and assigns it.
  *
 /**
  * Sets up Object Cache Global and assigns it.
  *
- * @since 2.0
+ * @since 2.0.0
  * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
  */
 function wp_cache_init() {
  * @global WP_Object_Cache $wp_object_cache WordPress Object Cache
  */
 function wp_cache_init() {
@@ -106,7 +106,7 @@ function wp_cache_init() {
 /**
  * Replaces the contents of the cache with new data.
  *
 /**
  * Replaces the contents of the cache with new data.
  *
- * @since 2.0
+ * @since 2.0.0
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::replace()
  *
  * @uses $wp_object_cache Object Cache Class
  * @see WP_Object_Cache::replace()
  *
@@ -144,7 +144,7 @@ function wp_cache_set($key, $data, $flag = '', $expire = 0) {
 /**
  * Adds a group or set of groups to the list of global groups.
  *
 /**
  * Adds a group or set of groups to the list of global groups.
  *
- * @since 2.6
+ * @since 2.6.0
  *
  * @param string|array $groups A group or an array of groups to add
  */
  *
  * @param string|array $groups A group or an array of groups to add
  */
@@ -156,7 +156,7 @@ function wp_cache_add_global_groups( $groups ) {
 /**
  * Adds a group or set of groups to the list of non-persistent groups.
  *
 /**
  * Adds a group or set of groups to the list of non-persistent groups.
  *
- * @since 2.6
+ * @since 2.6.0
  *
  * @param string|array $groups A group or an array of groups to add
  */
  *
  * @param string|array $groups A group or an array of groups to add
  */
@@ -188,7 +188,7 @@ class WP_Object_Cache {
         *
         * @var array
         * @access private
         *
         * @var array
         * @access private
-        * @since 2.0
+        * @since 2.0.0
         */
        var $cache = array ();
 
         */
        var $cache = array ();
 
@@ -197,14 +197,14 @@ class WP_Object_Cache {
         *
         * @var array
         * @access private
         *
         * @var array
         * @access private
-        * @since 2.0
+        * @since 2.0.0
         */
        var $non_existant_objects = array ();
 
        /**
         * The amount of times the cache data was already stored in the cache.
         *
         */
        var $non_existant_objects = array ();
 
        /**
         * The amount of times the cache data was already stored in the cache.
         *
-        * @since 2.5
+        * @since 2.5.0
         * @access private
         * @var int
         */
         * @access private
         * @var int
         */
@@ -215,7 +215,7 @@ class WP_Object_Cache {
         *
         * @var int
         * @access public
         *
         * @var int
         * @access public
-        * @since 2.0
+        * @since 2.0.0
         */
        var $cache_misses = 0;
 
         */
        var $cache_misses = 0;
 
@@ -226,7 +226,7 @@ class WP_Object_Cache {
         * @uses WP_Object_Cache::set Sets the data after the checking the cache
         *              contents existance.
         *
         * @uses WP_Object_Cache::set Sets the data after the checking the cache
         *              contents existance.
         *
-        * @since 2.0
+        * @since 2.0.0
         *
         * @param int|string $id What to call the contents in the cache
         * @param mixed $data The contents to store in the cache
         *
         * @param int|string $id What to call the contents in the cache
         * @param mixed $data The contents to store in the cache
@@ -251,10 +251,10 @@ class WP_Object_Cache {
         * to false, then nothing will happen. The $force parameter is set to false
         * by default.
         *
         * to false, then nothing will happen. The $force parameter is set to false
         * by default.
         *
-        * On success the group and the id will be added to the 
+        * On success the group and the id will be added to the
         * $non_existant_objects property in the class.
         *
         * $non_existant_objects property in the class.
         *
-        * @since 2.0
+        * @since 2.0.0
         *
         * @param int|string $id What the contents in the cache are called
         * @param string $group Where the cache contents are grouped
         *
         * @param int|string $id What the contents in the cache are called
         * @param string $group Where the cache contents are grouped
@@ -277,7 +277,7 @@ class WP_Object_Cache {
        /**
         * Clears the object cache of all data
         *
        /**
         * Clears the object cache of all data
         *
-        * @since 2.0
+        * @since 2.0.0
         *
         * @return bool Always returns true
         */
         *
         * @return bool Always returns true
         */
@@ -300,7 +300,7 @@ class WP_Object_Cache {
         * misses will be incremented and the cache group and ID will be added to
         * the nonexistant objects.
         *
         * misses will be incremented and the cache group and ID will be added to
         * the nonexistant objects.
         *
-        * @since 2.0
+        * @since 2.0.0
         *
         * @param int|string $id What the contents in the cache are called
         * @param string $group Where the cache contents are grouped
         *
         * @param int|string $id What the contents in the cache are called
         * @param string $group Where the cache contents are grouped
@@ -313,7 +313,10 @@ class WP_Object_Cache {
 
                if (isset ($this->cache[$group][$id])) {
                        $this->cache_hits += 1;
 
                if (isset ($this->cache[$group][$id])) {
                        $this->cache_hits += 1;
-                       return $this->cache[$group][$id];
+                       if ( is_object($this->cache[$group][$id]) )
+                               return wp_clone($this->cache[$group][$id]);
+                       else
+                               return $this->cache[$group][$id];
                }
 
                if ( isset ($this->non_existant_objects[$group][$id]) )
                }
 
                if ( isset ($this->non_existant_objects[$group][$id]) )
@@ -327,7 +330,7 @@ class WP_Object_Cache {
        /**
         * Replace the contents in the cache, if contents already exist
         *
        /**
         * Replace the contents in the cache, if contents already exist
         *
-        * @since 2.0
+        * @since 2.0.0
         * @see WP_Object_Cache::set()
         *
         * @param int|string $id What to call the contents in the cache
         * @see WP_Object_Cache::set()
         *
         * @param int|string $id What to call the contents in the cache
@@ -358,7 +361,7 @@ class WP_Object_Cache {
         * expire for each time a page is accessed and PHP finishes. The method is
         * more for cache plugins which use files.
         *
         * expire for each time a page is accessed and PHP finishes. The method is
         * more for cache plugins which use files.
         *
-        * @since 2.0
+        * @since 2.0.0
         *
         * @param int|string $id What to call the contents in the cache
         * @param mixed $data The contents to store in the cache
         *
         * @param int|string $id What to call the contents in the cache
         * @param mixed $data The contents to store in the cache
@@ -373,6 +376,9 @@ class WP_Object_Cache {
                if (NULL === $data)
                        $data = '';
 
                if (NULL === $data)
                        $data = '';
 
+               if ( is_object($data) )
+                       $data = wp_clone($data);
+
                $this->cache[$group][$id] = $data;
 
                if(isset($this->non_existant_objects[$group][$id]))
                $this->cache[$group][$id] = $data;
 
                if(isset($this->non_existant_objects[$group][$id]))
@@ -387,7 +393,7 @@ class WP_Object_Cache {
         * Gives the cache hits, and cache misses. Also prints every cached group,
         * key and the data.
         *
         * Gives the cache hits, and cache misses. Also prints every cached group,
         * key and the data.
         *
-        * @since 2.0
+        * @since 2.0.0
         */
        function stats() {
                echo "<p>";
         */
        function stats() {
                echo "<p>";
@@ -408,7 +414,7 @@ class WP_Object_Cache {
        /**
         * PHP4 constructor; Calls PHP 5 style constructor
         *
        /**
         * PHP4 constructor; Calls PHP 5 style constructor
         *
-        * @since 2.0
+        * @since 2.0.0
         *
         * @return WP_Object_Cache
         */
         *
         * @return WP_Object_Cache
         */
index 4c1e3657f71bfb949a77873a70aa1a54070d6c36..3fc9f0da87bb69ffa5724dca2cb291d2c28b54ce 100644 (file)
@@ -8,11 +8,11 @@
  * @author Scott Yang
  * @author Mark Jaquith
  * @package WordPress
  * @author Scott Yang
  * @author Mark Jaquith
  * @package WordPress
- * @since 2.3
+ * @since 2.3.0
  */
 
 /**
  */
 
 /**
- * Redirects incoming links to the proper URL based on the site url
+ * Redirects incoming links to the proper URL based on the site url.
  *
  * Search engines consider www.somedomain.com and somedomain.com to be two
  * different URLs when they both go to the same location. This SEO enhancement
  *
  * Search engines consider www.somedomain.com and somedomain.com to be two
  * different URLs when they both go to the same location. This SEO enhancement
@@ -26,7 +26,7 @@
  * not exist based on exact WordPress query. Will instead try to parse the URL
  * or query in an attempt to figure the correct page to go to.
  *
  * not exist based on exact WordPress query. Will instead try to parse the URL
  * or query in an attempt to figure the correct page to go to.
  *
- * @since 2.3
+ * @since 2.3.0
  * @uses $wp_rewrite
  * @uses $is_IIS
  *
  * @uses $wp_rewrite
  * @uses $is_IIS
  *
  *             not needed or the string of the URL
  */
 function redirect_canonical($requested_url=null, $do_redirect=true) {
  *             not needed or the string of the URL
  */
 function redirect_canonical($requested_url=null, $do_redirect=true) {
-       global $wp_rewrite, $is_IIS;
+       global $wp_rewrite, $is_IIS, $wp_query, $wpdb;
 
 
-       if ( is_feed() || is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() )
+       if ( is_trackback() || is_search() || is_comments_popup() || is_admin() || $is_IIS || ( isset($_POST) && count($_POST) ) || is_preview() || is_robots() )
                return;
 
        if ( !$requested_url ) {
                // build the URL in the address bar
                return;
 
        if ( !$requested_url ) {
                // build the URL in the address bar
-               $requested_url  = ( isset($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
+               $requested_url  = ( !empty($_SERVER['HTTPS'] ) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
                $requested_url .= $_SERVER['HTTP_HOST'];
                $requested_url .= $_SERVER['REQUEST_URI'];
        }
                $requested_url .= $_SERVER['HTTP_HOST'];
                $requested_url .= $_SERVER['REQUEST_URI'];
        }
@@ -54,23 +54,47 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                return;
 
        // Some PHP setups turn requests for / into /index.php in REQUEST_URI
                return;
 
        // Some PHP setups turn requests for / into /index.php in REQUEST_URI
-       $original['path'] = preg_replace('|/index\.php$|', '/', $original['path']);
+       // See: http://trac.wordpress.org/ticket/5017
+       // See: http://trac.wordpress.org/ticket/7173
+       // Disabled, for now:
+       // $original['path'] = preg_replace('|/index\.php$|', '/', $original['path']);
 
        $redirect = $original;
        $redirect_url = false;
 
 
        $redirect = $original;
        $redirect_url = false;
 
+       // Notice fixing
+       if ( !isset($redirect['path']) )  $redirect['path'] = '';
+       if ( !isset($redirect['query']) ) $redirect['query'] = '';
+
+       if ( is_singular() && 1 > $wp_query->post_count && ($id = get_query_var('p')) ) {
+
+               $vars = $wpdb->get_results( $wpdb->prepare("SELECT post_type, post_parent FROM $wpdb->posts WHERE ID = %d", $id) );
+
+               if ( isset($vars[0]) && $vars = $vars[0] ) {
+                       if ( 'revision' == $vars->post_type && $vars->post_parent > 0 )
+                               $id = $vars->post_parent;
+
+                       if ( $redirect_url = get_permalink($id) )
+                               $redirect['query'] = remove_query_arg(array('p', 'page_id', 'attachment_id'), $redirect['query']);
+               }
+       }
+
        // These tests give us a WP-generated permalink
        if ( is_404() ) {
                $redirect_url = redirect_guess_404_permalink();
        } elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) {
                // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101
        // These tests give us a WP-generated permalink
        if ( is_404() ) {
                $redirect_url = redirect_guess_404_permalink();
        } elseif ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) {
                // rewriting of old ?p=X, ?m=2004, ?m=200401, ?m=20040101
-               if ( is_single() && isset($_GET['p']) ) {
+               if ( is_single() && !empty($_GET['p']) && ! $redirect_url ) {
                        if ( $redirect_url = get_permalink(get_query_var('p')) )
                                $redirect['query'] = remove_query_arg('p', $redirect['query']);
                        if ( $redirect_url = get_permalink(get_query_var('p')) )
                                $redirect['query'] = remove_query_arg('p', $redirect['query']);
-               } elseif ( is_page() && isset($_GET['page_id']) ) {
+                       if ( get_query_var( 'page' ) ) {
+                               $redirect_url = trailingslashit( $redirect_url ) . user_trailingslashit( get_query_var( 'page' ), 'single_paged' );
+                               $redirect['query'] = remove_query_arg( 'page', $redirect['query'] );
+                       }
+               } elseif ( is_page() && !empty($_GET['page_id']) && ! $redirect_url ) {
                        if ( $redirect_url = get_permalink(get_query_var('page_id')) )
                                $redirect['query'] = remove_query_arg('page_id', $redirect['query']);
                        if ( $redirect_url = get_permalink(get_query_var('page_id')) )
                                $redirect['query'] = remove_query_arg('page_id', $redirect['query']);
-               } elseif ( isset($_GET['m']) && ( is_year() || is_month() || is_day() ) ) {
+               } elseif ( !empty($_GET['m']) && ( is_year() || is_month() || is_day() ) ) {
                        $m = get_query_var('m');
                        switch ( strlen($m) ) {
                                case 4: // Yearly
                        $m = get_query_var('m');
                        switch ( strlen($m) ) {
                                case 4: // Yearly
@@ -86,49 +110,77 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                        if ( $redirect_url )
                                $redirect['query'] = remove_query_arg('m', $redirect['query']);
                // now moving on to non ?m=X year/month/day links
                        if ( $redirect_url )
                                $redirect['query'] = remove_query_arg('m', $redirect['query']);
                // now moving on to non ?m=X year/month/day links
-               } elseif ( is_day() && get_query_var('year') && get_query_var('monthnum') && isset($_GET['day']) ) {
+               } elseif ( is_day() && get_query_var('year') && get_query_var('monthnum') && !empty($_GET['day']) ) {
                        if ( $redirect_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')) )
                                $redirect['query'] = remove_query_arg(array('year', 'monthnum', 'day'), $redirect['query']);
                        if ( $redirect_url = get_day_link(get_query_var('year'), get_query_var('monthnum'), get_query_var('day')) )
                                $redirect['query'] = remove_query_arg(array('year', 'monthnum', 'day'), $redirect['query']);
-               } elseif ( is_month() && get_query_var('year') && isset($_GET['monthnum']) ) {
+               } elseif ( is_month() && get_query_var('year') && !empty($_GET['monthnum']) ) {
                        if ( $redirect_url = get_month_link(get_query_var('year'), get_query_var('monthnum')) )
                                $redirect['query'] = remove_query_arg(array('year', 'monthnum'), $redirect['query']);
                        if ( $redirect_url = get_month_link(get_query_var('year'), get_query_var('monthnum')) )
                                $redirect['query'] = remove_query_arg(array('year', 'monthnum'), $redirect['query']);
-               } elseif ( is_year() && isset($_GET['year']) ) {
+               } elseif ( is_year() && !empty($_GET['year']) ) {
                        if ( $redirect_url = get_year_link(get_query_var('year')) )
                                $redirect['query'] = remove_query_arg('year', $redirect['query']);
                        if ( $redirect_url = get_year_link(get_query_var('year')) )
                                $redirect['query'] = remove_query_arg('year', $redirect['query']);
-               } elseif ( is_category() && isset($_GET['cat']) ) {
+               } elseif ( is_category() && !empty($_GET['cat']) && preg_match( '|^[0-9]+$|', $_GET['cat'] ) ) {
                        if ( $redirect_url = get_category_link(get_query_var('cat')) )
                                $redirect['query'] = remove_query_arg('cat', $redirect['query']);
                        if ( $redirect_url = get_category_link(get_query_var('cat')) )
                                $redirect['query'] = remove_query_arg('cat', $redirect['query']);
-               } elseif ( is_author() && isset($_GET['author']) ) {
+               } elseif ( is_author() && !empty($_GET['author']) ) {
                        $author = get_userdata(get_query_var('author'));
                        $author = get_userdata(get_query_var('author'));
-                       if ( false !== $author && $redirect_url = get_author_link(false, $author->ID, $author->user_nicename) )
+                       if ( false !== $author && $redirect_url = get_author_posts_url($author->ID, $author->user_nicename) )
                                $redirect['query'] = remove_query_arg('author', $redirect['author']);
                }
 
                                $redirect['query'] = remove_query_arg('author', $redirect['author']);
                }
 
-       // paging
-               if ( $paged = get_query_var('paged') ) {
-                       if ( $paged > 0 ) {
-                               if ( !$redirect_url )
-                                       $redirect_url = $requested_url;
-                               $paged_redirect = @parse_url($redirect_url);
-                               $paged_redirect['path'] = preg_replace('|/page/[0-9]+?(/+)?$|', '/', $paged_redirect['path']); // strip off any existing paging
-                               $paged_redirect['path'] = preg_replace('|/index.php/?$|', '/', $paged_redirect['path']); // strip off trailing /index.php/
-                               if ( $paged > 1 && !is_single() ) {
-                                       $paged_redirect['path'] = trailingslashit($paged_redirect['path']);
-                                       if ( $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false )
-                                               $paged_redirect['path'] .= 'index.php/';
-                                       $paged_redirect['path'] .= user_trailingslashit("page/$paged", 'paged');
-                               } elseif ( !is_home() && !is_single() ){
-                                       $paged_redirect['path'] = user_trailingslashit($paged_redirect['path'], 'paged');
+       // paging and feeds
+               if ( get_query_var('paged') || is_feed() || get_query_var('cpage') ) {
+                       if ( !$redirect_url )
+                               $redirect_url = $requested_url;
+                       $paged_redirect = @parse_url($redirect_url);
+                       while ( preg_match( '#/page/[0-9]+?(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/(comments/?)?(feed|rss|rdf|atom|rss2)(/+)?$#', $paged_redirect['path'] ) || preg_match( '#/comment-page-[0-9]+(/+)?$#', $paged_redirect['path'] ) ) {
+                               // Strip off paging and feed
+                               $paged_redirect['path'] = preg_replace('#/page/[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing paging
+                               $paged_redirect['path'] = preg_replace('#/(comments/?)?(feed|rss2?|rdf|atom)(/+|$)#', '/', $paged_redirect['path']); // strip off feed endings
+                               $paged_redirect['path'] = preg_replace('#/comment-page-[0-9]+?(/+)?$#', '/', $paged_redirect['path']); // strip off any existing comment paging
+                       }
+
+                       $addl_path = '';
+                       if ( is_feed() ) {
+                               $addl_path = !empty( $addl_path ) ? trailingslashit($addl_path) : '';
+                               if ( get_query_var( 'withcomments' ) )
+                                       $addl_path .= 'comments/';
+                               $addl_path .= user_trailingslashit( 'feed/' . ( ( 'rss2' ==  get_query_var('feed') || 'feed' == get_query_var('feed') ) ? '' : get_query_var('feed') ), 'feed' );
+                               $redirect['query'] = remove_query_arg( 'feed', $redirect['query'] );
+                       }
+
+                       if ( get_query_var('paged') > 0 ) {
+                               $paged = get_query_var('paged');
+                               $redirect['query'] = remove_query_arg( 'paged', $redirect['query'] );
+                               if ( !is_feed() ) {
+                                       if ( $paged > 1 && !is_single() ) {
+                                               $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit("page/$paged", 'paged');
+                                       } elseif ( !is_single() ) {
+                                               $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit($paged_redirect['path'], 'paged');
+                                       }
+                               } elseif ( $paged > 1 ) {
+                                       $redirect['query'] = add_query_arg( 'paged', $paged, $redirect['query'] );
                                }
                                }
-                               $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];
-                               $redirect['path'] = $paged_redirect['path'];
                        }
                        }
-                       $redirect['query'] = remove_query_arg('paged', $redirect['query']);
+
+                       if ( get_option('page_comments') && ( ( 'newest' == get_option('default_comments_page') && get_query_var('cpage') > 0 ) || ( 'newest' != get_option('default_comments_page') && get_query_var('cpage') > 1 ) ) ) {
+                               $addl_path = ( !empty( $addl_path ) ? trailingslashit($addl_path) : '' ) . user_trailingslashit( 'comment-page-' . get_query_var('cpage'), 'commentpaged' );
+                               $redirect['query'] = remove_query_arg( 'cpage', $redirect['query'] );
+                       }
+
+                       $paged_redirect['path'] = user_trailingslashit( preg_replace('|/index.php/?$|', '/', $paged_redirect['path']) ); // strip off trailing /index.php/
+                       if ( !empty( $addl_path ) && $wp_rewrite->using_index_permalinks() && strpos($paged_redirect['path'], '/index.php/') === false )
+                               $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . 'index.php/';
+                       if ( !empty( $addl_path ) )
+                               $paged_redirect['path'] = trailingslashit($paged_redirect['path']) . $addl_path;
+                       $redirect_url = $paged_redirect['scheme'] . '://' . $paged_redirect['host'] . $paged_redirect['path'];
+                       $redirect['path'] = $paged_redirect['path'];
                }
        }
 
        // tack on any additional query vars
                }
        }
 
        // tack on any additional query vars
-       if ( $redirect_url && $redirect['query'] ) {
+       $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
+       if ( $redirect_url && !empty($redirect['query']) ) {
                if ( strpos($redirect_url, '?') !== false )
                        $redirect_url .= '&';
                else
                if ( strpos($redirect_url, '?') !== false )
                        $redirect_url .= '&';
                else
@@ -141,29 +193,45 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 
        // www.example.com vs example.com
        $user_home = @parse_url(get_option('home'));
 
        // www.example.com vs example.com
        $user_home = @parse_url(get_option('home'));
-       if ( isset($user_home['host']) )
+       if ( !empty($user_home['host']) )
                $redirect['host'] = $user_home['host'];
                $redirect['host'] = $user_home['host'];
+       if ( empty($user_home['path']) )
+               $user_home['path'] = '/';
 
        // Handle ports
 
        // Handle ports
-       if ( isset($user_home['port']) )
+       if ( !empty($user_home['port']) )
                $redirect['port'] = $user_home['port'];
        else
                unset($redirect['port']);
 
                $redirect['port'] = $user_home['port'];
        else
                unset($redirect['port']);
 
-       // trailing /index.php/
-       $redirect['path'] = preg_replace('|/index.php/$|', '/', $redirect['path']);
+       // trailing /index.php
+       $redirect['path'] = preg_replace('|/index.php/*?$|', '/', $redirect['path']);
+
+       // Remove trailing spaces from the path
+       $redirect['path'] = preg_replace( '#(%20| )+$#', '', $redirect['path'] );
+
+       if ( !empty( $redirect['query'] ) ) {
+               // Remove trailing spaces from certain terminating query string args
+               $redirect['query'] = preg_replace( '#((p|page_id|cat|tag)=[^&]*?)(%20| )+$#', '$1', $redirect['query'] );
+
+               // Clean up empty query strings
+               $redirect['query'] = trim(preg_replace( '#(^|&)(p|page_id|cat|tag)=?(&|$)#', '&', $redirect['query']), '&');
+
+               // Remove redundant leading ampersands
+               $redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
+       }
 
        // strip /index.php/ when we're not using PATHINFO permalinks
        if ( !$wp_rewrite->using_index_permalinks() )
                $redirect['path'] = str_replace('/index.php/', '/', $redirect['path']);
 
        // trailing slashes
 
        // strip /index.php/ when we're not using PATHINFO permalinks
        if ( !$wp_rewrite->using_index_permalinks() )
                $redirect['path'] = str_replace('/index.php/', '/', $redirect['path']);
 
        // trailing slashes
-       if ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_home() || ( is_home() && (get_query_var('paged') > 1) ) ) ) {
+       if ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() && !is_404() && (!is_front_page() || ( is_front_page() && (get_query_var('paged') > 1) ) ) ) {
                $user_ts_type = '';
                if ( get_query_var('paged') > 0 ) {
                        $user_ts_type = 'paged';
                } else {
                $user_ts_type = '';
                if ( get_query_var('paged') > 0 ) {
                        $user_ts_type = 'paged';
                } else {
-                       foreach ( array('single', 'category', 'page', 'day', 'month', 'year') as $type ) {
+                       foreach ( array('single', 'category', 'page', 'day', 'month', 'year', 'home') as $type ) {
                                $func = 'is_' . $type;
                                if ( call_user_func($func) ) {
                                        $user_ts_type = $type;
                                $func = 'is_' . $type;
                                if ( call_user_func($func) ) {
                                        $user_ts_type = $type;
@@ -172,35 +240,53 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                        }
                }
                $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type);
                        }
                }
                $redirect['path'] = user_trailingslashit($redirect['path'], $user_ts_type);
-       } elseif ( is_home() ) {
+       } elseif ( is_front_page() ) {
                $redirect['path'] = trailingslashit($redirect['path']);
        }
 
                $redirect['path'] = trailingslashit($redirect['path']);
        }
 
-       // Always trailing slash the 'home' URL
-       if ( $redirect['path'] == $user_home['path'] )
+       // Always trailing slash the Front Page URL
+       if ( trailingslashit( $redirect['path'] ) == trailingslashit( $user_home['path'] ) )
                $redirect['path'] = trailingslashit($redirect['path']);
 
        // Ignore differences in host capitalization, as this can lead to infinite redirects
                $redirect['path'] = trailingslashit($redirect['path']);
 
        // Ignore differences in host capitalization, as this can lead to infinite redirects
-       if ( strtolower($original['host']) == strtolower($redirect['host']) )
+       // Only redirect no-www <=> yes-www
+       if ( strtolower($original['host']) == strtolower($redirect['host']) ||
+               ( strtolower($original['host']) != 'www.' . strtolower($redirect['host']) && 'www.' . strtolower($original['host']) != strtolower($redirect['host']) ) )
                $redirect['host'] = $original['host'];
 
                $redirect['host'] = $original['host'];
 
-       if ( array($original['host'], $original['port'], $original['path'], $original['query']) !== array($redirect['host'], $redirect['port'], $redirect['path'], $redirect['query']) ) {
+       $compare_original = array($original['host'], $original['path']);
+
+       if ( !empty( $original['port'] ) )
+               $compare_original[] = $original['port'];
+
+       if ( !empty( $original['query'] ) )
+               $compare_original[] = $original['query'];
+
+       $compare_redirect = array($redirect['host'], $redirect['path']);
+
+       if ( !empty( $redirect['port'] ) )
+               $compare_redirect[] = $redirect['port'];
+
+       if ( !empty( $redirect['query'] ) )
+               $compare_redirect[] = $redirect['query'];
+
+       if ( $compare_original !== $compare_redirect ) {
                $redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
                $redirect_url = $redirect['scheme'] . '://' . $redirect['host'];
-               if ( isset($redirect['port']) )
-                       $redirect_url .= ':' . $redirect['port'];
+               if ( !empty($redirect['port']) )
+                       $redirect_url .= ':' . $redirect['port'];
                $redirect_url .= $redirect['path'];
                $redirect_url .= $redirect['path'];
-               if ( $redirect['query'] )
+               if ( !empty($redirect['query']) )
                        $redirect_url .= '?' . $redirect['query'];
        }
 
        if ( !$redirect_url || $redirect_url == $requested_url )
                        $redirect_url .= '?' . $redirect['query'];
        }
 
        if ( !$redirect_url || $redirect_url == $requested_url )
-               return false;
+               return false;
 
        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
        $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url);
 
        if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request
 
        // Note that you can use the "redirect_canonical" filter to cancel a canonical redirect for whatever reason by returning FALSE
        $redirect_url = apply_filters('redirect_canonical', $redirect_url, $requested_url);
 
        if ( !$redirect_url || $redirect_url == $requested_url ) // yes, again -- in case the filter aborted the request
-               return false;
+               return false;
 
        if ( $do_redirect ) {
                // protect against chained redirects
 
        if ( $do_redirect ) {
                // protect against chained redirects
@@ -208,6 +294,8 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
                        wp_redirect($redirect_url, 301);
                        exit();
                } else {
                        wp_redirect($redirect_url, 301);
                        exit();
                } else {
+                       // Debug
+                       // die("1: $redirect_url<br />2: " . redirect_canonical( $redirect_url, false ) );
                        return false;
                }
        } else {
                        return false;
                }
        } else {
@@ -216,9 +304,9 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
 }
 
 /**
 }
 
 /**
- * Attempts to guess correct post based on query vars
+ * Attempts to guess correct post based on query vars.
  *
  *
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @return bool|string Returns False, if it can't find post, returns correct
  * @uses $wpdb
  *
  * @return bool|string Returns False, if it can't find post, returns correct
@@ -226,6 +314,7 @@ function redirect_canonical($requested_url=null, $do_redirect=true) {
  */
 function redirect_guess_404_permalink() {
        global $wpdb;
  */
 function redirect_guess_404_permalink() {
        global $wpdb;
+
        if ( !get_query_var('name') )
                return false;
 
        if ( !get_query_var('name') )
                return false;
 
index 875173d63b19742dfe55832a5dcd95a0fd5fd9b9..ab6ec3524d7e9a813673337207c4b4018bf3cc51 100644 (file)
 <?php
 <?php
-
+/**
+ * WordPress Roles and Capabilities.
+ *
+ * @package WordPress
+ * @subpackage User
+ */
+
+/**
+ * WordPress User Roles.
+ *
+ * The role option is simple, the structure is organized by role name that store
+ * the name in value of the 'name' key. The capabilities are stored as an array
+ * in the value of the 'capability' key.
+ *
+ * <code>
+ * array (
+ *             'rolename' => array (
+ *                     'name' => 'rolename',
+ *                     'capabilities' => array()
+ *             )
+ * )
+ * </code>
+ *
+ * @since 2.0.0
+ * @package WordPress
+ * @subpackage User
+ */
 class WP_Roles {
 class WP_Roles {
+       /**
+        * List of roles and capabilities.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
        var $roles;
 
        var $roles;
 
+       /**
+        * List of the role objects.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
        var $role_objects = array();
        var $role_objects = array();
+
+       /**
+        * List of role names.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
        var $role_names = array();
        var $role_names = array();
+
+       /**
+        * Option name for storing role list.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var string
+        */
        var $role_key;
        var $role_key;
+
+       /**
+        * Whether to use the database for retrieval and storage.
+        *
+        * @since 2.1.0
+        * @access public
+        * @var bool
+        */
        var $use_db = true;
 
        var $use_db = true;
 
+       /**
+        * PHP4 Constructor - Call {@link WP_Roles::_init()} method.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @return WP_Roles
+        */
        function WP_Roles() {
                $this->_init();
        }
 
        function WP_Roles() {
                $this->_init();
        }
 
+       /**
+        * Setup the object properties.
+        *
+        * The role key is set to the current prefix for the $wpdb object with
+        * 'user_roles' appended. If the $wp_user_roles global is set, then it will
+        * be used and the role option will not be updated or used.
+        *
+        * @since 2.1.0
+        * @access protected
+        * @uses $wpdb Used to get the database prefix.
+        * @global array $wp_user_roles Used to set the 'roles' property value.
+        */
        function _init () {
                global $wpdb;
                global $wp_user_roles;
                $this->role_key = $wpdb->prefix . 'user_roles';
        function _init () {
                global $wpdb;
                global $wp_user_roles;
                $this->role_key = $wpdb->prefix . 'user_roles';
-               if ( ! empty($wp_user_roles) ) {
+               if ( ! empty( $wp_user_roles ) ) {
                        $this->roles = $wp_user_roles;
                        $this->use_db = false;
                } else {
                        $this->roles = $wp_user_roles;
                        $this->use_db = false;
                } else {
-                       $this->roles = get_option($this->role_key);
+                       $this->roles = get_option( $this->role_key );
                }
 
                }
 
-               if ( empty($this->roles) )
+               if ( empty( $this->roles ) )
                        return;
 
                $this->role_objects = array();
                $this->role_names =  array();
                        return;
 
                $this->role_objects = array();
                $this->role_names =  array();
-               foreach ($this->roles as $role => $data) {
-                       $this->role_objects[$role] = new WP_Role($role, $this->roles[$role]['capabilities']);
+               foreach ( (array) $this->roles as $role => $data ) {
+                       $this->role_objects[$role] = new WP_Role( $role, $this->roles[$role]['capabilities'] );
                        $this->role_names[$role] = $this->roles[$role]['name'];
                }
        }
 
                        $this->role_names[$role] = $this->roles[$role]['name'];
                }
        }
 
-       function add_role($role, $display_name, $capabilities = array()) {
-               if ( isset($this->roles[$role]) )
+       /**
+        * Add role name with capabilities to list.
+        *
+        * Updates the list of roles, if the role doesn't already exist.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        * @param string $display_name Role display name.
+        * @param array $capabilities List of role capabilities.
+        * @return null|WP_Role WP_Role object if role is added, null if already exists.
+        */
+       function add_role( $role, $display_name, $capabilities = array() ) {
+               if ( isset( $this->roles[$role] ) )
                        return;
 
                $this->roles[$role] = array(
                        'name' => $display_name,
                        return;
 
                $this->roles[$role] = array(
                        'name' => $display_name,
-                       'capabilities' => $capabilities);
+                       'capabilities' => $capabilities
+                       );
                if ( $this->use_db )
                if ( $this->use_db )
-                       update_option($this->role_key, $this->roles);
-               $this->role_objects[$role] = new WP_Role($role, $capabilities);
+                       update_option( $this->role_key, $this->roles );
+               $this->role_objects[$role] = new WP_Role( $role, $capabilities );
                $this->role_names[$role] = $display_name;
                return $this->role_objects[$role];
        }
 
                $this->role_names[$role] = $display_name;
                return $this->role_objects[$role];
        }
 
-       function remove_role($role) {
-               if ( ! isset($this->role_objects[$role]) )
+       /**
+        * Remove role by name.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        */
+       function remove_role( $role ) {
+               if ( ! isset( $this->role_objects[$role] ) )
                        return;
 
                        return;
 
-               unset($this->role_objects[$role]);
-               unset($this->role_names[$role]);
-               unset($this->roles[$role]);
+               unset( $this->role_objects[$role] );
+               unset( $this->role_names[$role] );
+               unset( $this->roles[$role] );
 
                if ( $this->use_db )
 
                if ( $this->use_db )
-                       update_option($this->role_key, $this->roles);
+                       update_option( $this->role_key, $this->roles );
        }
 
        }
 
-       function add_cap($role, $cap, $grant = true) {
+       /**
+        * Add capability to role.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        * @param string $cap Capability name.
+        * @param bool $grant Optional, default is true. Whether role is capable of preforming capability.
+        */
+       function add_cap( $role, $cap, $grant = true ) {
                $this->roles[$role]['capabilities'][$cap] = $grant;
                if ( $this->use_db )
                $this->roles[$role]['capabilities'][$cap] = $grant;
                if ( $this->use_db )
-                       update_option($this->role_key, $this->roles);
+                       update_option( $this->role_key, $this->roles );
        }
 
        }
 
-       function remove_cap($role, $cap) {
-               unset($this->roles[$role]['capabilities'][$cap]);
+       /**
+        * Remove capability from role.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        * @param string $cap Capability name.
+        */
+       function remove_cap( $role, $cap ) {
+               unset( $this->roles[$role]['capabilities'][$cap] );
                if ( $this->use_db )
                if ( $this->use_db )
-                       update_option($this->role_key, $this->roles);
+                       update_option( $this->role_key, $this->roles );
        }
 
        }
 
-       function &get_role($role) {
-               if ( isset($this->role_objects[$role]) )
+       /**
+        * Retrieve role object by name.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        * @return object|null Null, if role does not exist. WP_Role object, if found.
+        */
+       function &get_role( $role ) {
+               if ( isset( $this->role_objects[$role] ) )
                        return $this->role_objects[$role];
                else
                        return null;
        }
 
                        return $this->role_objects[$role];
                else
                        return null;
        }
 
+       /**
+        * Retrieve list of role names.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @return array List of role names.
+        */
        function get_names() {
                return $this->role_names;
        }
 
        function get_names() {
                return $this->role_names;
        }
 
-       function is_role($role)
+       /**
+        * Whether role name is currently in the list of available roles.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name to look up.
+        * @return bool
+        */
+       function is_role( $role )
        {
        {
-               return isset($this->role_names[$role]);
+               return isset( $this->role_names[$role] );
        }
 }
 
        }
 }
 
+/**
+ * WordPress Role class.
+ *
+ * @since 2.0.0
+ * @package WordPress
+ * @subpackage User
+ */
 class WP_Role {
 class WP_Role {
+       /**
+        * Role name.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var string
+        */
        var $name;
        var $name;
+
+       /**
+        * List of capabilities the role contains.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
        var $capabilities;
 
        var $capabilities;
 
-       function WP_Role($role, $capabilities) {
+       /**
+        * PHP4 Constructor - Setup object properties.
+        *
+        * The list of capabilities, must have the key as the name of the capability
+        * and the value a boolean of whether it is granted to the role or not.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        * @param array $capabilities List of capabilities.
+        * @return WP_Role
+        */
+       function WP_Role( $role, $capabilities ) {
                $this->name = $role;
                $this->capabilities = $capabilities;
        }
 
                $this->name = $role;
                $this->capabilities = $capabilities;
        }
 
-       function add_cap($cap, $grant = true) {
+       /**
+        * Assign role a capability.
+        *
+        * @see WP_Roles::add_cap() Method uses implementation for role.
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $cap Capability name.
+        * @param bool $grant Whether role has capability privilege.
+        */
+       function add_cap( $cap, $grant = true ) {
                global $wp_roles;
 
                global $wp_roles;
 
-               if ( ! isset($wp_roles) )
+               if ( ! isset( $wp_roles ) )
                        $wp_roles = new WP_Roles();
 
                $this->capabilities[$cap] = $grant;
                        $wp_roles = new WP_Roles();
 
                $this->capabilities[$cap] = $grant;
-               $wp_roles->add_cap($this->name, $cap, $grant);
+               $wp_roles->add_cap( $this->name, $cap, $grant );
        }
 
        }
 
-       function remove_cap($cap) {
+       /**
+        * Remove capability from role.
+        *
+        * This is a container for {@link WP_Roles::remove_cap()} to remove the
+        * capability from the role. That is to say, that {@link
+        * WP_Roles::remove_cap()} implements the functionality, but it also makes
+        * sense to use this class, because you don't need to enter the role name.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $cap Capability name.
+        */
+       function remove_cap( $cap ) {
                global $wp_roles;
 
                global $wp_roles;
 
-               if ( ! isset($wp_roles) )
+               if ( ! isset( $wp_roles ) )
                        $wp_roles = new WP_Roles();
 
                        $wp_roles = new WP_Roles();
 
-               unset($this->capabilities[$cap]);
-               $wp_roles->remove_cap($this->name, $cap);
+               unset( $this->capabilities[$cap] );
+               $wp_roles->remove_cap( $this->name, $cap );
        }
 
        }
 
-       function has_cap($cap) {
-               $capabilities = apply_filters('role_has_cap', $this->capabilities, $cap, $this->name);
-               if ( !empty($capabilities[$cap]) )
+       /**
+        * Whether role has capability.
+        *
+        * The capabilities is passed through the 'role_has_cap' filter. The first
+        * parameter for the hook is the list of capabilities the class has
+        * assigned. The second parameter is the capability name to look for. The
+        * third and final parameter for the hook is the role name.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $cap Capability name.
+        * @return bool True, if user has capability. False, if doesn't have capability.
+        */
+       function has_cap( $cap ) {
+               $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name );
+               if ( !empty( $capabilities[$cap] ) )
                        return $capabilities[$cap];
                else
                        return false;
                        return $capabilities[$cap];
                else
                        return false;
@@ -128,34 +351,136 @@ class WP_Role {
 
 }
 
 
 }
 
+/**
+ * WordPress User class.
+ *
+ * @since 2.0.0
+ * @package WordPress
+ * @subpackage User
+ */
 class WP_User {
 class WP_User {
+       /**
+        * User data container.
+        *
+        * This will be set as properties of the object.
+        *
+        * @since 2.0.0
+        * @access private
+        * @var array
+        */
        var $data;
        var $data;
+
+       /**
+        * The user's ID.
+        *
+        * @since 2.1.0
+        * @access public
+        * @var int
+        */
        var $ID = 0;
        var $ID = 0;
-       var $id = 0; // Deprecated, use $ID instead.
+
+       /**
+        * The deprecated user's ID.
+        *
+        * @since 2.0.0
+        * @access public
+        * @deprecated Use WP_User::$ID
+        * @see WP_User::$ID
+        * @var int
+        */
+       var $id = 0;
+
+       /**
+        * The individual capabilities the user has been given.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
        var $caps = array();
        var $caps = array();
+
+       /**
+        * User metadata option name.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var string
+        */
        var $cap_key;
        var $cap_key;
+
+       /**
+        * The roles the user is part of.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
        var $roles = array();
        var $roles = array();
-       var $allcaps = array();
 
 
-       function WP_User($id, $name = '') {
+       /**
+        * All capabilities the user has, including individual and role based.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
+       var $allcaps = array();
 
 
-               if ( empty($id) && empty($name) )
+       /**
+        * First name of the user.
+        *
+        * Created to prevent notices.
+        *
+        * @since 2.7.0
+        * @access public
+        * @var string
+        */
+       var $first_name = '';
+
+       /**
+        * Last name of the user.
+        *
+        * Created to prevent notices.
+        *
+        * @since 2.7.0
+        * @access public
+        * @var string
+        */
+       var $last_name = '';
+
+       /**
+        * PHP4 Constructor - Sets up the object properties.
+        *
+        * Retrieves the userdata and then assigns all of the data keys to direct
+        * properties of the object. Calls {@link WP_User::_init_caps()} after
+        * setting up the object's user data properties.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param int|string $id User's ID or username
+        * @param int $name Optional. User's username
+        * @return WP_User
+        */
+       function WP_User( $id, $name = '' ) {
+
+               if ( empty( $id ) && empty( $name ) )
                        return;
 
                        return;
 
-               if ( ! is_numeric($id) ) {
+               if ( ! is_numeric( $id ) ) {
                        $name = $id;
                        $id = 0;
                }
 
                        $name = $id;
                        $id = 0;
                }
 
-               if ( ! empty($id) )
-                       $this->data = get_userdata($id);
+               if ( ! empty( $id ) )
+                       $this->data = get_userdata( $id );
                else
                else
-                       $this->data = get_userdatabylogin($name);
+                       $this->data = get_userdatabylogin( $name );
 
 
-               if ( empty($this->data->ID) )
+               if ( empty( $this->data->ID ) )
                        return;
 
                        return;
 
-               foreach (get_object_vars($this->data) as $key => $value) {
+               foreach ( get_object_vars( $this->data ) as $key => $value ) {
                        $this->{$key} = $value;
                }
 
                        $this->{$key} = $value;
                }
 
@@ -163,151 +488,292 @@ class WP_User {
                $this->_init_caps();
        }
 
                $this->_init_caps();
        }
 
+       /**
+        * Setup capability object properties.
+        *
+        * Will set the value for the 'cap_key' property to current database table
+        * prefix, followed by 'capabilities'. Will then check to see if the
+        * property matching the 'cap_key' exists and is an array. If so, it will be
+        * used.
+        *
+        * @since 2.1.0
+        * @access protected
+        */
        function _init_caps() {
                global $wpdb;
                $this->cap_key = $wpdb->prefix . 'capabilities';
                $this->caps = &$this->{$this->cap_key};
        function _init_caps() {
                global $wpdb;
                $this->cap_key = $wpdb->prefix . 'capabilities';
                $this->caps = &$this->{$this->cap_key};
-               if ( ! is_array($this->caps) )
+               if ( ! is_array( $this->caps ) )
                        $this->caps = array();
                $this->get_role_caps();
        }
 
                        $this->caps = array();
                $this->get_role_caps();
        }
 
+       /**
+        * Retrieve all of the role capabilities and merge with individual capabilities.
+        *
+        * All of the capabilities of the roles the user belongs to are merged with
+        * the users individual roles. This also means that the user can be denied
+        * specific roles that their role might have, but the specific user isn't
+        * granted permission to.
+        *
+        * @since 2.0.0
+        * @uses $wp_roles
+        * @access public
+        */
        function get_role_caps() {
                global $wp_roles;
 
        function get_role_caps() {
                global $wp_roles;
 
-               if ( ! isset($wp_roles) )
+               if ( ! isset( $wp_roles ) )
                        $wp_roles = new WP_Roles();
 
                //Filter out caps that are not role names and assign to $this->roles
                        $wp_roles = new WP_Roles();
 
                //Filter out caps that are not role names and assign to $this->roles
-               if(is_array($this->caps))
-                       $this->roles = array_filter(array_keys($this->caps), array(&$wp_roles, 'is_role'));
+               if ( is_array( $this->caps ) )
+                       $this->roles = array_filter( array_keys( $this->caps ), array( &$wp_roles, 'is_role' ) );
 
                //Build $allcaps from role caps, overlay user's $caps
                $this->allcaps = array();
 
                //Build $allcaps from role caps, overlay user's $caps
                $this->allcaps = array();
-               foreach( (array) $this->roles as $role) {
-                       $role = $wp_roles->get_role($role);
-                       $this->allcaps = array_merge($this->allcaps, $role->capabilities);
+               foreach ( (array) $this->roles as $role ) {
+                       $role =& $wp_roles->get_role( $role );
+                       $this->allcaps = array_merge( $this->allcaps, $role->capabilities );
                }
                }
-               $this->allcaps = array_merge($this->allcaps, $this->caps);
+               $this->allcaps = array_merge( $this->allcaps, $this->caps );
        }
 
        }
 
-       function add_role($role) {
+       /**
+        * Add role to user.
+        *
+        * Updates the user's meta data option with capabilities and roles.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        */
+       function add_role( $role ) {
                $this->caps[$role] = true;
                $this->caps[$role] = true;
-               update_usermeta($this->ID, $this->cap_key, $this->caps);
+               update_usermeta( $this->ID, $this->cap_key, $this->caps );
                $this->get_role_caps();
                $this->update_user_level_from_caps();
        }
 
                $this->get_role_caps();
                $this->update_user_level_from_caps();
        }
 
-       function remove_role($role) {
-               if ( empty($this->roles[$role]) || (count($this->roles) <= 1) )
+       /**
+        * Remove role from user.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        */
+       function remove_role( $role ) {
+               if ( empty( $this->roles[$role] ) || ( count( $this->roles ) <= 1 ) )
                        return;
                        return;
-               unset($this->caps[$role]);
-               update_usermeta($this->ID, $this->cap_key, $this->caps);
+               unset( $this->caps[$role] );
+               update_usermeta( $this->ID, $this->cap_key, $this->caps );
                $this->get_role_caps();
        }
 
                $this->get_role_caps();
        }
 
-       function set_role($role) {
-               foreach($this->roles as $oldrole)
-                       unset($this->caps[$oldrole]);
-               if ( !empty($role) ) {
+       /**
+        * Set the role of the user.
+        *
+        * This will remove the previous roles of the user and assign the user the
+        * new one. You can set the role to an empty string and it will remove all
+        * of the roles from the user.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $role Role name.
+        */
+       function set_role( $role ) {
+               foreach ( (array) $this->roles as $oldrole )
+                       unset( $this->caps[$oldrole] );
+               if ( !empty( $role ) ) {
                        $this->caps[$role] = true;
                        $this->caps[$role] = true;
-                       $this->roles = array($role => true);
+                       $this->roles = array( $role => true );
                } else {
                        $this->roles = false;
                }
                } else {
                        $this->roles = false;
                }
-               update_usermeta($this->ID, $this->cap_key, $this->caps);
+               update_usermeta( $this->ID, $this->cap_key, $this->caps );
                $this->get_role_caps();
                $this->update_user_level_from_caps();
        }
 
                $this->get_role_caps();
                $this->update_user_level_from_caps();
        }
 
-       function level_reduction($max, $item) {
-               if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
-                       $level = intval($matches[1]);
-                       return max($max, $level);
+       /**
+        * Choose the maximum level the user has.
+        *
+        * Will compare the level from the $item parameter against the $max
+        * parameter. If the item is incorrect, then just the $max parameter value
+        * will be returned.
+        *
+        * Used to get the max level based on the capabilities the user has. This
+        * is also based on roles, so if the user is assigned the Administrator role
+        * then the capability 'level_10' will exist and the user will get that
+        * value.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param int $max Max level of user.
+        * @param string $item Level capability name.
+        * @return int Max Level.
+        */
+       function level_reduction( $max, $item ) {
+               if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) {
+                       $level = intval( $matches[1] );
+                       return max( $max, $level );
                } else {
                        return $max;
                }
        }
 
                } else {
                        return $max;
                }
        }
 
+       /**
+        * Update the maximum user level for the user.
+        *
+        * Updates the 'user_level' user metadata (includes prefix that is the
+        * database table prefix) with the maximum user level. Gets the value from
+        * the all of the capabilities that the user has.
+        *
+        * @since 2.0.0
+        * @access public
+        */
        function update_user_level_from_caps() {
                global $wpdb;
        function update_user_level_from_caps() {
                global $wpdb;
-               $this->user_level = array_reduce(array_keys($this->allcaps),    array(&$this, 'level_reduction'), 0);
-               update_usermeta($this->ID, $wpdb->prefix.'user_level', $this->user_level);
+               $this->user_level = array_reduce( array_keys( $this->allcaps ), array( &$this, 'level_reduction' ), 0 );
+               update_usermeta( $this->ID, $wpdb->prefix.'user_level', $this->user_level );
        }
 
        }
 
-       function add_cap($cap, $grant = true) {
+       /**
+        * Add capability and grant or deny access to capability.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $cap Capability name.
+        * @param bool $grant Whether to grant capability to user.
+        */
+       function add_cap( $cap, $grant = true ) {
                $this->caps[$cap] = $grant;
                $this->caps[$cap] = $grant;
-               update_usermeta($this->ID, $this->cap_key, $this->caps);
+               update_usermeta( $this->ID, $this->cap_key, $this->caps );
        }
 
        }
 
-       function remove_cap($cap) {
-               if ( empty($this->caps[$cap]) ) return;
-               unset($this->caps[$cap]);
-               update_usermeta($this->ID, $this->cap_key, $this->caps);
+       /**
+        * Remove capability from user.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string $cap Capability name.
+        */
+       function remove_cap( $cap ) {
+               if ( empty( $this->caps[$cap] ) ) return;
+               unset( $this->caps[$cap] );
+               update_usermeta( $this->ID, $this->cap_key, $this->caps );
        }
 
        }
 
+       /**
+        * Remove all of the capabilities of the user.
+        *
+        * @since 2.1.0
+        * @access public
+        */
        function remove_all_caps() {
                global $wpdb;
                $this->caps = array();
        function remove_all_caps() {
                global $wpdb;
                $this->caps = array();
-               update_usermeta($this->ID, $this->cap_key, '');
-               update_usermeta($this->ID, $wpdb->prefix.'user_level', '');
+               update_usermeta( $this->ID, $this->cap_key, '' );
+               update_usermeta( $this->ID, $wpdb->prefix.'user_level', '' );
                $this->get_role_caps();
        }
 
                $this->get_role_caps();
        }
 
-       //has_cap(capability_or_role_name) or
-       //has_cap('edit_post', post_id)
-       function has_cap($cap) {
-               if ( is_numeric($cap) )
-                       $cap = $this->translate_level_to_cap($cap);
-
-               $args = array_slice(func_get_args(), 1);
-               $args = array_merge(array($cap, $this->ID), $args);
-               $caps = call_user_func_array('map_meta_cap', $args);
+       /**
+        * Whether user has capability or role name.
+        *
+        * This is useful for looking up whether the user has a specific role
+        * assigned to the user. The second optional parameter can also be used to
+        * check for capabilities against a specfic post.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param string|int $cap Capability or role name to search.
+        * @param int $post_id Optional. Post ID to check capability against specific post.
+        * @return bool True, if user has capability; false, if user does not have capability.
+        */
+       function has_cap( $cap ) {
+               if ( is_numeric( $cap ) )
+                       $cap = $this->translate_level_to_cap( $cap );
+
+               $args = array_slice( func_get_args(), 1 );
+               $args = array_merge( array( $cap, $this->ID ), $args );
+               $caps = call_user_func_array( 'map_meta_cap', $args );
                // Must have ALL requested caps
                // Must have ALL requested caps
-               $capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args);
-               foreach ($caps as $cap) {
+               $capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args );
+               foreach ( (array) $caps as $cap ) {
                        //echo "Checking cap $cap<br />";
                        //echo "Checking cap $cap<br />";
-                       if(empty($capabilities[$cap]) || !$capabilities[$cap])
+                       if ( empty( $capabilities[$cap] ) || !$capabilities[$cap] )
                                return false;
                }
 
                return true;
        }
 
                                return false;
                }
 
                return true;
        }
 
-       function translate_level_to_cap($level) {
+       /**
+        * Convert numeric level to level capability name.
+        *
+        * Prepends 'level_' to level number.
+        *
+        * @since 2.0.0
+        * @access public
+        *
+        * @param int $level Level number, 1 to 10.
+        * @return string
+        */
+       function translate_level_to_cap( $level ) {
                return 'level_' . $level;
        }
 
 }
 
                return 'level_' . $level;
        }
 
 }
 
-// Map meta capabilities to primitive capabilities.
-function map_meta_cap($cap, $user_id) {
-       $args = array_slice(func_get_args(), 2);
+/**
+ * Map meta capabilities to primitive capabilities.
+ *
+ * This does not actually compare whether the user ID has the actual capability,
+ * just what the capability or capabilities are. Meta capability list value can
+ * be 'delete_user', 'edit_user', 'delete_post', 'delete_page', 'edit_post',
+ * 'edit_page', 'read_post', or 'read_page'.
+ *
+ * @since 2.0.0
+ *
+ * @param string $cap Capability name.
+ * @param int $user_id User ID.
+ * @return array Actual capabilities for meta capability.
+ */
+function map_meta_cap( $cap, $user_id ) {
+       $args = array_slice( func_get_args(), 2 );
        $caps = array();
 
        $caps = array();
 
-       switch ($cap) {
+       switch ( $cap ) {
        case 'delete_user':
                $caps[] = 'delete_users';
                break;
        case 'edit_user':
        case 'delete_user':
                $caps[] = 'delete_users';
                break;
        case 'edit_user':
-               if ( !isset($args[0]) || $user_id != $args[0] ) {
+               if ( !isset( $args[0] ) || $user_id != $args[0] ) {
                        $caps[] = 'edit_users';
                }
                break;
        case 'delete_post':
                        $caps[] = 'edit_users';
                }
                break;
        case 'delete_post':
-               $author_data = get_userdata($user_id);
+               $author_data = get_userdata( $user_id );
                //echo "post ID: {$args[0]}<br />";
                //echo "post ID: {$args[0]}<br />";
-               $post = get_post($args[0]);
+               $post = get_post( $args[0] );
                if ( 'page' == $post->post_type ) {
                if ( 'page' == $post->post_type ) {
-                       $args = array_merge(array('delete_page', $user_id), $args);
-                       return call_user_func_array('map_meta_cap', $args);
+                       $args = array_merge( array( 'delete_page', $user_id ), $args );
+                       return call_user_func_array( 'map_meta_cap', $args );
                }
                }
-               $post_author_data = get_userdata($post->post_author);
+               $post_author_data = get_userdata( $post->post_author );
                //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
                // If the user is the author...
                //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
                // If the user is the author...
-               if ($user_id == $post_author_data->ID) {
+               if ( $user_id == $post_author_data->ID ) {
                        // If the post is published...
                        // If the post is published...
-                       if ($post->post_status == 'publish')
+                       if ( 'publish' == $post->post_status )
                                $caps[] = 'delete_published_posts';
                        else
                                // If the post is draft...
                                $caps[] = 'delete_published_posts';
                        else
                                // If the post is draft...
@@ -316,22 +782,22 @@ function map_meta_cap($cap, $user_id) {
                        // The user is trying to edit someone else's post.
                        $caps[] = 'delete_others_posts';
                        // The post is published, extra cap required.
                        // The user is trying to edit someone else's post.
                        $caps[] = 'delete_others_posts';
                        // The post is published, extra cap required.
-                       if ($post->post_status == 'publish')
+                       if ( 'publish' == $post->post_status )
                                $caps[] = 'delete_published_posts';
                                $caps[] = 'delete_published_posts';
-                       else if ($post->post_status == 'private')
+                       elseif ( 'private' == $post->post_status )
                                $caps[] = 'delete_private_posts';
                }
                break;
        case 'delete_page':
                                $caps[] = 'delete_private_posts';
                }
                break;
        case 'delete_page':
-               $author_data = get_userdata($user_id);
+               $author_data = get_userdata( $user_id );
                //echo "post ID: {$args[0]}<br />";
                //echo "post ID: {$args[0]}<br />";
-               $page = get_page($args[0]);
-               $page_author_data = get_userdata($page->post_author);
+               $page = get_page( $args[0] );
+               $page_author_data = get_userdata( $page->post_author );
                //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
                // If the user is the author...
                //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
                // If the user is the author...
-               if ($user_id == $page_author_data->ID) {
+               if ( $user_id == $page_author_data->ID ) {
                        // If the page is published...
                        // If the page is published...
-                       if ($page->post_status == 'publish')
+                       if ( $page->post_status == 'publish' )
                                $caps[] = 'delete_published_pages';
                        else
                                // If the page is draft...
                                $caps[] = 'delete_published_pages';
                        else
                                // If the page is draft...
@@ -340,28 +806,28 @@ function map_meta_cap($cap, $user_id) {
                        // The user is trying to edit someone else's page.
                        $caps[] = 'delete_others_pages';
                        // The page is published, extra cap required.
                        // The user is trying to edit someone else's page.
                        $caps[] = 'delete_others_pages';
                        // The page is published, extra cap required.
-                       if ($page->post_status == 'publish')
+                       if ( $page->post_status == 'publish' )
                                $caps[] = 'delete_published_pages';
                                $caps[] = 'delete_published_pages';
-                       else if ($page->post_status == 'private')
+                       elseif ( $page->post_status == 'private' )
                                $caps[] = 'delete_private_pages';
                }
                break;
                // edit_post breaks down to edit_posts, edit_published_posts, or
                // edit_others_posts
        case 'edit_post':
                                $caps[] = 'delete_private_pages';
                }
                break;
                // edit_post breaks down to edit_posts, edit_published_posts, or
                // edit_others_posts
        case 'edit_post':
-               $author_data = get_userdata($user_id);
+               $author_data = get_userdata( $user_id );
                //echo "post ID: {$args[0]}<br />";
                //echo "post ID: {$args[0]}<br />";
-               $post = get_post($args[0]);
+               $post = get_post( $args[0] );
                if ( 'page' == $post->post_type ) {
                if ( 'page' == $post->post_type ) {
-                       $args = array_merge(array('edit_page', $user_id), $args);
-                       return call_user_func_array('map_meta_cap', $args);
+                       $args = array_merge( array( 'edit_page', $user_id ), $args );
+                       return call_user_func_array( 'map_meta_cap', $args );
                }
                }
-               $post_author_data = get_userdata($post->post_author);
+               $post_author_data = get_userdata( $post->post_author );
                //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
                // If the user is the author...
                //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />";
                // If the user is the author...
-               if ($user_id == $post_author_data->ID) {
+               if ( $user_id == $post_author_data->ID ) {
                        // If the post is published...
                        // If the post is published...
-                       if ($post->post_status == 'publish')
+                       if ( 'publish' == $post->post_status )
                                $caps[] = 'edit_published_posts';
                        else
                                // If the post is draft...
                                $caps[] = 'edit_published_posts';
                        else
                                // If the post is draft...
@@ -370,22 +836,22 @@ function map_meta_cap($cap, $user_id) {
                        // The user is trying to edit someone else's post.
                        $caps[] = 'edit_others_posts';
                        // The post is published, extra cap required.
                        // The user is trying to edit someone else's post.
                        $caps[] = 'edit_others_posts';
                        // The post is published, extra cap required.
-                       if ($post->post_status == 'publish')
+                       if ( 'publish' == $post->post_status )
                                $caps[] = 'edit_published_posts';
                                $caps[] = 'edit_published_posts';
-                       else if ($post->post_status == 'private')
+                       elseif ( 'private' == $post->post_status )
                                $caps[] = 'edit_private_posts';
                }
                break;
        case 'edit_page':
                                $caps[] = 'edit_private_posts';
                }
                break;
        case 'edit_page':
-               $author_data = get_userdata($user_id);
+               $author_data = get_userdata( $user_id );
                //echo "post ID: {$args[0]}<br />";
                //echo "post ID: {$args[0]}<br />";
-               $page = get_page($args[0]);
-               $page_author_data = get_userdata($page->post_author);
+               $page = get_page( $args[0] );
+               $page_author_data = get_userdata( $page->post_author );
                //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
                // If the user is the author...
                //echo "current user id : $user_id, page author id: " . $page_author_data->ID . "<br />";
                // If the user is the author...
-               if ($user_id == $page_author_data->ID) {
+               if ( $user_id == $page_author_data->ID ) {
                        // If the page is published...
                        // If the page is published...
-                       if ($page->post_status == 'publish')
+                       if ( 'publish' == $page->post_status )
                                $caps[] = 'edit_published_pages';
                        else
                                // If the page is draft...
                                $caps[] = 'edit_published_pages';
                        else
                                // If the page is draft...
@@ -394,17 +860,17 @@ function map_meta_cap($cap, $user_id) {
                        // The user is trying to edit someone else's page.
                        $caps[] = 'edit_others_pages';
                        // The page is published, extra cap required.
                        // The user is trying to edit someone else's page.
                        $caps[] = 'edit_others_pages';
                        // The page is published, extra cap required.
-                       if ($page->post_status == 'publish')
+                       if ( 'publish' == $page->post_status )
                                $caps[] = 'edit_published_pages';
                                $caps[] = 'edit_published_pages';
-                       else if ($page->post_status == 'private')
+                       elseif ( 'private' == $page->post_status )
                                $caps[] = 'edit_private_pages';
                }
                break;
        case 'read_post':
                                $caps[] = 'edit_private_pages';
                }
                break;
        case 'read_post':
-               $post = get_post($args[0]);
+               $post = get_post( $args[0] );
                if ( 'page' == $post->post_type ) {
                if ( 'page' == $post->post_type ) {
-                       $args = array_merge(array('read_page', $user_id), $args);
-                       return call_user_func_array('map_meta_cap', $args);
+                       $args = array_merge( array( 'read_page', $user_id ), $args );
+                       return call_user_func_array( 'map_meta_cap', $args );
                }
 
                if ( 'private' != $post->post_status ) {
                }
 
                if ( 'private' != $post->post_status ) {
@@ -412,24 +878,24 @@ function map_meta_cap($cap, $user_id) {
                        break;
                }
 
                        break;
                }
 
-               $author_data = get_userdata($user_id);
-               $post_author_data = get_userdata($post->post_author);
-               if ($user_id == $post_author_data->ID)
+               $author_data = get_userdata( $user_id );
+               $post_author_data = get_userdata( $post->post_author );
+               if ( $user_id == $post_author_data->ID )
                        $caps[] = 'read';
                else
                        $caps[] = 'read_private_posts';
                break;
        case 'read_page':
                        $caps[] = 'read';
                else
                        $caps[] = 'read_private_posts';
                break;
        case 'read_page':
-               $page = get_page($args[0]);
+               $page = get_page( $args[0] );
 
                if ( 'private' != $page->post_status ) {
                        $caps[] = 'read';
                        break;
                }
 
 
                if ( 'private' != $page->post_status ) {
                        $caps[] = 'read';
                        break;
                }
 
-               $author_data = get_userdata($user_id);
-               $page_author_data = get_userdata($page->post_author);
-               if ($user_id == $page_author_data->ID)
+               $author_data = get_userdata( $user_id );
+               $page_author_data = get_userdata( $page->post_author );
+               if ( $user_id == $page_author_data->ID )
                        $caps[] = 'read';
                else
                        $caps[] = 'read_private_pages';
                        $caps[] = 'read';
                else
                        $caps[] = 'read_private_pages';
@@ -442,45 +908,80 @@ function map_meta_cap($cap, $user_id) {
        return $caps;
 }
 
        return $caps;
 }
 
-// Capability checking wrapper around the global $current_user object.
-function current_user_can($capability) {
+/**
+ * Whether current user has capability or role.
+ *
+ * @since 2.0.0
+ *
+ * @param string $capability Capability or role name.
+ * @return bool
+ */
+function current_user_can( $capability ) {
        $current_user = wp_get_current_user();
 
        $current_user = wp_get_current_user();
 
-       if ( empty($current_user) )
+       if ( empty( $current_user ) )
                return false;
 
                return false;
 
-       $args = array_slice(func_get_args(), 1);
-       $args = array_merge(array($capability), $args);
+       $args = array_slice( func_get_args(), 1 );
+       $args = array_merge( array( $capability ), $args );
 
 
-       return call_user_func_array(array(&$current_user, 'has_cap'), $args);
+       return call_user_func_array( array( &$current_user, 'has_cap' ), $args );
 }
 
 }
 
-// Convenience wrappers around $wp_roles.
-function get_role($role) {
+/**
+ * Retrieve role object.
+ *
+ * @see WP_Roles::get_role() Uses method to retrieve role object.
+ * @since 2.0.0
+ *
+ * @param string $role Role name.
+ * @return object
+ */
+function get_role( $role ) {
        global $wp_roles;
 
        global $wp_roles;
 
-       if ( ! isset($wp_roles) )
+       if ( ! isset( $wp_roles ) )
                $wp_roles = new WP_Roles();
 
                $wp_roles = new WP_Roles();
 
-       return $wp_roles->get_role($role);
+       return $wp_roles->get_role( $role );
 }
 
 }
 
-function add_role($role, $display_name, $capabilities = array()) {
+/**
+ * Add role, if it does not exist.
+ *
+ * @see WP_Roles::add_role() Uses method to add role.
+ * @since 2.0.0
+ *
+ * @param string $role Role name.
+ * @param string $display_name Display name for role.
+ * @param array $capabilities List of capabilities.
+ * @return null|WP_Role WP_Role object if role is added, null if already exists.
+ */
+function add_role( $role, $display_name, $capabilities = array() ) {
        global $wp_roles;
 
        global $wp_roles;
 
-       if ( ! isset($wp_roles) )
+       if ( ! isset( $wp_roles ) )
                $wp_roles = new WP_Roles();
 
                $wp_roles = new WP_Roles();
 
-       return $wp_roles->add_role($role, $display_name, $capabilities);
+       return $wp_roles->add_role( $role, $display_name, $capabilities );
 }
 
 }
 
-function remove_role($role) {
+/**
+ * Remove role, if it exists.
+ *
+ * @see WP_Roles::remove_role() Uses method to remove role.
+ * @since 2.0.0
+ *
+ * @param string $role Role name.
+ * @return null
+ */
+function remove_role( $role ) {
        global $wp_roles;
 
        global $wp_roles;
 
-       if ( ! isset($wp_roles) )
+       if ( ! isset( $wp_roles ) )
                $wp_roles = new WP_Roles();
 
                $wp_roles = new WP_Roles();
 
-       return $wp_roles->remove_role($role);
+       return $wp_roles->remove_role( $role );
 }
 
 ?>
 }
 
 ?>
index 2c37e977388fb33edd762a62a428d30ff80dc5c1..5d2240d0ba732807946ff73f8a23bfcb7aea1c53 100644 (file)
@@ -1,53 +1,93 @@
 <?php
 <?php
+/**
+ * Category Template Tags and API.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
 
 
-function get_category_children($id, $before = '/', $after = '', $visited=array()) {
+/**
+ * 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 = '';
        if ( 0 == $id )
                return '';
 
        $chain = '';
-       // TODO: consult hierarchy
+       /** TODO: consult hierarchy */
        $cat_ids = get_all_category_ids();
        $cat_ids = get_all_category_ids();
-       foreach ( $cat_ids as $cat_id ) {
+       foreach ( (array) $cat_ids as $cat_id ) {
                if ( $cat_id == $id )
                        continue;
 
                if ( $cat_id == $id )
                        continue;
 
-               $category = get_category($cat_id);
+               $category = get_category( $cat_id );
                if ( is_wp_error( $category ) )
                        return $category;
                if ( is_wp_error( $category ) )
                        return $category;
-               if ( $category->parent == $id && !in_array($category->term_id, $visited) ) {
+               if ( $category->parent == $id && !in_array( $category->term_id, $visited ) ) {
                        $visited[] = $category->term_id;
                        $chain .= $before.$category->term_id.$after;
                        $visited[] = $category->term_id;
                        $chain .= $before.$category->term_id.$after;
-                       $chain .= get_category_children($category->term_id, $before, $after);
+                       $chain .= get_category_children( $category->term_id, $before, $after );
                }
        }
        return $chain;
 }
 
                }
        }
        return $chain;
 }
 
-function get_category_link($category_id) {
+/**
+ * Retrieve category link URL.
+ *
+ * @since 1.0.0
+ * @uses apply_filters() Calls 'category_link' filter on category link and category ID.
+ *
+ * @param int $category_id Category ID.
+ * @return string
+ */
+function get_category_link( $category_id ) {
        global $wp_rewrite;
        $catlink = $wp_rewrite->get_category_permastruct();
 
        global $wp_rewrite;
        $catlink = $wp_rewrite->get_category_permastruct();
 
-       if ( empty($catlink) ) {
-               $file = get_option('home') . '/';
+       if ( empty( $catlink ) ) {
+               $file = get_option( 'home' ) . '/';
                $catlink = $file . '?cat=' . $category_id;
        } else {
                $catlink = $file . '?cat=' . $category_id;
        } else {
-               $category = &get_category($category_id);
+               $category = &get_category( $category_id );
                if ( is_wp_error( $category ) )
                        return $category;
                $category_nicename = $category->slug;
 
                if ( is_wp_error( $category ) )
                        return $category;
                $category_nicename = $category->slug;
 
-               if ( $parent = $category->parent )
-                       $category_nicename = get_category_parents($parent, false, '/', true) . $category_nicename;
+               if ( $category->parent == $category_id ) // recursive recursion
+                       $category->parent = 0;
+               elseif ($category->parent != 0 )
+                       $category_nicename = get_category_parents( $category->parent, false, '/', true ) . $category_nicename;
 
 
-               $catlink = str_replace('%category%', $category_nicename, $catlink);
-               $catlink = get_option('home') . user_trailingslashit($catlink, 'category');
+               $catlink = str_replace( '%category%', $category_nicename, $catlink );
+               $catlink = get_option( 'home' ) . user_trailingslashit( $catlink, 'category' );
        }
        }
-       return apply_filters('category_link', $catlink, $category_id);
+       return apply_filters( 'category_link', $catlink, $category_id );
 }
 
 }
 
-function get_category_parents($id, $link = FALSE, $separator = '/', $nicename = FALSE, $visited = array()){
+/**
+ * Retrieve category parents with separator.
+ *
+ * @since 1.2.0
+ *
+ * @param int $id Category ID.
+ * @param bool $link Optional, default is false. Whether to format with link.
+ * @param string $separator Optional, default is '/'. How to separate categories.
+ * @param bool $nicename Optional, default is false. Whether to use nice name for display.
+ * @param array $visited Optional. Already linked to categories to prevent duplicates.
+ * @return string
+ */
+function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) {
        $chain = '';
        $chain = '';
-       $parent = &get_category($id);
+       $parent = &get_category( $id );
        if ( is_wp_error( $parent ) )
                return $parent;
 
        if ( is_wp_error( $parent ) )
                return $parent;
 
@@ -56,46 +96,83 @@ function get_category_parents($id, $link = FALSE, $separator = '/', $nicename =
        else
                $name = $parent->cat_name;
 
        else
                $name = $parent->cat_name;
 
-       if ( $parent->parent && ($parent->parent != $parent->term_id) && !in_array($parent->parent, $visited) ) {
+       if ( $parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited ) ) {
                $visited[] = $parent->parent;
                $visited[] = $parent->parent;
-               $chain .= get_category_parents($parent->parent, $link, $separator, $nicename, $visited);
+               $chain .= get_category_parents( $parent->parent, $link, $separator, $nicename, $visited );
        }
 
        if ( $link )
        }
 
        if ( $link )
-               $chain .= '<a href="' . get_category_link($parent->term_id) . '" title="' . sprintf(__("View all posts in %s"), $parent->cat_name) . '">'.$name.'</a>' . $separator;
+               $chain .= '<a href="' . get_category_link( $parent->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $parent->cat_name ) . '">'.$name.'</a>' . $separator;
        else
                $chain .= $name.$separator;
        return $chain;
 }
 
        else
                $chain .= $name.$separator;
        return $chain;
 }
 
-function get_the_category($id = false) {
+/**
+ * Retrieve post categories.
+ *
+ * @since 0.71
+ * @uses $post
+ *
+ * @param int $id Optional, default to current post ID. The post ID.
+ * @return array
+ */
+function get_the_category( $id = false ) {
        global $post;
 
        $id = (int) $id;
        if ( !$id )
                $id = (int) $post->ID;
 
        global $post;
 
        $id = (int) $id;
        if ( !$id )
                $id = (int) $post->ID;
 
-       $categories = get_object_term_cache($id, 'category');
-       if ( false === $categories )
-               $categories = wp_get_object_terms($id, 'category');
+       $categories = get_object_term_cache( $id, 'category' );
+       if ( false === $categories ) {
+               $categories = wp_get_object_terms( $id, 'category' );
+               wp_cache_add($id, $categories, 'category_relationships');
+       }
 
 
-       if ( !empty($categories) )
-               usort($categories, '_usort_terms_by_name');
+       if ( !empty( $categories ) )
+               usort( $categories, '_usort_terms_by_name' );
        else
                $categories = array();
 
        else
                $categories = array();
 
-       foreach(array_keys($categories) as $key) {
-               _make_cat_compat($categories[$key]);
+       foreach ( (array) array_keys( $categories ) as $key ) {
+               _make_cat_compat( $categories[$key] );
        }
 
        return $categories;
 }
 
        }
 
        return $categories;
 }
 
-function _usort_terms_by_name($a, $b) {
-       return strcmp($a->name, $b->name);
+/**
+ * Sort categories by name.
+ *
+ * Used by usort() as a callback, should not be used directly. Can actually be
+ * used to sort any term object.
+ *
+ * @since 2.3.0
+ * @access private
+ *
+ * @param object $a
+ * @param object $b
+ * @return int
+ */
+function _usort_terms_by_name( $a, $b ) {
+       return strcmp( $a->name, $b->name );
 }
 
 }
 
-function _usort_terms_by_ID($a, $b) {
+/**
+ * Sort categories by ID.
+ *
+ * Used by usort() as a callback, should not be used directly. Can actually be
+ * used to sort any term object.
+ *
+ * @since 2.3.0
+ * @access private
+ *
+ * @param object $a
+ * @param object $b
+ * @return int
+ */
+function _usort_terms_by_ID( $a, $b ) {
        if ( $a->term_id > $b->term_id )
                return 1;
        elseif ( $a->term_id < $b->term_id )
        if ( $a->term_id > $b->term_id )
                return 1;
        elseif ( $a->term_id < $b->term_id )
@@ -104,42 +181,60 @@ function _usort_terms_by_ID($a, $b) {
                return 0;
 }
 
                return 0;
 }
 
-function get_the_category_by_ID($cat_ID) {
+/**
+ * Retrieve category name based on category ID.
+ *
+ * @since 0.71
+ *
+ * @param int $cat_ID Category ID.
+ * @return string Category name.
+ */
+function get_the_category_by_ID( $cat_ID ) {
        $cat_ID = (int) $cat_ID;
        $cat_ID = (int) $cat_ID;
-       $category = &get_category($cat_ID);
+       $category = &get_category( $cat_ID );
        if ( is_wp_error( $category ) )
                return $category;
        return $category->name;
 }
 
        if ( is_wp_error( $category ) )
                return $category;
        return $category->name;
 }
 
-function get_the_category_list($separator = '', $parents='', $post_id = false) {
+/**
+ * Retrieve category list in either HTML list or custom format.
+ *
+ * @since 1.5.1
+ *
+ * @param string $separator Optional, default is empty string. Separator for between the categories.
+ * @param string $parents Optional. How to display the parents.
+ * @param int $post_id Optional. Post ID to retrieve categories.
+ * @return string
+ */
+function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
        global $wp_rewrite;
        global $wp_rewrite;
-       $categories = get_the_category($post_id);
-       if (empty($categories))
-               return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
+       $categories = get_the_category( $post_id );
+       if ( empty( $categories ) )
+               return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
 
 
-       $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
+       $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
 
        $thelist = '';
        if ( '' == $separator ) {
                $thelist .= '<ul class="post-categories">';
                foreach ( $categories as $category ) {
                        $thelist .= "\n\t<li>";
 
        $thelist = '';
        if ( '' == $separator ) {
                $thelist .= '<ul class="post-categories">';
                foreach ( $categories as $category ) {
                        $thelist .= "\n\t<li>";
-                       switch ( strtolower($parents) ) {
+                       switch ( strtolower( $parents ) ) {
                                case 'multiple':
                                case 'multiple':
-                                       if ($category->parent)
-                                               $thelist .= get_category_parents($category->parent, TRUE);
-                                       $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->name.'</a></li>';
+                                       if ( $category->parent )
+                                               $thelist .= get_category_parents( $category->parent, true, $separator );
+                                       $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->name.'</a></li>';
                                        break;
                                case 'single':
                                        break;
                                case 'single':
-                                       $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>';
-                                       if ($category->parent)
-                                               $thelist .= get_category_parents($category->parent, FALSE);
+                                       $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>';
+                                       if ( $category->parent )
+                                               $thelist .= get_category_parents( $category->parent, false, $separator );
                                        $thelist .= $category->name.'</a></li>';
                                        break;
                                case '':
                                default:
                                        $thelist .= $category->name.'</a></li>';
                                        break;
                                case '':
                                default:
-                                       $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->cat_name.'</a></li>';
+                                       $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->cat_name.'</a></li>';
                        }
                }
                $thelist .= '</ul>';
                        }
                }
                $thelist .= '</ul>';
@@ -148,75 +243,131 @@ function get_the_category_list($separator = '', $parents='', $post_id = false) {
                foreach ( $categories as $category ) {
                        if ( 0 < $i )
                                $thelist .= $separator . ' ';
                foreach ( $categories as $category ) {
                        if ( 0 < $i )
                                $thelist .= $separator . ' ';
-                       switch ( strtolower($parents) ) {
+                       switch ( strtolower( $parents ) ) {
                                case 'multiple':
                                        if ( $category->parent )
                                case 'multiple':
                                        if ( $category->parent )
-                                               $thelist .= get_category_parents($category->parent, TRUE);
-                                       $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->cat_name.'</a>';
+                                               $thelist .= get_category_parents( $category->parent, true, $separator );
+                                       $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->cat_name.'</a>';
                                        break;
                                case 'single':
                                        break;
                                case 'single':
-                                       $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>';
+                                       $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>';
                                        if ( $category->parent )
                                        if ( $category->parent )
-                                               $thelist .= get_category_parents($category->parent, FALSE);
+                                               $thelist .= get_category_parents( $category->parent, false, $separator );
                                        $thelist .= "$category->cat_name</a>";
                                        break;
                                case '':
                                default:
                                        $thelist .= "$category->cat_name</a>";
                                        break;
                                case '':
                                default:
-                                       $thelist .= '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . $rel . '>' . $category->name.'</a>';
+                                       $thelist .= '<a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . $rel . '>' . $category->name.'</a>';
                        }
                        ++$i;
                }
        }
                        }
                        ++$i;
                }
        }
-       return apply_filters('the_category', $thelist, $separator, $parents);
+       return apply_filters( 'the_category', $thelist, $separator, $parents );
 }
 
 }
 
-/*
- * in_category() - Checks whether the current post is within a particular category
+
+/**
+ * Check if the current post in within any of the given categories.
  *
  *
- * This function checks to see if the post is within the supplied category.  The categoy
- * can be specified by number or name and will be checked as a name first to allow for categories with numeric names.
- * Note: Prior to v2.5 of WordPress category names where not supported.
+ * The given categories are checked against the post's categories' term_ids, names and slugs.
+ * Categories given as integers will only be checked against the post's categories' term_ids.
+ *
+ * Prior to v2.5 of WordPress, category names were not supported.
+ * Prior to v2.7, category slugs were not supported.
+ * Prior to v2.7, only one category could be compared: in_category( $single_category ).
+ * Prior to v2.7, this function could only be used in the WordPress Loop.
+ * As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
  *
  * @since 1.2.0
  *
  *
  * @since 1.2.0
  *
- * @param int|string $category
- * @return bool true if the post is in the supplied category
-*/
-function in_category( $category ) { // Check if the current post is in the given category
-       global $post;
-
-       if ( empty($category) )
+ * @uses is_object_in_term()
+ *
+ * @param int|string|array $category. Category ID, name or slug, or array of said.
+ * @param int|post object Optional.  Post to check instead of the current post. @since 2.7.0
+ * @return bool True if the current post is in any of the given categories.
+ */
+function in_category( $category, $_post = null ) {
+       if ( empty( $category ) )
                return false;
 
                return false;
 
-       // If category is not an int, check to see if it's a name
-       if ( ! is_int($category) ) {
-               $cat_ID = get_cat_ID($category);
-               if ( $cat_ID )
-                       $category = $cat_ID;
+       if ( $_post ) {
+               $_post = get_post( $_post );
+       } else {
+               $_post =& $GLOBALS['post'];
        }
 
        }
 
-       $categories = get_object_term_cache($post->ID, 'category');
-       if ( false === $categories )
-               $categories = wp_get_object_terms($post->ID, 'category');
-       if ( array_key_exists($category, $categories) )
-               return true;
-       else
+       if ( !$_post )
+               return false;
+
+       $r = is_object_in_term( $_post->ID, 'category', $category );
+       if ( is_wp_error( $r ) )
                return false;
                return false;
+       return $r;
 }
 
 }
 
-function the_category($separator = '', $parents='', $post_id = false) {
-       echo get_the_category_list($separator, $parents, $post_id);
+/**
+ * Display the category list for the post.
+ *
+ * @since 0.71
+ *
+ * @param string $separator Optional, default is empty string. Separator for between the categories.
+ * @param string $parents Optional. How to display the parents.
+ * @param int $post_id Optional. Post ID to retrieve categories.
+ */
+function the_category( $separator = '', $parents='', $post_id = false ) {
+       echo get_the_category_list( $separator, $parents, $post_id );
 }
 
 }
 
-function category_description($category = 0) {
+/**
+ * Retrieve category description.
+ *
+ * @since 1.0.0
+ *
+ * @param int $category Optional. Category ID. Will use global category ID by default.
+ * @return string Category description, available.
+ */
+function category_description( $category = 0 ) {
        global $cat;
        if ( !$category )
                $category = $cat;
 
        global $cat;
        if ( !$category )
                $category = $cat;
 
-       return get_term_field('description', $category, 'category');
+       return get_term_field( 'description', $category, 'category' );
 }
 
 }
 
-function wp_dropdown_categories($args = '') {
+/**
+ * Display or retrieve the HTML dropdown list of categories.
+ *
+ * The list of arguments is below:
+ *     'show_option_all' (string) - Text to display for showing all categories.
+ *     'show_option_none' (string) - Text to display for showing no categories.
+ *     'orderby' (string) default is 'ID' - What column to use for ordering the
+ * categories.
+ *     'order' (string) default is 'ASC' - What direction to order categories.
+ *     'show_last_update' (bool|int) default is 0 - See {@link get_categories()}
+ *     'show_count' (bool|int) default is 0 - Whether to show how many posts are
+ * in the category.
+ *     'hide_empty' (bool|int) default is 1 - Whether to hide categories that
+ * don't have any posts attached to them.
+ *     'child_of' (int) default is 0 - See {@link get_categories()}.
+ *     'exclude' (string) - See {@link get_categories()}.
+ *     'echo' (bool|int) default is 1 - Whether to display or retrieve content.
+ *     'depth' (int) - The max depth.
+ *     'tab_index' (int) - Tab index for select element.
+ *     'name' (string) - The name attribute value for selected element.
+ *     'class' (string) - The class attribute value for selected element.
+ *     'selected' (int) - Which category ID is selected.
+ *
+ * The 'hierarchical' argument, which is disabled by default, will override the
+ * depth argument, unless it is true. When the argument is false, it will
+ * display all of the categories. When it is enabled it will use the value in
+ * the 'depth' argument.
+ *
+ * @since 2.1.0
+ *
+ * @param string|array $args Optional. Override default arguments.
+ * @return string HTML content only if 'echo' argument is 0.
+ */
+function wp_dropdown_categories( $args = '' ) {
        $defaults = array(
                'show_option_all' => '', 'show_option_none' => '',
                'orderby' => 'ID', 'order' => 'ASC',
        $defaults = array(
                'show_option_all' => '', 'show_option_none' => '',
                'orderby' => 'ID', 'order' => 'ASC',
@@ -228,7 +379,7 @@ function wp_dropdown_categories($args = '') {
                'depth' => 0, 'tab_index' => 0
        );
 
                'depth' => 0, 'tab_index' => 0
        );
 
-       $defaults['selected'] = ( is_category() ) ? get_query_var('cat') : 0;
+       $defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
 
        $r = wp_parse_args( $args, $defaults );
        $r['include_last_update_time'] = $r['show_last_update'];
 
        $r = wp_parse_args( $args, $defaults );
        $r['include_last_update_time'] = $r['show_last_update'];
@@ -238,20 +389,22 @@ function wp_dropdown_categories($args = '') {
        if ( (int) $tab_index > 0 )
                $tab_index_attribute = " tabindex=\"$tab_index\"";
 
        if ( (int) $tab_index > 0 )
                $tab_index_attribute = " tabindex=\"$tab_index\"";
 
-       $categories = get_categories($r);
+       $categories = get_categories( $r );
 
        $output = '';
 
        $output = '';
-       if ( ! empty($categories) ) {
+       if ( ! empty( $categories ) ) {
                $output = "<select name='$name' id='$name' class='$class' $tab_index_attribute>\n";
 
                if ( $show_option_all ) {
                $output = "<select name='$name' id='$name' class='$class' $tab_index_attribute>\n";
 
                if ( $show_option_all ) {
-                       $show_option_all = apply_filters('list_cats', $show_option_all);
-                       $output .= "\t<option value='0'>$show_option_all</option>\n";
+                       $show_option_all = apply_filters( 'list_cats', $show_option_all );
+                       $selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : '';
+                       $output .= "\t<option value='0'$selected>$show_option_all</option>\n";
                }
 
                }
 
-               if ( $show_option_none) {
-                       $show_option_none = apply_filters('list_cats', $show_option_none);
-                       $output .= "\t<option value='-1'>$show_option_none</option>\n";
+               if ( $show_option_none ) {
+                       $show_option_none = apply_filters( 'list_cats', $show_option_none );
+                       $selected = ( '-1' === strval($r['selected']) ) ? " selected='selected'" : '';
+                       $output .= "\t<option value='-1'$selected>$show_option_none</option>\n";
                }
 
                if ( $hierarchical )
                }
 
                if ( $hierarchical )
@@ -259,11 +412,11 @@ function wp_dropdown_categories($args = '') {
                else
                        $depth = -1; // Flat.
 
                else
                        $depth = -1; // Flat.
 
-               $output .= walk_category_dropdown_tree($categories, $depth, $r);
+               $output .= walk_category_dropdown_tree( $categories, $depth, $r );
                $output .= "</select>\n";
        }
 
                $output .= "</select>\n";
        }
 
-       $output = apply_filters('wp_dropdown_cats', $output);
+       $output = apply_filters( 'wp_dropdown_cats', $output );
 
        if ( $echo )
                echo $output;
 
        if ( $echo )
                echo $output;
@@ -271,15 +424,48 @@ function wp_dropdown_categories($args = '') {
        return $output;
 }
 
        return $output;
 }
 
-function wp_list_categories($args = '') {
+/**
+ * Display or retrieve the HTML list of categories.
+ *
+ * The list of arguments is below:
+ *     'show_option_all' (string) - Text to display for showing all categories.
+ *     'orderby' (string) default is 'ID' - What column to use for ordering the
+ * categories.
+ *     'order' (string) default is 'ASC' - What direction to order categories.
+ *     'show_last_update' (bool|int) default is 0 - See {@link
+ * walk_category_dropdown_tree()}
+ *     'show_count' (bool|int) default is 0 - Whether to show how many posts are
+ * in the category.
+ *     'hide_empty' (bool|int) default is 1 - Whether to hide categories that
+ * don't have any posts attached to them.
+ *     'use_desc_for_title' (bool|int) default is 1 - Whether to use the
+ * description instead of the category title.
+ *     'feed' - See {@link get_categories()}.
+ *     'feed_type' - See {@link get_categories()}.
+ *     'feed_image' - See {@link get_categories()}.
+ *     'child_of' (int) default is 0 - See {@link get_categories()}.
+ *     'exclude' (string) - See {@link get_categories()}.
+ *     'exclude_tree' (string) - See {@link get_categories()}.
+ *     'echo' (bool|int) default is 1 - Whether to display or retrieve content.
+ *     'current_category' (int) - See {@link get_categories()}.
+ *     'hierarchical' (bool) - See {@link get_categories()}.
+ *     'title_li' (string) - See {@link get_categories()}.
+ *     'depth' (int) - The max depth.
+ *
+ * @since 2.1.0
+ *
+ * @param string|array $args Optional. Override default arguments.
+ * @return string HTML content only if 'echo' argument is 0.
+ */
+function wp_list_categories( $args = '' ) {
        $defaults = array(
                'show_option_all' => '', 'orderby' => 'name',
                'order' => 'ASC', 'show_last_update' => 0,
                'style' => 'list', 'show_count' => 0,
                'hide_empty' => 1, 'use_desc_for_title' => 1,
                'child_of' => 0, 'feed' => '', 'feed_type' => '',
        $defaults = array(
                'show_option_all' => '', 'orderby' => 'name',
                'order' => 'ASC', 'show_last_update' => 0,
                'style' => 'list', 'show_count' => 0,
                'hide_empty' => 1, 'use_desc_for_title' => 1,
                'child_of' => 0, 'feed' => '', 'feed_type' => '',
-               'feed_image' => '', 'exclude' => '', 'current_category' => 0,
-               'hierarchical' => true, 'title_li' => __('Categories'),
+               'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0,
+               'hierarchical' => true, 'title_li' => __( 'Categories' ),
                'echo' => 1, 'depth' => 0
        );
 
                'echo' => 1, 'depth' => 0
        );
 
@@ -293,27 +479,32 @@ function wp_list_categories($args = '') {
                $r['include_last_update_time'] = $r['show_date'];
        }
 
                $r['include_last_update_time'] = $r['show_date'];
        }
 
+       if ( true == $r['hierarchical'] ) {
+               $r['exclude_tree'] = $r['exclude'];
+               $r['exclude'] = '';
+       }
+
        extract( $r );
 
        extract( $r );
 
-       $categories = get_categories($r);
+       $categories = get_categories( $r );
 
        $output = '';
        if ( $title_li && 'list' == $style )
                        $output = '<li class="categories">' . $r['title_li'] . '<ul>';
 
 
        $output = '';
        if ( $title_li && 'list' == $style )
                        $output = '<li class="categories">' . $r['title_li'] . '<ul>';
 
-       if ( empty($categories) ) {
+       if ( empty( $categories ) ) {
                if ( 'list' == $style )
                if ( 'list' == $style )
-                       $output .= '<li>' . __("No categories") . '</li>';
+                       $output .= '<li>' . __( "No categories" ) . '</li>';
                else
                else
-                       $output .= __("No categories");
+                       $output .= __( "No categories" );
        } else {
                global $wp_query;
 
        } else {
                global $wp_query;
 
-               if( !empty($show_option_all) )
-                       if ('list' == $style )
-                               $output .= '<li><a href="' .  get_bloginfo('url')  . '">' . $show_option_all . '</a></li>';
+               if( !empty( $show_option_all ) )
+                       if ( 'list' == $style )
+                               $output .= '<li><a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a></li>';
                        else
                        else
-                               $output .= '<a href="' .  get_bloginfo('url')  . '">' . $show_option_all . '</a>';
+                               $output .= '<a href="' .  get_bloginfo( 'url' )  . '">' . $show_option_all . '</a>';
 
                if ( empty( $r['current_category'] ) && is_category() )
                        $r['current_category'] = $wp_query->get_queried_object_id();
 
                if ( empty( $r['current_category'] ) && is_category() )
                        $r['current_category'] = $wp_query->get_queried_object_id();
@@ -323,13 +514,13 @@ function wp_list_categories($args = '') {
                else
                        $depth = -1; // Flat.
 
                else
                        $depth = -1; // Flat.
 
-               $output .= walk_category_tree($categories, $depth, $r);
+               $output .= walk_category_tree( $categories, $depth, $r );
        }
 
        if ( $title_li && 'list' == $style )
                $output .= '</ul></li>';
 
        }
 
        if ( $title_li && 'list' == $style )
                $output .= '</ul></li>';
 
-       $output = apply_filters('wp_list_categories', $output);
+       $output = apply_filters( 'wp_list_categories', $output );
 
        if ( $echo )
                echo $output;
 
        if ( $echo )
                echo $output;
@@ -337,23 +528,60 @@ function wp_list_categories($args = '') {
                return $output;
 }
 
                return $output;
 }
 
+/**
+ * Display tag cloud.
+ *
+ * The text size is set by the 'smallest' and 'largest' arguments, which will
+ * use the 'unit' argument value for the CSS text size unit. The 'format'
+ * argument can be 'flat' (default), 'list', or 'array'. The flat value for the
+ * 'format' argument will separate tags with spaces. The list value for the
+ * '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 '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'.
+ *
+ * The 'number' argument is how many tags to return. By default, the limit will
+ * be to return the top 45 tags in the tag cloud list.
+ *
+ * The 'topic_count_text_callback' argument is a function, which, given the count
+ * of the posts  with that tag, returns a text for the tooltip of the tag link.
+ *
+ * The 'exclude' and 'include' arguments are used for the {@link get_tags()}
+ * function. Only one should be used, because only one will be used and the
+ * other ignored, if they are both set.
+ *
+ * @since 2.3.0
+ *
+ * @param array|string $args Optional. Override default arguments.
+ * @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
+ */
 function wp_tag_cloud( $args = '' ) {
        $defaults = array(
                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
                'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
 function wp_tag_cloud( $args = '' ) {
        $defaults = array(
                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
                'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
-               'exclude' => '', 'include' => ''
+               'exclude' => '', 'include' => '', 'link' => 'view'
        );
        $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_tags( array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
 
 
-       if ( empty($tags) )
+       if ( empty( $tags ) )
                return;
 
                return;
 
-       $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
+       foreach ( $tags as $key => $tag ) {
+               if ( 'edit' == $args['link'] )
+                       $link = get_edit_tag_link( $tag->term_id );
+               else
+                       $link = get_tag_link( $tag->term_id );
+               if ( is_wp_error( $link ) )
+                       return false;
 
 
-       if ( is_wp_error( $return ) )
-               return false;
+               $tags[ $key ]->link = $link;
+               $tags[ $key ]->id = $tag->term_id;
+       }
+
+       $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
 
        $return = apply_filters( 'wp_tag_cloud', $return, $args );
 
 
        $return = apply_filters( 'wp_tag_cloud', $return, $args );
 
@@ -363,64 +591,109 @@ function wp_tag_cloud( $args = '' ) {
        echo $return;
 }
 
        echo $return;
 }
 
-// $tags = prefetched tag array ( get_tags() )
-// $args['format'] = 'flat' => whitespace separated, 'list' => UL, 'array' => array()
-// $args['orderby'] = 'name', 'count'
+/**
+ * Default text for tooltip for tag links
+ *
+ * @param integer $count number of posts with that tag
+ * @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 ) );
+}
+
+/**
+ * Generates a tag cloud (heatmap) from provided data.
+ *
+ * The text size is set by the 'smallest' and 'largest' arguments, which will
+ * use the 'unit' argument value for the CSS text size unit. The 'format'
+ * argument can be 'flat' (default), 'list', or 'array'. The flat value for the
+ * 'format' argument will separate tags with spaces. The list value for the
+ * '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 '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 'number' argument is how many tags to return. By default, the limit will
+ * be to return the entire tag cloud list.
+ *
+ * The 'topic_count_text_callback' argument is a function, which given the count
+ * of the posts  with that tag returns a text for the tooltip of the tag link.
+ *
+ * @todo Complete functionality.
+ * @since 2.3.0
+ *
+ * @param array $tags List of tags.
+ * @param string|array $args Optional, override default arguments.
+ * @return string
+ */
 function wp_generate_tag_cloud( $tags, $args = '' ) {
        global $wp_rewrite;
        $defaults = array(
 function wp_generate_tag_cloud( $tags, $args = '' ) {
        global $wp_rewrite;
        $defaults = array(
-               'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
-               'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC'
+               'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
+               'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
+               'topic_count_text_callback' => 'default_topic_count_text',
        );
        );
-       $args = wp_parse_args( $args, $defaults );
-       extract($args);
 
 
-       if ( !$tags )
-               return;
-       $counts = $tag_links = array();
-       foreach ( (array) $tags as $tag ) {
-               $counts[$tag->name] = $tag->count;
-               $tag_links[$tag->name] = get_tag_link( $tag->term_id );
-               if ( is_wp_error( $tag_links[$tag->name] ) )
-                       return $tag_links[$tag->name];
-               $tag_ids[$tag->name] = $tag->term_id;
+       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),
+                       number_format_i18n( $count ));';
+               $args['topic_count_text_callback'] = create_function('$count', $body);
        }
 
        }
 
-       $min_count = min($counts);
-       $spread = max($counts) - $min_count;
-       if ( $spread <= 0 )
-               $spread = 1;
-       $font_spread = $largest - $smallest;
-       if ( $font_spread <= 0 )
-               $font_spread = 1;
-       $font_step = $font_spread / $spread;
+       $args = wp_parse_args( $args, $defaults );
+
+       extract( $args );
+
+       if ( empty( $tags ) )
+               return;
 
        // SQL cannot save you; this is a second (potentially different) sort on a subset of data.
        if ( 'name' == $orderby )
 
        // SQL cannot save you; this is a second (potentially different) sort on a subset of data.
        if ( 'name' == $orderby )
-               uksort($counts, 'strnatcasecmp');
+               uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name, $b->name);') );
        else
        else
-               asort($counts);
+               uasort( $tags, create_function('$a, $b', 'return ($a->count > $b->count);') );
 
        if ( 'DESC' == $order )
 
        if ( 'DESC' == $order )
-               $counts = array_reverse( $counts, true );
+               $tags = array_reverse( $tags, true );
        elseif ( 'RAND' == $order ) {
        elseif ( 'RAND' == $order ) {
-               $keys = array_rand( $counts, count($counts) );
+               $keys = array_rand( $tags, count( $tags ) );
                foreach ( $keys as $key )
                foreach ( $keys as $key )
-                       $temp[$key] = $counts[$key];
-               $counts = $temp;
-               unset($temp);
+                       $temp[$key] = $tags[$key];
+               $tags = $temp;
+               unset( $temp );
        }
 
        }
 
+       if ( $number > 0 )
+               $tags = array_slice($tags, 0, $number);
+
+       $counts = array();
+       foreach ( (array) $tags as $key => $tag )
+               $counts[ $key ] = $tag->count;
+
+       $min_count = min( $counts );
+       $spread = max( $counts ) - $min_count;
+       if ( $spread <= 0 )
+               $spread = 1;
+       $font_spread = $largest - $smallest;
+       if ( $font_spread < 0 )
+               $font_spread = 1;
+       $font_step = $font_spread / $spread;
+
        $a = array();
 
        $a = array();
 
-       $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : '';
+       $rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : '';
 
 
-       foreach ( $counts as $tag => $count ) {
-               $tag_id = $tag_ids[$tag];
-               $tag_link = clean_url($tag_links[$tag]);
-               $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext('%d topic','%d topics',$count), $count ) ) . "'$rel style='font-size: " .
+       foreach ( $tags as $key => $tag ) {
+               $count = $counts[ $key ];
+               $tag_link = '#' != $tag->link ? clean_url( $tag->link ) : '#';
+               $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: " .
                        ( $smallest + ( ( $count - $min_count ) * $font_step ) )
                        ( $smallest + ( ( $count - $min_count ) * $font_step ) )
-                       . "$unit;'>$tag</a>";
+                       . "$unit;'>$tag_name</a>";
        }
 
        switch ( $format ) :
        }
 
        switch ( $format ) :
@@ -429,11 +702,11 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
                break;
        case 'list' :
                $return = "<ul class='wp-tag-cloud'>\n\t<li>";
                break;
        case 'list' :
                $return = "<ul class='wp-tag-cloud'>\n\t<li>";
-               $return .= join("</li>\n\t<li>", $a);
+               $return .= join( "</li>\n\t<li>", $a );
                $return .= "</li>\n</ul>\n";
                break;
        default :
                $return .= "</li>\n</ul>\n";
                break;
        default :
-               $return = join("\n", $a);
+               $return = join( "\n", $a );
                break;
        endswitch;
 
                break;
        endswitch;
 
@@ -444,53 +717,127 @@ function wp_generate_tag_cloud( $tags, $args = '' ) {
 // Helper functions
 //
 
 // Helper functions
 //
 
+/**
+ * Retrieve HTML list content for category list.
+ *
+ * @uses Walker_Category to create HTML list content.
+ * @since 2.1.0
+ * @see Walker_Category::walk() for parameters and return description.
+ */
 function walk_category_tree() {
 function walk_category_tree() {
-       $walker = new Walker_Category;
        $args = func_get_args();
        $args = func_get_args();
-       return call_user_func_array(array(&$walker, 'walk'), $args);
+       // the user's options are the third parameter
+       if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
+               $walker = new Walker_Category;
+       else
+               $walker = $args[2]['walker'];
+
+       return call_user_func_array(array( &$walker, 'walk' ), $args );
 }
 
 }
 
+/**
+ * Retrieve HTML dropdown (select) content for category list.
+ *
+ * @uses Walker_CategoryDropdown to create HTML dropdown content.
+ * @since 2.1.0
+ * @see Walker_CategoryDropdown::walk() for parameters and return description.
+ */
 function walk_category_dropdown_tree() {
 function walk_category_dropdown_tree() {
-       $walker = new Walker_CategoryDropdown;
        $args = func_get_args();
        $args = func_get_args();
-       return call_user_func_array(array(&$walker, 'walk'), $args);
+       // the user's options are the third parameter
+       if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') )
+               $walker = new Walker_CategoryDropdown;
+       else
+               $walker = $args[2]['walker'];
+
+       return call_user_func_array(array( &$walker, 'walk' ), $args );
 }
 
 //
 // Tags
 //
 
 }
 
 //
 // Tags
 //
 
+/**
+ * Retrieve the link to the tag.
+ *
+ * @since 2.3.0
+ * @uses apply_filters() Calls 'tag_link' with tag link and tag ID as parameters.
+ *
+ * @param int $tag_id Tag (term) ID.
+ * @return string
+ */
 function get_tag_link( $tag_id ) {
        global $wp_rewrite;
        $taglink = $wp_rewrite->get_tag_permastruct();
 
 function get_tag_link( $tag_id ) {
        global $wp_rewrite;
        $taglink = $wp_rewrite->get_tag_permastruct();
 
-       $tag = &get_term($tag_id, 'post_tag');
+       $tag = &get_term( $tag_id, 'post_tag' );
        if ( is_wp_error( $tag ) )
                return $tag;
        $slug = $tag->slug;
 
        if ( is_wp_error( $tag ) )
                return $tag;
        $slug = $tag->slug;
 
-       if ( empty($taglink) ) {
-               $file = get_option('home') . '/';
+       if ( empty( $taglink ) ) {
+               $file = get_option( 'home' ) . '/';
                $taglink = $file . '?tag=' . $slug;
        } else {
                $taglink = $file . '?tag=' . $slug;
        } else {
-               $taglink = str_replace('%tag%', $slug, $taglink);
-               $taglink = get_option('home') . user_trailingslashit($taglink, 'category');
+               $taglink = str_replace( '%tag%', $slug, $taglink );
+               $taglink = get_option( 'home' ) . user_trailingslashit( $taglink, 'category' );
        }
        }
-       return apply_filters('tag_link', $taglink, $tag_id);
+       return apply_filters( 'tag_link', $taglink, $tag_id );
 }
 
 }
 
+/**
+ * Retrieve the tags for a post.
+ *
+ * @since 2.3.0
+ * @uses apply_filters() Calls 'get_the_tags' filter on the list of post tags.
+ *
+ * @param int $id Post ID.
+ * @return array
+ */
 function get_the_tags( $id = 0 ) {
 function get_the_tags( $id = 0 ) {
-       return apply_filters( 'get_the_tags', get_the_terms($id, 'post_tag') );
+       return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
 }
 
 }
 
+/**
+ * Retrieve the tags for a post formatted as a string.
+ *
+ * @since 2.3.0
+ * @uses apply_filters() Calls 'the_tags' filter on string list of tags.
+ *
+ * @param string $before Optional. Before tags.
+ * @param string $sep Optional. Between tags.
+ * @param string $after Optional. After tags.
+ * @return string
+ */
 function get_the_tag_list( $before = '', $sep = '', $after = '' ) {
 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 ) );
 }
 
 }
 
+/**
+ * Retrieve the tags for a post.
+ *
+ * @since 2.3.0
+ *
+ * @param string $before Optional. Before list.
+ * @param string $sep Optional. Separate items using this.
+ * @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 = 'Tags: ', $sep = ', ', $after = '' ) {
        return the_terms( 0, 'post_tag', $before, $sep, $after );
 }
 
+/**
+ * Retrieve the terms of the taxonomy that are attached to the post.
+ *
+ * This function can only be used within the loop.
+ *
+ * @since 2.5.0
+ *
+ * @param int $id Post ID. Is not optional.
+ * @param string $taxonomy Taxonomy name.
+ * @return array|bool False on failure. Array of term objects on success.
+ */
 function get_the_terms( $id = 0, $taxonomy ) {
        global $post;
 
 function get_the_terms( $id = 0, $taxonomy ) {
        global $post;
 
@@ -502,9 +849,9 @@ function get_the_terms( $id = 0, $taxonomy ) {
        if ( !$id )
                $id = (int) $post->ID;
 
        if ( !$id )
                $id = (int) $post->ID;
 
-       $terms = get_object_term_cache($id, $taxonomy);
+       $terms = get_object_term_cache( $id, $taxonomy );
        if ( false === $terms )
        if ( false === $terms )
-               $terms = wp_get_object_terms($id, $taxonomy);
+               $terms = wp_get_object_terms( $id, $taxonomy );
 
        if ( empty( $terms ) )
                return false;
 
        if ( empty( $terms ) )
                return false;
@@ -512,17 +859,29 @@ function get_the_terms( $id = 0, $taxonomy ) {
        return $terms;
 }
 
        return $terms;
 }
 
+/**
+ * Retrieve terms as a list with specified format.
+ *
+ * @since 2.5.0
+ *
+ * @param int $id Term ID.
+ * @param string $taxonomy Taxonomy name.
+ * @param string $before Optional. Before list.
+ * @param string $sep Optional. Separate items using this.
+ * @param string $after Optional. After list.
+ * @return string
+ */
 function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {
 function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after = '' ) {
-       $terms = get_the_terms($id, $taxonomy);
+       $terms = get_the_terms( $id, $taxonomy );
 
 
-       if ( is_wp_error($terms) )
+       if ( is_wp_error( $terms ) )
                return $terms;
 
        if ( empty( $terms ) )
                return false;
 
        foreach ( $terms as $term ) {
                return $terms;
 
        if ( empty( $terms ) )
                return false;
 
        foreach ( $terms as $term ) {
-               $link = get_term_link($term, $taxonomy);
+               $link = get_term_link( $term, $taxonomy );
                if ( is_wp_error( $link ) )
                        return $link;
                $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';
                if ( is_wp_error( $link ) )
                        return $link;
                $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';
@@ -530,11 +889,23 @@ function get_the_term_list( $id = 0, $taxonomy, $before = '', $sep = '', $after
 
        $term_links = apply_filters( "term_links-$taxonomy", $term_links );
 
 
        $term_links = apply_filters( "term_links-$taxonomy", $term_links );
 
-       return $before . join($sep, $term_links) . $after;
+       return $before . join( $sep, $term_links ) . $after;
 }
 
 }
 
+/**
+ * Display the terms in a list.
+ *
+ * @since 2.5.0
+ *
+ * @param int $id Term ID.
+ * @param string $taxonomy Taxonomy name.
+ * @param string $before Optional. Before list.
+ * @param string $sep Optional. Separate items using this.
+ * @param string $after Optional. After list.
+ * @return null|bool False on WordPress error. Returns null when displaying.
+ */
 function the_terms( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
 function the_terms( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
-       $return = get_the_term_list($id, $taxonomy, $before, $sep, $after);
+       $return = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
        if ( is_wp_error( $return ) )
                return false;
        else
        if ( is_wp_error( $return ) )
                return false;
        else
@@ -542,40 +913,38 @@ function the_terms( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
 }
 
 /**
 }
 
 /**
- * Check if the current post has the given tag
+ * Check if the current post has any of given tags.
  *
  *
- * @package WordPress
- * @since 2.6
+ * The given tags are checked against the post's tags' term_ids, names and slugs.
+ * Tags given as integers will only be checked against the post's tags' term_ids.
+ * If no tags are given, determines if post has any tags.
+ *
+ * Prior to v2.7 of WordPress, tags given as integers would also be checked against the post's tags' names and slugs (in addition to term_ids)
+ * Prior to v2.7, this function could only be used in the WordPress Loop.
+ * As of 2.7, the function can be used anywhere if it is provided a post ID or post object.
+ *
+ * @since 2.6.0
  *
  *
- * @uses wp_get_object_terms() Gets the tags.
+ * @uses is_object_in_term()
  *
  *
- * @param string|int|array $tag Optional. The tag name/id/slug or array of them to check for
- * @return bool True if the current post has the given tag, or any tag, if no tag specified
+ * @param string|int|array $tag Optional. The tag name/term_id/slug or array of them to check for.
+ * @param int|post object Optional.  Post to check instead of the current post. @since 2.7.0
+ * @return bool True if the current post has any of the the given tags (or any tag, if no tag specified).
  */
  */
-function has_tag($tag = '') {
-       global $post;
-       $taxonomy = 'post_tag';
-
-       if ( !in_the_loop() ) return false; // in-the-loop function
-
-       $post_id = (int) $post->ID;
-
-       $terms = get_object_term_cache($post_id, $taxonomy);
-       if (empty($terms))
-                $terms = wp_get_object_terms($post_id, $taxonomy);
-       if (empty($terms)) return false;
-
-       if (empty($tag)) return (!empty($terms));
-
-       $tag = (array) $tag;
-
-       foreach($terms as $term) {
-               if ( in_array( $term->term_id, $tag ) ) return true;
-               if ( in_array( $term->name, $tag ) ) return true;
-               if ( in_array( $term->slug, $tag ) ) return true;
+function has_tag( $tag = '', $_post = null ) {
+       if ( $_post ) {
+               $_post = get_post( $_post );
+       } else {
+               $_post =& $GLOBALS['post'];
        }
 
        }
 
-       return false;
+       if ( !$_post )
+               return false;
+
+       $r = is_object_in_term( $_post->ID, 'post_tag', $tag );
+       if ( is_wp_error( $r ) )
+               return false;
+       return $r;
 }
 
 ?>
 }
 
 ?>
index d97b72d2a60cd987feb49c9084466e7406fc5913..fb81dfb2b774d03bd1324e963753ab5576ffc52e 100644 (file)
@@ -14,9 +14,9 @@
  * @return object List of all of the category IDs.
  */
 function get_all_category_ids() {
  * @return object List of all of the category IDs.
  */
 function get_all_category_ids() {
-       if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) {
-               $cat_ids = get_terms('category', 'fields=ids&get=all');
-               wp_cache_add('all_category_ids', $cat_ids, 'category');
+       if ( ! $cat_ids = wp_cache_get( 'all_category_ids', 'category' ) ) {
+               $cat_ids = get_terms( 'category', 'fields=ids&get=all' );
+               wp_cache_add( 'all_category_ids', $cat_ids, 'category' );
        }
 
        return $cat_ids;
        }
 
        return $cat_ids;
@@ -36,17 +36,17 @@ function get_all_category_ids() {
  * @param string|array $args Optional. Change the defaults retrieving categories.
  * @return array List of categories.
  */
  * @param string|array $args Optional. Change the defaults retrieving categories.
  * @return array List of categories.
  */
-function &get_categories($args = '') {
-       $defaults = array('type' => 'category');
-       $args = wp_parse_args($args, $defaults);
+function &get_categories( $args = '' ) {
+       $defaults = array( 'type' => 'category' );
+       $args = wp_parse_args( $args, $defaults );
 
 
-       $taxonomy = 'category';
+       $taxonomy = apply_filters( 'get_categories_taxonomy', 'category', $args );
        if ( 'link' == $args['type'] )
                $taxonomy = 'link_category';
        if ( 'link' == $args['type'] )
                $taxonomy = 'link_category';
-       $categories = get_terms($taxonomy, $args);
+       $categories = (array) get_terms( $taxonomy, $args );
 
 
-       foreach ( array_keys($categories) as $k )
-               _make_cat_compat($categories[$k]);
+       foreach ( array_keys( $categories ) as $k )
+               _make_cat_compat( $categories[$k] );
 
        return $categories;
 }
 
        return $categories;
 }
@@ -65,7 +65,7 @@ function &get_categories($args = '') {
  *
  * The category will converted to maintain backwards compatibility.
  *
  *
  * The category will converted to maintain backwards compatibility.
  *
- * @since 2.1.0
+ * @since 1.5.1
  * @uses get_term() Used to get the category data from the taxonomy.
  *
  * @param int|object $category Category ID or Category row object
  * @uses get_term() Used to get the category data from the taxonomy.
  *
  * @param int|object $category Category ID or Category row object
@@ -73,12 +73,12 @@ function &get_categories($args = '') {
  * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
  * @return mixed Category data in type defined by $output parameter.
  */
  * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
  * @return mixed Category data in type defined by $output parameter.
  */
-function &get_category($category, $output = OBJECT, $filter = 'raw') {
-       $category = get_term($category, 'category', $output, $filter);
+function &get_category( $category, $output = OBJECT, $filter = 'raw' ) {
+       $category = get_term( $category, 'category', $output, $filter );
        if ( is_wp_error( $category ) )
                return $category;
 
        if ( is_wp_error( $category ) )
                return $category;
 
-       _make_cat_compat($category);
+       _make_cat_compat( $category );
 
        return $category;
 }
 
        return $category;
 }
@@ -102,39 +102,39 @@ function &get_category($category, $output = OBJECT, $filter = 'raw') {
  * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
  * @return null|object|array Null on failure. Type is based on $output value.
  */
  * @param string $output Optional. Constant OBJECT, ARRAY_A, or ARRAY_N
  * @return null|object|array Null on failure. Type is based on $output value.
  */
-function get_category_by_path($category_path, $full_match = true, $output = OBJECT) {
-       $category_path = rawurlencode(urldecode($category_path));
-       $category_path = str_replace('%2F', '/', $category_path);
-       $category_path = str_replace('%20', ' ', $category_path);
-       $category_paths = '/' . trim($category_path, '/');
-       $leaf_path  = sanitize_title(basename($category_paths));
-       $category_paths = explode('/', $category_paths);
+function get_category_by_path( $category_path, $full_match = true, $output = OBJECT ) {
+       $category_path = rawurlencode( urldecode( $category_path ) );
+       $category_path = str_replace( '%2F', '/', $category_path );
+       $category_path = str_replace( '%20', ' ', $category_path );
+       $category_paths = '/' . trim( $category_path, '/' );
+       $leaf_path  = sanitize_title( basename( $category_paths ) );
+       $category_paths = explode( '/', $category_paths );
        $full_path = '';
        foreach ( (array) $category_paths as $pathdir )
        $full_path = '';
        foreach ( (array) $category_paths as $pathdir )
-               $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir);
+               $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title( $pathdir );
 
 
-       $categories = get_terms('category', "get=all&slug=$leaf_path");
+       $categories = get_terms( 'category', "get=all&slug=$leaf_path" );
 
 
-       if ( empty($categories) )
+       if ( empty( $categories ) )
                return null;
 
                return null;
 
-       foreach ($categories as $category) {
+       foreach ( $categories as $category ) {
                $path = '/' . $leaf_path;
                $curcategory = $category;
                $path = '/' . $leaf_path;
                $curcategory = $category;
-               while ( ($curcategory->parent != 0) && ($curcategory->parent != $curcategory->term_id) ) {
-                       $curcategory = get_term($curcategory->parent, 'category');
+               while ( ( $curcategory->parent != 0 ) && ( $curcategory->parent != $curcategory->term_id ) ) {
+                       $curcategory = get_term( $curcategory->parent, 'category' );
                        if ( is_wp_error( $curcategory ) )
                                return $curcategory;
                        $path = '/' . $curcategory->slug . $path;
                }
 
                if ( $path == $full_path )
                        if ( is_wp_error( $curcategory ) )
                                return $curcategory;
                        $path = '/' . $curcategory->slug . $path;
                }
 
                if ( $path == $full_path )
-                       return get_category($category->term_id, $output);
+                       return get_category( $category->term_id, $output );
        }
 
        // If full matching is not required, return the first cat that matches the leaf.
        if ( ! $full_match )
        }
 
        // If full matching is not required, return the first cat that matches the leaf.
        if ( ! $full_match )
-               return get_category($categories[0]->term_id, $output);
+               return get_category( $categories[0]->term_id, $output );
 
        return null;
 }
 
        return null;
 }
@@ -148,9 +148,9 @@ function get_category_by_path($category_path, $full_match = true, $output = OBJE
  * @return object Category data object
  */
 function get_category_by_slug( $slug  ) {
  * @return object Category data object
  */
 function get_category_by_slug( $slug  ) {
-       $category = get_term_by('slug', $slug, 'category');
+       $category = get_term_by( 'slug', $slug, 'category' );
        if ( $category )
        if ( $category )
-               _make_cat_compat($category);
+               _make_cat_compat( $category );
 
        return $category;
 }
 
        return $category;
 }
@@ -164,9 +164,9 @@ function get_category_by_slug( $slug  ) {
  * @param string $cat_name Optional. Default is 'General' and can be any category name.
  * @return int 0, if failure and ID of category on success.
  */
  * @param string $cat_name Optional. Default is 'General' and can be any category name.
  * @return int 0, if failure and ID of category on success.
  */
-function get_cat_ID($cat_name='General') {
-       $cat = get_term_by('name', $cat_name, 'category');
-       if ($cat)
+function get_cat_ID( $cat_name='General' ) {
+       $cat = get_term_by( 'name', $cat_name, 'category' );
+       if ( $cat )
                return $cat->term_id;
        return 0;
 }
                return $cat->term_id;
        return 0;
 }
@@ -182,8 +182,8 @@ function get_cat_ID($cat_name='General') {
  * @param int $cat_ID Category ID
  * @return string category name
  */
  * @param int $cat_ID Category ID
  * @return string category name
  */
-function get_catname($cat_ID) {
-       return get_cat_name($cat_ID);
+function get_catname( $cat_ID ) {
+       return get_cat_name( $cat_ID );
 }
 
 
 }
 
 
@@ -195,9 +195,9 @@ function get_catname($cat_ID) {
  * @param int $cat_id Category ID
  * @return string Category name
  */
  * @param int $cat_id Category ID
  * @return string Category name
  */
-function get_cat_name($cat_id) {
+function get_cat_name( $cat_id ) {
        $cat_id = (int) $cat_id;
        $cat_id = (int) $cat_id;
-       $category = &get_category($cat_id);
+       $category = &get_category( $cat_id );
        return $category->name;
 }
 
        return $category->name;
 }
 
@@ -214,11 +214,11 @@ function get_cat_name($cat_id) {
  * @param int|object $cat2 The child category.
  * @return bool Whether $cat2 is child of $cat1
  */
  * @param int|object $cat2 The child category.
  * @return bool Whether $cat2 is child of $cat1
  */
-function cat_is_ancestor_of($cat1, $cat2) {
-       if ( is_int($cat1) )
-               $cat1 = & get_category($cat1);
-       if ( is_int($cat2) )
-               $cat2 = & get_category($cat2);
+function cat_is_ancestor_of( $cat1, $cat2 ) {
+       if ( is_int( $cat1 ) )
+               $cat1 = &get_category( $cat1 );
+       if ( is_int( $cat2 ) )
+               $cat2 = &get_category( $cat2 );
 
        if ( !$cat1->term_id || !$cat2->parent )
                return false;
 
        if ( !$cat1->term_id || !$cat2->parent )
                return false;
@@ -226,7 +226,7 @@ function cat_is_ancestor_of($cat1, $cat2) {
        if ( $cat2->parent == $cat1->term_id )
                return true;
 
        if ( $cat2->parent == $cat1->term_id )
                return true;
 
-       return cat_is_ancestor_of($cat1, get_category($cat2->parent));
+       return cat_is_ancestor_of( $cat1, get_category( $cat2->parent ) );
 }
 
 
 }
 
 
@@ -240,8 +240,8 @@ function cat_is_ancestor_of($cat1, $cat2) {
  * @param string $context Optional. Default is 'display'.
  * @return object|array Same type as $category with sanitized data for safe use.
  */
  * @param string $context Optional. Default is 'display'.
  * @return object|array Same type as $category with sanitized data for safe use.
  */
-function sanitize_category($category, $context = 'display') {
-       return sanitize_term($category, 'category', $context);
+function sanitize_category( $category, $context = 'display' ) {
+       return sanitize_term( $category, 'category', $context );
 }
 
 
 }
 
 
@@ -257,8 +257,8 @@ function sanitize_category($category, $context = 'display') {
  * @param string $context What filter to use, 'raw', 'display', etc.
  * @return mixed Same type as $value after $value has been sanitized.
  */
  * @param string $context What filter to use, 'raw', 'display', etc.
  * @return mixed Same type as $value after $value has been sanitized.
  */
-function sanitize_category_field($field, $value, $cat_id, $context) {
-       return sanitize_term_field($field, $value, $cat_id, 'category', $context);
+function sanitize_category_field( $field, $value, $cat_id, $context ) {
+       return sanitize_term_field( $field, $value, $cat_id, 'category', $context );
 }
 
 /* Tags */
 }
 
 /* Tags */
@@ -274,13 +274,15 @@ function sanitize_category_field($field, $value, $cat_id, $context) {
  * @param string|array $args Tag arguments to use when retrieving tags.
  * @return array List of tags.
  */
  * @param string|array $args Tag arguments to use when retrieving tags.
  * @return array List of tags.
  */
-function &get_tags($args = '') {
-       $tags = get_terms('post_tag', $args);
+function &get_tags( $args = '' ) {
+       $tags = get_terms( 'post_tag', $args );
 
 
-       if ( empty($tags) )
-               return array();
+       if ( empty( $tags ) ) {
+               $return = array();
+               return $return;
+       }
 
 
-       $tags = apply_filters('get_tags', $tags, $args);
+       $tags = apply_filters( 'get_tags', $tags, $args );
        return $tags;
 }
 
        return $tags;
 }
 
@@ -304,8 +306,8 @@ function &get_tags($args = '') {
  * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
  * @return object|array Return type based on $output value.
  */
  * @param string $filter Optional. Default is raw or no WordPress defined filter will applied.
  * @return object|array Return type based on $output value.
  */
-function &get_tag($tag, $output = OBJECT, $filter = 'raw') {
-       return get_term($tag, 'post_tag', $output, $filter);
+function &get_tag( $tag, $output = OBJECT, $filter = 'raw' ) {
+       return get_term( $tag, 'post_tag', $output, $filter );
 }
 
 
 }
 
 
@@ -336,8 +338,8 @@ function update_category_cache() {
  *
  * @param int $id Category ID
  */
  *
  * @param int $id Category ID
  */
-function clean_category_cache($id) {
-       clean_term_cache($id, 'category');
+function clean_category_cache( $id ) {
+       clean_term_cache( $id, 'category' );
 }
 
 
 }
 
 
@@ -360,15 +362,15 @@ function clean_category_cache($id) {
  *
  * @param array|object $category Category Row object or array
  */
  *
  * @param array|object $category Category Row object or array
  */
-function _make_cat_compat( &$category) {
-       if ( is_object($category) ) {
+function _make_cat_compat( &$category ) {
+       if ( is_object( $category ) ) {
                $category->cat_ID = &$category->term_id;
                $category->category_count = &$category->count;
                $category->category_description = &$category->description;
                $category->cat_name = &$category->name;
                $category->category_nicename = &$category->slug;
                $category->category_parent = &$category->parent;
                $category->cat_ID = &$category->term_id;
                $category->category_count = &$category->count;
                $category->category_description = &$category->description;
                $category->cat_name = &$category->name;
                $category->category_nicename = &$category->slug;
                $category->category_parent = &$category->parent;
-       } else if ( is_array($category) && isset($category['term_id']) ) {
+       } elseif ( is_array( $category ) && isset( $category['term_id'] ) ) {
                $category['cat_ID'] = &$category['term_id'];
                $category['category_count'] = &$category['count'];
                $category['category_description'] = &$category['description'];
                $category['cat_ID'] = &$category['term_id'];
                $category['category_count'] = &$category['count'];
                $category['category_description'] = &$category['description'];
index f27be3f9cf26f0dea5e1da88983e89718edcb907..63fc53eca0a00d2ef0c06a9cef4eb80918a0935d 100644 (file)
@@ -22,6 +22,7 @@
 class IXR_Value {
     var $data;
     var $type;
 class IXR_Value {
     var $data;
     var $type;
+
     function IXR_Value ($data, $type = false) {
         $this->data = $data;
         if (!$type) {
     function IXR_Value ($data, $type = false) {
         $this->data = $data;
         if (!$type) {
@@ -40,6 +41,7 @@ class IXR_Value {
             }
         }
     }
             }
         }
     }
+
     function calculateType() {
         if ($this->data === true || $this->data === false) {
             return 'boolean';
     function calculateType() {
         if ($this->data === true || $this->data === false) {
             return 'boolean';
@@ -73,6 +75,7 @@ class IXR_Value {
             return 'array';
         }
     }
             return 'array';
         }
     }
+
     function getXml() {
         /* Return XML for this value */
         switch ($this->type) {
     function getXml() {
         /* Return XML for this value */
         switch ($this->type) {
@@ -113,6 +116,7 @@ class IXR_Value {
         }
         return false;
     }
         }
         return false;
     }
+
     function isStruct($array) {
         /* Nasty function to check if an array is a struct or not */
         $expected = 0;
     function isStruct($array) {
         /* Nasty function to check if an array is a struct or not */
         $expected = 0;
@@ -180,7 +184,7 @@ class IXR_Message {
         return true;
     }
     function tag_open($parser, $tag, $attr) {
         return true;
     }
     function tag_open($parser, $tag, $attr) {
-               $this->_currentTagContents = '';
+        $this->_currentTagContents = '';
         $this->currentTag = $tag;
         switch($tag) {
             case 'methodCall':
         $this->currentTag = $tag;
         switch($tag) {
             case 'methodCall':
@@ -270,7 +274,7 @@ class IXR_Message {
                 $this->params[] = $value;
             }
         }
                 $this->params[] = $value;
             }
         }
-               $this->_currentTagContents = '';
+        $this->_currentTagContents = '';
     }
 }
 
     }
 }
 
@@ -334,7 +338,8 @@ EOD;
     }
     function call($methodname, $args) {
         if (!$this->hasMethod($methodname)) {
     }
     function call($methodname, $args) {
         if (!$this->hasMethod($methodname)) {
-            return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.');
+            return new IXR_Error(-32601, 'server error. requested method '.
+                $methodname.' does not exist.');
         }
         $method = $this->callbacks[$methodname];
         // Perform the callback and send the response
         }
         $method = $this->callbacks[$methodname];
         // Perform the callback and send the response
@@ -347,18 +352,21 @@ EOD;
             // It's a class method - check it exists
             $method = substr($method, 5);
             if (!method_exists($this, $method)) {
             // It's a class method - check it exists
             $method = substr($method, 5);
             if (!method_exists($this, $method)) {
-                return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.');
+                return new IXR_Error(-32601, 'server error. requested class method "'.
+                    $method.'" does not exist.');
             }
             // Call the method
             $result = $this->$method($args);
         } else {
             // It's a function - does it exist?
             if (is_array($method)) {
             }
             // Call the method
             $result = $this->$method($args);
         } else {
             // It's a function - does it exist?
             if (is_array($method)) {
-               if (!method_exists($method[0], $method[1])) {
-                return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.');
-               }
+                if (!method_exists($method[0], $method[1])) {
+                    return new IXR_Error(-32601, 'server error. requested object method "'.
+                        $method[1].'" does not exist.');
+                }
             } else if (!function_exists($method)) {
             } else if (!function_exists($method)) {
-                return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.');
+                return new IXR_Error(-32601, 'server error. requested function "'.
+                    $method.'" does not exist.');
             }
             // Call the function
             $result = call_user_func($method, $args);
             }
             // Call the function
             $result = call_user_func($method, $args);
@@ -490,7 +498,7 @@ class IXR_Client {
     var $response;
     var $message = false;
     var $debug = false;
     var $response;
     var $message = false;
     var $debug = false;
-       var $timeout;
+    var $timeout;
     // Storage place for an error message
     var $error = false;
     function IXR_Client($server, $path = false, $port = 80, $timeout = false) {
     // Storage place for an error message
     var $error = false;
     function IXR_Client($server, $path = false, $port = 80, $timeout = false) {
@@ -509,8 +517,8 @@ class IXR_Client {
             $this->path = $path;
             $this->port = $port;
         }
             $this->path = $path;
             $this->port = $port;
         }
-        $this->useragent = 'Incutio XML-RPC';
-               $this->timeout = $timeout;
+        $this->useragent = 'The Incutio XML-RPC PHP Library';
+        $this->timeout = $timeout;
     }
     function query() {
         $args = func_get_args();
     }
     function query() {
         $args = func_get_args();
@@ -556,7 +564,7 @@ class IXR_Client {
                 $gettingHeaders = false;
             }
             if (!$gettingHeaders) {
                 $gettingHeaders = false;
             }
             if (!$gettingHeaders) {
-                $contents .= trim($line)."\n";
+                $contents .= trim($line);
             }
         }
         if ($this->debug) {
             }
         }
         if ($this->debug) {
@@ -603,6 +611,7 @@ class IXR_Error {
     var $message;
     function IXR_Error($code, $message) {
         $this->code = $code;
     var $message;
     function IXR_Error($code, $message) {
         $this->code = $code;
+        // WP adds htmlspecialchars(). See #5666
         $this->message = htmlspecialchars($message);
     }
     function getXml() {
         $this->message = htmlspecialchars($message);
     }
     function getXml() {
@@ -642,6 +651,7 @@ class IXR_Date {
     var $hour;
     var $minute;
     var $second;
     var $hour;
     var $minute;
     var $second;
+    var $timezone;
     function IXR_Date($time) {
         // $time can be a PHP timestamp or an ISO one
         if (is_numeric($time)) {
     function IXR_Date($time) {
         // $time can be a PHP timestamp or an ISO one
         if (is_numeric($time)) {
@@ -657,6 +667,8 @@ class IXR_Date {
         $this->hour = date('H', $timestamp);
         $this->minute = date('i', $timestamp);
         $this->second = date('s', $timestamp);
         $this->hour = date('H', $timestamp);
         $this->minute = date('i', $timestamp);
         $this->second = date('s', $timestamp);
+        // WP adds timezone. See #2036
+        $this->timezone = '';
     }
     function parseIso($iso) {
         $this->year = substr($iso, 0, 4);
     }
     function parseIso($iso) {
         $this->year = substr($iso, 0, 4);
@@ -665,9 +677,11 @@ class IXR_Date {
         $this->hour = substr($iso, 9, 2);
         $this->minute = substr($iso, 12, 2);
         $this->second = substr($iso, 15, 2);
         $this->hour = substr($iso, 9, 2);
         $this->minute = substr($iso, 12, 2);
         $this->second = substr($iso, 15, 2);
+        // WP adds timezone. See #2036
         $this->timezone = substr($iso, 17);
     }
     function getIso() {
         $this->timezone = substr($iso, 17);
     }
     function getIso() {
+       // WP adds timezone. See #2036
         return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
     }
     function getXml() {
         return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
     }
     function getXml() {
index 70f9bdf5c1a20df6519b7c02cc2964d84ef85d34..93f4536cfbe5fa695fa3f4f4c23d119e776a3ce7 100644 (file)
@@ -50,7 +50,7 @@ class PasswordHash {
                $this->portable_hashes = $portable_hashes;
 
                $this->random_state = microtime() . (function_exists('getmypid') ? getmypid() : '') . uniqid(rand(), TRUE);
                $this->portable_hashes = $portable_hashes;
 
                $this->random_state = microtime() . (function_exists('getmypid') ? getmypid() : '') . uniqid(rand(), TRUE);
-       
+
        }
 
        function get_random_bytes($count)
        }
 
        function get_random_bytes($count)
index 52840d8fe812d353f2272b877c5e6263f44154d1..25e5570a3f7269e1da4c9fb5c3cfe006c3ce1de9 100644 (file)
 <?php
 <?php
-/**
- * PHPMailer - PHP email class
- *
- * Class for sending email using either sendmail, PHP mail(), or SMTP. Methods
- * are based upon the standard AspEmail(tm) classes.
- *
- * @copyright 2001 - 2003 Brent R. Matzelle
- * @license LGPL
- * @package PHPMailer
+/*~ class.phpmailer.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 2.0.2                                                          |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|    Author: Andy Prevost (project admininistrator)                         |
+|    Author: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
  */
  */
-
 /**
  * PHPMailer - PHP email transport class
  * @package PHPMailer
 /**
  * PHPMailer - PHP email transport class
  * @package PHPMailer
- * @author Brent R. Matzelle
- * @copyright 2001 - 2003 Brent R. Matzelle
+ * @author Andy Prevost
+ * @copyright 2004 - 2008 Andy Prevost
  */
  */
-class PHPMailer
-{
-    /////////////////////////////////////////////////
-    // PUBLIC VARIABLES
-    /////////////////////////////////////////////////
-
-    /**
-     * Email priority (1 = High, 3 = Normal, 5 = low).
-     * @var int
-     */
-    var $Priority          = 3;
-
-    /**
-     * Sets the CharSet of the message.
-     * @var string
-     */
-    var $CharSet           = "UTF-8";
-
-    /**
-     * Sets the Content-type of the message.
-     * @var string
-     */
-    var $ContentType        = "text/plain";
-
-    /**
-     * Sets the Encoding of the message. Options for this are "8bit",
-     * "7bit", "binary", "base64", and "quoted-printable".
-     * @var string
-     */
-    var $Encoding          = "8bit";
-
-    /**
-     * Holds the most recent mailer error message.
-     * @var string
-     */
-    var $ErrorInfo         = "";
-
-    /**
-     * Sets the From email address for the message.
-     * @var string
-     */
-    var $From               = "localhost.localdomain";
-
-    /**
-     * Sets the From name of the message.
-     * @var string
-     */
-    var $FromName           = "Support";
-
-    /**
-     * Sets the Sender email (Return-Path) of the message.  If not empty,
-     * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
-     * @var string
-     */
-    var $Sender            = "";
-
-    /**
-     * Sets the Subject of the message.
-     * @var string
-     */
-    var $Subject           = "";
-
-    /**
-     * Sets the Body of the message.  This can be either an HTML or text body.
-     * If HTML then run IsHTML(true).
-     * @var string
-     */
-    var $Body               = "";
-
-    /**
-     * Sets the text-only body of the message.  This automatically sets the
-     * email to multipart/alternative.  This body can be read by mail
-     * clients that do not have HTML email capability such as mutt. Clients
-     * that can read HTML will view the normal Body.
-     * @var string
-     */
-    var $AltBody           = "";
-
-    /**
-     * Sets word wrapping on the body of the message to a given number of
-     * characters.
-     * @var int
-     */
-    var $WordWrap          = 0;
-
-    /**
-     * Method to send mail: ("mail", "sendmail", or "smtp").
-     * @var string
-     */
-    var $Mailer            = "mail";
-
-    /**
-     * Sets the path of the sendmail program.
-     * @var string
-     */
-    var $Sendmail          = "/usr/sbin/sendmail";
-
-    /**
-     * Path to PHPMailer plugins.  This is now only useful if the SMTP class
-     * is in a different directory than the PHP include path.
-     * @var string
-     */
-    var $PluginDir         = "";
-
-    /**
-     *  Holds PHPMailer version.
-     *  @var string
-     */
-    var $Version           = "1.73";
-
-    /**
-     * Sets the email address that a reading confirmation will be sent.
-     * @var string
-     */
-    var $ConfirmReadingTo  = "";
-
-    /**
-     *  Sets the hostname to use in Message-Id and Received headers
-     *  and as default HELO string. If empty, the value returned
-     *  by SERVER_NAME is used or 'localhost.localdomain'.
-     *  @var string
-     */
-    var $Hostname          = "";
-
-    /////////////////////////////////////////////////
-    // SMTP VARIABLES
-    /////////////////////////////////////////////////
-
-    /**
-     *  Sets the SMTP hosts.  All hosts must be separated by a
-     *  semicolon.  You can also specify a different port
-     *  for each host by using this format: [hostname:port]
-     *  (e.g. "smtp1.example.com:25;smtp2.example.com").
-     *  Hosts will be tried in order.
-     *  @var string
-     */
-    var $Host        = "localhost";
-
-    /**
-     *  Sets the default SMTP server port.
-     *  @var int
-     */
-    var $Port        = 25;
-
-    /**
-     *  Sets the SMTP HELO of the message (Default is $Hostname).
-     *  @var string
-     */
-    var $Helo        = "";
-
-    /**
-     *  Sets SMTP authentication. Utilizes the Username and Password variables.
-     *  @var bool
-     */
-    var $SMTPAuth     = false;
-
-    /**
-     *  Sets SMTP username.
-     *  @var string
-     */
-    var $Username     = "";
-
-    /**
-     *  Sets SMTP password.
-     *  @var string
-     */
-    var $Password     = "";
-
-    /**
-     *  Sets the SMTP server timeout in seconds. This function will not
-     *  work with the win32 version.
-     *  @var int
-     */
-    var $Timeout      = 10;
-
-    /**
-     *  Sets SMTP class debugging on or off.
-     *  @var bool
-     */
-    var $SMTPDebug    = false;
-
-    /**
-     * Prevents the SMTP connection from being closed after each mail
-     * sending.  If this is set to true then to close the connection
-     * requires an explicit call to SmtpClose().
-     * @var bool
-     */
-    var $SMTPKeepAlive = false;
-
-    /**#@+
-     * @access private
-     */
-    var $smtp            = NULL;
-    var $to              = array();
-    var $cc              = array();
-    var $bcc             = array();
-    var $ReplyTo         = array();
-    var $attachment      = array();
-    var $CustomHeader    = array();
-    var $message_type    = "";
-    var $boundary        = array();
-    var $language        = array();
-    var $error_count     = 0;
-    var $LE              = "\n";
-    /**#@-*/
-
-    /////////////////////////////////////////////////
-    // VARIABLE METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Sets message type to HTML.
-     * @param bool $bool
-     * @return void
-     */
-    function IsHTML($bool) {
-        if($bool == true)
-            $this->ContentType = "text/html";
-        else
-            $this->ContentType = "text/plain";
-    }
-
-    /**
-     * Sets Mailer to send message using SMTP.
-     * @return void
-     */
-    function IsSMTP() {
-        $this->Mailer = "smtp";
-    }
-
-    /**
-     * Sets Mailer to send message using PHP mail() function.
-     * @return void
-     */
-    function IsMail() {
-        $this->Mailer = "mail";
-    }
-
-    /**
-     * Sets Mailer to send message using the $Sendmail program.
-     * @return void
-     */
-    function IsSendmail() {
-        $this->Mailer = "sendmail";
-    }
-
-    /**
-     * Sets Mailer to send message using the qmail MTA.
-     * @return void
-     */
-    function IsQmail() {
-        $this->Sendmail = "/var/qmail/bin/sendmail";
-        $this->Mailer = "sendmail";
-    }
-
-
-    /////////////////////////////////////////////////
-    // RECIPIENT METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds a "To" address.
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddAddress($address, $name = "") {
-        $cur = count($this->to);
-        $this->to[$cur][0] = trim($address);
-        $this->to[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Cc" address. Note: this function works
-     * with the SMTP mailer on win32, not with the "mail"
-     * mailer.
-     * @param string $address
-     * @param string $name
-     * @return void
-    */
-    function AddCC($address, $name = "") {
-        $cur = count($this->cc);
-        $this->cc[$cur][0] = trim($address);
-        $this->cc[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Bcc" address. Note: this function works
-     * with the SMTP mailer on win32, not with the "mail"
-     * mailer.
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddBCC($address, $name = "") {
-        $cur = count($this->bcc);
-        $this->bcc[$cur][0] = trim($address);
-        $this->bcc[$cur][1] = $name;
-    }
-
-    /**
-     * Adds a "Reply-to" address.
-     * @param string $address
-     * @param string $name
-     * @return void
-     */
-    function AddReplyTo($address, $name = "") {
-        $cur = count($this->ReplyTo);
-        $this->ReplyTo[$cur][0] = trim($address);
-        $this->ReplyTo[$cur][1] = $name;
-    }
-
-
-    /////////////////////////////////////////////////
-    // MAIL SENDING METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Creates message and assigns Mailer. If the message is
-     * not sent successfully then it returns false.  Use the ErrorInfo
-     * variable to view description of the error.
-     * @return bool
-     */
-    function Send() {
-        $header = "";
-        $body = "";
-        $result = true;
 
 
-        if((count($this->to) + count($this->cc) + count($this->bcc)) < 1)
-        {
-            $this->SetError($this->Lang("provide_address"));
-            return false;
-        }
+class PHPMailer {
+
+  /////////////////////////////////////////////////
+  // PROPERTIES, PUBLIC
+  /////////////////////////////////////////////////
+
+  /**
+   * Email priority (1 = High, 3 = Normal, 5 = low).
+   * @var int
+   */
+  var $Priority          = 3;
+
+  /**
+   * Sets the CharSet of the message.
+   * @var string
+   */
+  var $CharSet           = 'iso-8859-1';
+
+  /**
+   * Sets the Content-type of the message.
+   * @var string
+   */
+  var $ContentType        = 'text/plain';
+
+  /**
+   * Sets the Encoding of the message. Options for this are "8bit",
+   * "7bit", "binary", "base64", and "quoted-printable".
+   * @var string
+   */
+  var $Encoding          = '8bit';
+
+  /**
+   * Holds the most recent mailer error message.
+   * @var string
+   */
+  var $ErrorInfo         = '';
+
+  /**
+   * Sets the From email address for the message.
+   * @var string
+   */
+  var $From              = 'root@localhost';
+
+  /**
+   * Sets the From name of the message.
+   * @var string
+   */
+  var $FromName          = 'Root User';
+
+  /**
+   * Sets the Sender email (Return-Path) of the message.  If not empty,
+   * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+   * @var string
+   */
+  var $Sender            = '';
+
+  /**
+   * Sets the Subject of the message.
+   * @var string
+   */
+  var $Subject           = '';
+
+  /**
+   * Sets the Body of the message.  This can be either an HTML or text body.
+   * If HTML then run IsHTML(true).
+   * @var string
+   */
+  var $Body              = '';
+
+  /**
+   * Sets the text-only body of the message.  This automatically sets the
+   * email to multipart/alternative.  This body can be read by mail
+   * clients that do not have HTML email capability such as mutt. Clients
+   * that can read HTML will view the normal Body.
+   * @var string
+   */
+  var $AltBody           = '';
+
+  /**
+   * Sets word wrapping on the body of the message to a given number of
+   * characters.
+   * @var int
+   */
+  var $WordWrap          = 0;
+
+  /**
+   * Method to send mail: ("mail", "sendmail", or "smtp").
+   * @var string
+   */
+  var $Mailer            = 'mail';
+
+  /**
+   * Sets the path of the sendmail program.
+   * @var string
+   */
+  var $Sendmail          = '/usr/sbin/sendmail';
+
+  /**
+   * Path to PHPMailer plugins.  This is now only useful if the SMTP class
+   * is in a different directory than the PHP include path.
+   * @var string
+   */
+  var $PluginDir         = '';
+
+  /**
+   * Holds PHPMailer version.
+   * @var string
+   */
+  var $Version           = "2.0.2";
+
+  /**
+   * Sets the email address that a reading confirmation will be sent.
+   * @var string
+   */
+  var $ConfirmReadingTo  = '';
+
+  /**
+   * Sets the hostname to use in Message-Id and Received headers
+   * and as default HELO string. If empty, the value returned
+   * by SERVER_NAME is used or 'localhost.localdomain'.
+   * @var string
+   */
+  var $Hostname          = '';
+
+  /**
+   * Sets the message ID to be used in the Message-Id header.
+   * If empty, a unique id will be generated.
+   * @var string
+   */
+  var $MessageID         = '';
+
+  /////////////////////////////////////////////////
+  // PROPERTIES FOR SMTP
+  /////////////////////////////////////////////////
+
+  /**
+   * Sets the SMTP hosts.  All hosts must be separated by a
+   * semicolon.  You can also specify a different port
+   * for each host by using this format: [hostname:port]
+   * (e.g. "smtp1.example.com:25;smtp2.example.com").
+   * Hosts will be tried in order.
+   * @var string
+   */
+  var $Host        = 'localhost';
+
+  /**
+   * Sets the default SMTP server port.
+   * @var int
+   */
+  var $Port        = 25;
+
+  /**
+   * Sets the SMTP HELO of the message (Default is $Hostname).
+   * @var string
+   */
+  var $Helo        = '';
+
+  /**
+   * Sets connection prefix.
+   * Options are "", "ssl" or "tls"
+   * @var string
+   */
+  var $SMTPSecure = "";
+
+  /**
+   * Sets SMTP authentication. Utilizes the Username and Password variables.
+   * @var bool
+   */
+  var $SMTPAuth     = false;
+
+  /**
+   * Sets SMTP username.
+   * @var string
+   */
+  var $Username     = '';
+
+  /**
+   * Sets SMTP password.
+   * @var string
+   */
+  var $Password     = '';
+
+  /**
+   * Sets the SMTP server timeout in seconds. This function will not
+   * work with the win32 version.
+   * @var int
+   */
+  var $Timeout      = 10;
+
+  /**
+   * Sets SMTP class debugging on or off.
+   * @var bool
+   */
+  var $SMTPDebug    = false;
+
+  /**
+   * Prevents the SMTP connection from being closed after each mail
+   * sending.  If this is set to true then to close the connection
+   * requires an explicit call to SmtpClose().
+   * @var bool
+   */
+  var $SMTPKeepAlive = false;
+
+  /**
+   * Provides the ability to have the TO field process individual
+   * emails, instead of sending to entire TO addresses
+   * @var bool
+   */
+  var $SingleTo = false;
+
+  /////////////////////////////////////////////////
+  // PROPERTIES, PRIVATE
+  /////////////////////////////////////////////////
+
+  var $smtp            = NULL;
+  var $to              = array();
+  var $cc              = array();
+  var $bcc             = array();
+  var $ReplyTo         = array();
+  var $attachment      = array();
+  var $CustomHeader    = array();
+  var $message_type    = '';
+  var $boundary        = array();
+  var $language        = array();
+  var $error_count     = 0;
+  var $LE              = "\n";
+  var $sign_key_file   = "";
+  var $sign_key_pass   = "";
+
+  /////////////////////////////////////////////////
+  // METHODS, VARIABLES
+  /////////////////////////////////////////////////
+
+  /**
+   * Sets message type to HTML.
+   * @param bool $bool
+   * @return void
+   */
+  function IsHTML($bool) {
+    if($bool == true) {
+      $this->ContentType = 'text/html';
+    } else {
+      $this->ContentType = 'text/plain';
+    }
+  }
+
+  /**
+   * Sets Mailer to send message using SMTP.
+   * @return void
+   */
+  function IsSMTP() {
+    $this->Mailer = 'smtp';
+  }
+
+  /**
+   * Sets Mailer to send message using PHP mail() function.
+   * @return void
+   */
+  function IsMail() {
+    $this->Mailer = 'mail';
+  }
+
+  /**
+   * Sets Mailer to send message using the $Sendmail program.
+   * @return void
+   */
+  function IsSendmail() {
+    $this->Mailer = 'sendmail';
+  }
+
+  /**
+   * Sets Mailer to send message using the qmail MTA.
+   * @return void
+   */
+  function IsQmail() {
+    $this->Sendmail = '/var/qmail/bin/sendmail';
+    $this->Mailer = 'sendmail';
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, RECIPIENTS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds a "To" address.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddAddress($address, $name = '') {
+    $cur = count($this->to);
+    $this->to[$cur][0] = trim($address);
+    $this->to[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Cc" address. Note: this function works
+   * with the SMTP mailer on win32, not with the "mail"
+   * mailer.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddCC($address, $name = '') {
+    $cur = count($this->cc);
+    $this->cc[$cur][0] = trim($address);
+    $this->cc[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Bcc" address. Note: this function works
+   * with the SMTP mailer on win32, not with the "mail"
+   * mailer.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddBCC($address, $name = '') {
+    $cur = count($this->bcc);
+    $this->bcc[$cur][0] = trim($address);
+    $this->bcc[$cur][1] = $name;
+  }
+
+  /**
+   * Adds a "Reply-To" address.
+   * @param string $address
+   * @param string $name
+   * @return void
+   */
+  function AddReplyTo($address, $name = '') {
+    $cur = count($this->ReplyTo);
+    $this->ReplyTo[$cur][0] = trim($address);
+    $this->ReplyTo[$cur][1] = $name;
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, MAIL SENDING
+  /////////////////////////////////////////////////
+
+  /**
+   * Creates message and assigns Mailer. If the message is
+   * not sent successfully then it returns false.  Use the ErrorInfo
+   * variable to view description of the error.
+   * @return bool
+   */
+  function Send() {
+    $header = '';
+    $body = '';
+    $result = true;
+
+    if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
+      $this->SetError($this->Lang('provide_address'));
+      return false;
+    }
 
 
-        // Set whether the message is multipart/alternative
-        if(!empty($this->AltBody))
-            $this->ContentType = "multipart/alternative";
-
-        $this->error_count = 0; // reset errors
-        $this->SetMessageType();
-        $header .= $this->CreateHeader();
-        $body = $this->CreateBody();
-
-        if($body == "") { return false; }
-
-        // Choose the mailer
-        switch($this->Mailer)
-        {
-            case "sendmail":
-                $result = $this->SendmailSend($header, $body);
-                break;
-            case "mail":
-                $result = $this->MailSend($header, $body);
-                break;
-            case "smtp":
-                $result = $this->SmtpSend($header, $body);
-                break;
-            default:
-            $this->SetError($this->Mailer . $this->Lang("mailer_not_supported"));
-                $result = false;
-                break;
-        }
+    /* Set whether the message is multipart/alternative */
+    if(!empty($this->AltBody)) {
+      $this->ContentType = 'multipart/alternative';
+    }
 
 
-        return $result;
+    $this->error_count = 0; // reset errors
+    $this->SetMessageType();
+    $header .= $this->CreateHeader();
+    $body = $this->CreateBody();
+
+    if($body == '') {
+      return false;
     }
 
     }
 
-    /**
-     * Sends mail using the $Sendmail program.
-     * @access private
-     * @return bool
-     */
-    function SendmailSend($header, $body) {
-        if ($this->Sender != "")
-            $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, escapeshellarg($this->Sender));
-        else
-            $sendmail = sprintf("%s -oi -t", $this->Sendmail);
+    /* Choose the mailer */
+    switch($this->Mailer) {
+      case 'sendmail':
+        $result = $this->SendmailSend($header, $body);
+        break;
+      case 'smtp':
+        $result = $this->SmtpSend($header, $body);
+        break;
+      case 'mail':
+        $result = $this->MailSend($header, $body);
+        break;
+      default:
+        $result = $this->MailSend($header, $body);
+        break;
+        //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
+        //$result = false;
+        //break;
+    }
 
 
-        if(!@$mail = popen($sendmail, "w"))
-        {
-            $this->SetError($this->Lang("execute") . $this->Sendmail);
-            return false;
-        }
+    return $result;
+  }
+
+  /**
+   * Sends mail using the $Sendmail program.
+   * @access private
+   * @return bool
+   */
+  function SendmailSend($header, $body) {
+    if ($this->Sender != '') {
+      $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+    } else {
+      $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
+    }
 
 
-        fputs($mail, $header);
-        fputs($mail, $body);
+    if(!@$mail = popen($sendmail, 'w')) {
+      $this->SetError($this->Lang('execute') . $this->Sendmail);
+      return false;
+    }
 
 
-        $result = pclose($mail) >> 8 & 0xFF;
-        if($result != 0)
-        {
-            $this->SetError($this->Lang("execute") . $this->Sendmail);
-            return false;
-        }
+    fputs($mail, $header);
+    fputs($mail, $body);
 
 
-        return true;
+    $result = pclose($mail);
+    if (version_compare(phpversion(), '4.2.3') == -1) {
+      $result = $result >> 8 & 0xFF;
+    }
+    if($result != 0) {
+      $this->SetError($this->Lang('execute') . $this->Sendmail);
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends mail using the PHP mail() function.
+   * @access private
+   * @return bool
+   */
+  function MailSend($header, $body) {
+
+    $to = '';
+    for($i = 0; $i < count($this->to); $i++) {
+      if($i != 0) { $to .= ', '; }
+      $to .= $this->AddrFormat($this->to[$i]);
     }
 
     }
 
-    /**
-     * Sends mail using the PHP mail() function.
-     * @access private
-     * @return bool
-     */
-    function MailSend($header, $body) {
-        $to = "";
-        for($i = 0; $i < count($this->to); $i++)
-        {
-            if($i != 0) { $to .= ", "; }
-            $to .= $this->to[$i][0];
-        }
+    $toArr = split(',', $to);
 
 
-        if ($this->Sender != "" && strlen(ini_get("safe_mode"))< 1)
-        {
-            $old_from = ini_get("sendmail_from");
-            ini_set("sendmail_from", $this->Sender);
-            $params = sprintf("-oi -f %s", $this->Sender);
-            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body,
-                        $header, $params);
+    $params = sprintf("-oi -f %s", $this->Sender);
+    if ($this->Sender != '' && strlen(ini_get('safe_mode')) < 1) {
+      $old_from = ini_get('sendmail_from');
+      ini_set('sendmail_from', $this->Sender);
+      if ($this->SingleTo === true && count($toArr) > 1) {
+        foreach ($toArr as $key => $val) {
+          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
         }
         }
-        else
-            $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);
+      } else {
+        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+      }
+    } else {
+      if ($this->SingleTo === true && count($toArr) > 1) {
+        foreach ($toArr as $key => $val) {
+          $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+        }
+      } else {
+        $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
+      }
+    }
 
 
-        if (isset($old_from))
-            ini_set("sendmail_from", $old_from);
+    if (isset($old_from)) {
+      ini_set('sendmail_from', $old_from);
+    }
 
 
-        if(!$rt)
-        {
-            $this->SetError($this->Lang("instantiate"));
-            return false;
-        }
+    if(!$rt) {
+      $this->SetError($this->Lang('instantiate'));
+      return false;
+    }
 
 
-        return true;
-    }
-
-    /**
-     * Sends mail via SMTP using PhpSMTP (Author:
-     * Chris Ryan).  Returns bool.  Returns false if there is a
-     * bad MAIL FROM, RCPT, or DATA input.
-     * @access private
-     * @return bool
-     */
-    function SmtpSend($header, $body) {
-        include_once($this->PluginDir . "class-smtp.php");
-        $error = "";
-        $bad_rcpt = array();
-
-        if(!$this->SmtpConnect())
-            return false;
-
-        $smtp_from = ($this->Sender == "") ? $this->From : $this->Sender;
-        if(!$this->smtp->Mail($smtp_from))
-        {
-            $error = $this->Lang("from_failed") . $smtp_from;
-            $this->SetError($error);
-            $this->smtp->Reset();
-            return false;
-        }
+    return true;
+  }
+
+  /**
+   * Sends mail via SMTP using PhpSMTP (Author:
+   * Chris Ryan).  Returns bool.  Returns false if there is a
+   * bad MAIL FROM, RCPT, or DATA input.
+   * @access private
+   * @return bool
+   */
+  function SmtpSend($header, $body) {
+    include_once($this->PluginDir . 'class-smtp.php');
+    $error = '';
+    $bad_rcpt = array();
+
+    if(!$this->SmtpConnect()) {
+      return false;
+    }
 
 
-        // Attempt to send attach all recipients
-        for($i = 0; $i < count($this->to); $i++)
-        {
-            if(!$this->smtp->Recipient($this->to[$i][0]))
-                $bad_rcpt[] = $this->to[$i][0];
-        }
-        for($i = 0; $i < count($this->cc); $i++)
-        {
-            if(!$this->smtp->Recipient($this->cc[$i][0]))
-                $bad_rcpt[] = $this->cc[$i][0];
-        }
-        for($i = 0; $i < count($this->bcc); $i++)
-        {
-            if(!$this->smtp->Recipient($this->bcc[$i][0]))
-                $bad_rcpt[] = $this->bcc[$i][0];
+    $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+    if(!$this->smtp->Mail($smtp_from)) {
+      $error = $this->Lang('from_failed') . $smtp_from;
+      $this->SetError($error);
+      $this->smtp->Reset();
+      return false;
+    }
+
+    /* Attempt to send attach all recipients */
+    for($i = 0; $i < count($this->to); $i++) {
+      if(!$this->smtp->Recipient($this->to[$i][0])) {
+        $bad_rcpt[] = $this->to[$i][0];
+      }
+    }
+    for($i = 0; $i < count($this->cc); $i++) {
+      if(!$this->smtp->Recipient($this->cc[$i][0])) {
+        $bad_rcpt[] = $this->cc[$i][0];
+      }
+    }
+    for($i = 0; $i < count($this->bcc); $i++) {
+      if(!$this->smtp->Recipient($this->bcc[$i][0])) {
+        $bad_rcpt[] = $this->bcc[$i][0];
+      }
+    }
+
+    if(count($bad_rcpt) > 0) { // Create error message
+      for($i = 0; $i < count($bad_rcpt); $i++) {
+        if($i != 0) {
+          $error .= ', ';
         }
         }
+        $error .= $bad_rcpt[$i];
+      }
+      $error = $this->Lang('recipients_failed') . $error;
+      $this->SetError($error);
+      $this->smtp->Reset();
+      return false;
+    }
 
 
-        if(count($bad_rcpt) > 0) // Create error message
-        {
-            for($i = 0; $i < count($bad_rcpt); $i++)
-            {
-                if($i != 0) { $error .= ", "; }
-                $error .= $bad_rcpt[$i];
-            }
-            $error = $this->Lang("recipients_failed") . $error;
-            $this->SetError($error);
-            $this->smtp->Reset();
-            return false;
+    if(!$this->smtp->Data($header . $body)) {
+      $this->SetError($this->Lang('data_not_accepted'));
+      $this->smtp->Reset();
+      return false;
+    }
+    if($this->SMTPKeepAlive == true) {
+      $this->smtp->Reset();
+    } else {
+      $this->SmtpClose();
+    }
+
+    return true;
+  }
+
+  /**
+   * Initiates a connection to an SMTP server.  Returns false if the
+   * operation failed.
+   * @access private
+   * @return bool
+   */
+  function SmtpConnect() {
+    if($this->smtp == NULL) {
+      $this->smtp = new SMTP();
+    }
+
+    $this->smtp->do_debug = $this->SMTPDebug;
+    $hosts = explode(';', $this->Host);
+    $index = 0;
+    $connection = ($this->smtp->Connected());
+
+    /* Retry while there is no connection */
+    while($index < count($hosts) && $connection == false) {
+      $hostinfo = array();
+      if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
+        $host = $hostinfo[1];
+        $port = $hostinfo[2];
+      } else {
+        $host = $hosts[$index];
+        $port = $this->Port;
+      }
+
+      if($this->smtp->Connect(((!empty($this->SMTPSecure))?$this->SMTPSecure.'://':'').$host, $port, $this->Timeout)) {
+        if ($this->Helo != '') {
+          $this->smtp->Hello($this->Helo);
+        } else {
+          $this->smtp->Hello($this->ServerHostname());
         }
 
         }
 
-        if(!$this->smtp->Data($header . $body))
-        {
-            $this->SetError($this->Lang("data_not_accepted"));
+        $connection = true;
+        if($this->SMTPAuth) {
+          if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
+            $this->SetError($this->Lang('authenticate'));
             $this->smtp->Reset();
             $this->smtp->Reset();
-            return false;
+            $connection = false;
+          }
         }
         }
-        if($this->SMTPKeepAlive == true)
-            $this->smtp->Reset();
-        else
-            $this->SmtpClose();
-
-        return true;
-    }
-
-    /**
-     * Initiates a connection to an SMTP server.  Returns false if the
-     * operation failed.
-     * @access private
-     * @return bool
-     */
-    function SmtpConnect() {
-        if($this->smtp == NULL) { $this->smtp = new SMTP(); }
-
-        $this->smtp->do_debug = $this->SMTPDebug;
-        $hosts = explode(";", $this->Host);
-        $index = 0;
-        $connection = ($this->smtp->Connected());
-
-        // Retry while there is no connection
-        while($index < count($hosts) && $connection == false)
-        {
-            if(strstr($hosts[$index], ":"))
-                list($host, $port) = explode(":", $hosts[$index]);
-            else
-            {
-                $host = $hosts[$index];
-                $port = $this->Port;
-            }
+      }
+      $index++;
+    }
+    if(!$connection) {
+      $this->SetError($this->Lang('connect_host'));
+    }
 
 
-            if($this->smtp->Connect($host, $port, $this->Timeout))
-            {
-                if ($this->Helo != '')
-                    $this->smtp->Hello($this->Helo);
-                else
-                    $this->smtp->Hello($this->ServerHostname());
-
-                if($this->SMTPAuth)
-                {
-                    if(!$this->smtp->Authenticate($this->Username,
-                                                  $this->Password))
-                    {
-                        $this->SetError($this->Lang("authenticate"));
-                        $this->smtp->Reset();
-                        $connection = false;
-                    }
-                }
-                $connection = true;
-            }
-            $index++;
-        }
-        if(!$connection)
-            $this->SetError($this->Lang("connect_host"));
-
-        return $connection;
-    }
-
-    /**
-     * Closes the active SMTP session if one exists.
-     * @return void
-     */
-    function SmtpClose() {
-        if($this->smtp != NULL)
-        {
-            if($this->smtp->Connected())
-            {
-                $this->smtp->Quit();
-                $this->smtp->Close();
-            }
-        }
+    return $connection;
+  }
+
+  /**
+   * Closes the active SMTP session if one exists.
+   * @return void
+   */
+  function SmtpClose() {
+    if($this->smtp != NULL) {
+      if($this->smtp->Connected()) {
+        $this->smtp->Quit();
+        $this->smtp->Close();
+      }
+    }
+  }
+
+  /**
+   * Sets the language for all class error messages.  Returns false
+   * if it cannot load the language file.  The default language type
+   * is English.
+   * @param string $lang_type Type of language (e.g. Portuguese: "br")
+   * @param string $lang_path Path to the language file directory
+   * @access public
+   * @return bool
+   */
+  function SetLanguage($lang_type, $lang_path = 'language/') {
+    if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php')) {
+      include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
+    } 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;
+    }
+    $this->language = $PHPMAILER_LANG;
+
+    return true;
+  }
+
+  /////////////////////////////////////////////////
+  // METHODS, MESSAGE CREATION
+  /////////////////////////////////////////////////
+
+  /**
+   * Creates recipient headers.
+   * @access private
+   * @return string
+   */
+  function AddrAppend($type, $addr) {
+    $addr_str = $type . ': ';
+    $addr_str .= $this->AddrFormat($addr[0]);
+    if(count($addr) > 1) {
+      for($i = 1; $i < count($addr); $i++) {
+        $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
+      }
+    }
+    $addr_str .= $this->LE;
+
+    return $addr_str;
+  }
+
+  /**
+   * Formats an address correctly.
+   * @access private
+   * @return string
+   */
+  function AddrFormat($addr) {
+    if(empty($addr[1])) {
+      $formatted = $this->SecureHeader($addr[0]);
+    } else {
+      $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
     }
 
     }
 
-    /**
-     * Sets the language for all class error messages.  Returns false
-     * if it cannot load the language file.  The default language type
-     * is English.
-     * @param string $lang_type Type of language (e.g. Portuguese: "br")
-     * @param string $lang_path Path to the language file directory
-     * @access public
-     * @return bool
-     */
-    function SetLanguage($lang_type, $lang_path = "language/") {
-        if(file_exists($lang_path.'phpmailer.lang-'.$lang_type.'.php'))
-            include($lang_path.'phpmailer.lang-'.$lang_type.'.php');
-        else if(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;
-        }
-        $this->language = $PHPMAILER_LANG;
-
-        return true;
-    }
-
-    /////////////////////////////////////////////////
-    // MESSAGE CREATION METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Creates recipient headers.
-     * @access private
-     * @return string
-     */
-    function AddrAppend($type, $addr) {
-        $addr_str = $type . ": ";
-        $addr_str .= $this->AddrFormat($addr[0]);
-        if(count($addr) > 1)
-        {
-            for($i = 1; $i < count($addr); $i++)
-                $addr_str .= ", " . $this->AddrFormat($addr[$i]);
-        }
-        $addr_str .= $this->LE;
-
-        return $addr_str;
-    }
-
-    /**
-     * Formats an address correctly.
-     * @access private
-     * @return string
-     */
-    function AddrFormat($addr) {
-        if(empty($addr[1]))
-            $formatted = $addr[0];
-        else
-        {
-            $formatted = $this->EncodeHeader($addr[1], 'phrase') . " <" .
-                         $addr[0] . ">";
-        }
+    return $formatted;
+  }
+
+  /**
+   * Wraps message for use with mailers that do not
+   * automatically perform wrapping and for quoted-printable.
+   * Original written by philippe.
+   * @access private
+   * @return string
+   */
+  function WrapText($message, $length, $qp_mode = false) {
+    $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+    // If utf-8 encoding is used, we will need to make sure we don't
+    // split multibyte characters when we wrap
+    $is_utf8 = (strtolower($this->CharSet) == "utf-8");
+
+    $message = $this->FixEOL($message);
+    if (substr($message, -1) == $this->LE) {
+      $message = substr($message, 0, -1);
+    }
 
 
-        return $formatted;
-    }
-
-    /**
-     * Wraps message for use with mailers that do not
-     * automatically perform wrapping and for quoted-printable.
-     * Original written by philippe.
-     * @access private
-     * @return string
-     */
-    function WrapText($message, $length, $qp_mode = false) {
-        $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
-
-        $message = $this->FixEOL($message);
-        if (substr($message, -1) == $this->LE)
-            $message = substr($message, 0, -1);
-
-        $line = explode($this->LE, $message);
-        $message = "";
-        for ($i=0 ;$i < count($line); $i++)
-        {
-          $line_part = explode(" ", $line[$i]);
-          $buf = "";
-          for ($e = 0; $e<count($line_part); $e++)
-          {
-              $word = $line_part[$e];
-              if ($qp_mode and (strlen($word) > $length))
-              {
-                $space_left = $length - strlen($buf) - 1;
-                if ($e != 0)
-                {
-                    if ($space_left > 20)
-                    {
-                        $len = $space_left;
-                        if (substr($word, $len - 1, 1) == "=")
-                          $len--;
-                        elseif (substr($word, $len - 2, 1) == "=")
-                          $len -= 2;
-                        $part = substr($word, 0, $len);
-                        $word = substr($word, $len);
-                        $buf .= " " . $part;
-                        $message .= $buf . sprintf("=%s", $this->LE);
-                    }
-                    else
-                    {
-                        $message .= $buf . $soft_break;
-                    }
-                    $buf = "";
-                }
-                while (strlen($word) > 0)
-                {
-                    $len = $length;
-                    if (substr($word, $len - 1, 1) == "=")
-                        $len--;
-                    elseif (substr($word, $len - 2, 1) == "=")
-                        $len -= 2;
-                    $part = substr($word, 0, $len);
-                    $word = substr($word, $len);
-
-                    if (strlen($word) > 0)
-                        $message .= $part . sprintf("=%s", $this->LE);
-                    else
-                        $buf = $part;
-                }
-              }
-              else
-              {
-                $buf_o = $buf;
-                $buf .= ($e == 0) ? $word : (" " . $word);
-
-                if (strlen($buf) > $length and $buf_o != "")
-                {
-                    $message .= $buf_o . $soft_break;
-                    $buf = $word;
-                }
+    $line = explode($this->LE, $message);
+    $message = '';
+    for ($i=0 ;$i < count($line); $i++) {
+      $line_part = explode(' ', $line[$i]);
+      $buf = '';
+      for ($e = 0; $e<count($line_part); $e++) {
+        $word = $line_part[$e];
+        if ($qp_mode and (strlen($word) > $length)) {
+          $space_left = $length - strlen($buf) - 1;
+          if ($e != 0) {
+            if ($space_left > 20) {
+              $len = $space_left;
+              if ($is_utf8) {
+                $len = $this->UTF8CharBoundary($word, $len);
+              } elseif (substr($word, $len - 1, 1) == "=") {
+                $len--;
+              } elseif (substr($word, $len - 2, 1) == "=") {
+                $len -= 2;
               }
               }
+              $part = substr($word, 0, $len);
+              $word = substr($word, $len);
+              $buf .= ' ' . $part;
+              $message .= $buf . sprintf("=%s", $this->LE);
+            } else {
+              $message .= $buf . $soft_break;
+            }
+            $buf = '';
           }
           }
-          $message .= $buf . $this->LE;
-        }
+          while (strlen($word) > 0) {
+            $len = $length;
+            if ($is_utf8) {
+              $len = $this->UTF8CharBoundary($word, $len);
+            } elseif (substr($word, $len - 1, 1) == "=") {
+              $len--;
+            } elseif (substr($word, $len - 2, 1) == "=") {
+              $len -= 2;
+            }
+            $part = substr($word, 0, $len);
+            $word = substr($word, $len);
 
 
-        return $message;
-    }
-
-    /**
-     * Set the body wrapping.
-     * @access private
-     * @return void
-     */
-    function SetWordWrap() {
-        if($this->WordWrap < 1)
-            return;
-
-        switch($this->message_type)
-        {
-           case "alt":
-              // fall through
-           case "alt_attachments":
-              $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
-              break;
-           default:
-              $this->Body = $this->WrapText($this->Body, $this->WordWrap);
-              break;
+            if (strlen($word) > 0) {
+              $message .= $part . sprintf("=%s", $this->LE);
+            } else {
+              $buf = $part;
+            }
+          }
+        } else {
+          $buf_o = $buf;
+          $buf .= ($e == 0) ? $word : (' ' . $word);
+
+          if (strlen($buf) > $length and $buf_o != '') {
+            $message .= $buf_o . $soft_break;
+            $buf = $word;
+          }
         }
         }
+      }
+      $message .= $buf . $this->LE;
     }
 
     }
 
-    /**
-     * Assembles message header.
-     * @access private
-     * @return string
-     */
-    function CreateHeader() {
-        $result = "";
-
-        // Set the boundaries
-        $uniq_id = md5(uniqid(time()));
-        $this->boundary[1] = "b1_" . $uniq_id;
-        $this->boundary[2] = "b2_" . $uniq_id;
-
-        $result .= $this->HeaderLine("Date", $this->RFCDate());
-        if($this->Sender == "")
-            $result .= $this->HeaderLine("Return-Path", trim($this->From));
-        else
-            $result .= $this->HeaderLine("Return-Path", trim($this->Sender));
-
-        // To be created automatically by mail()
-        if($this->Mailer != "mail")
-        {
-            if(count($this->to) > 0)
-                $result .= $this->AddrAppend("To", $this->to);
-            else if (count($this->cc) == 0)
-                $result .= $this->HeaderLine("To", "undisclosed-recipients:;");
-            if(count($this->cc) > 0)
-                $result .= $this->AddrAppend("Cc", $this->cc);
+    return $message;
+  }
+
+  /**
+   * Finds last character boundary prior to maxLength in a utf-8
+   * quoted (printable) encoded string.
+   * Original written by Colin Brown.
+   * @access private
+   * @param string $encodedText utf-8 QP text
+   * @param int    $maxLength   find last character boundary prior to this length
+   * @return int
+   */
+  function UTF8CharBoundary($encodedText, $maxLength) {
+    $foundSplitPos = false;
+    $lookBack = 3;
+    while (!$foundSplitPos) {
+      $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
+      $encodedCharPos = strpos($lastChunk, "=");
+      if ($encodedCharPos !== false) {
+        // Found start of encoded character byte within $lookBack block.
+        // Check the encoded byte value (the 2 chars after the '=')
+        $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
+        $dec = hexdec($hex);
+        if ($dec < 128) { // Single byte character.
+          // If the encoded char was found at pos 0, it will fit
+          // otherwise reduce maxLength to start of the encoded char
+          $maxLength = ($encodedCharPos == 0) ? $maxLength :
+          $maxLength - ($lookBack - $encodedCharPos);
+          $foundSplitPos = true;
+        } elseif ($dec >= 192) { // First byte of a multi byte character
+          // Reduce maxLength to split at start of character
+          $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+          $foundSplitPos = true;
+        } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
+          $lookBack += 3;
         }
         }
+      } else {
+        // No encoded character found
+        $foundSplitPos = true;
+      }
+    }
+    return $maxLength;
+  }
+
+  /**
+   * Set the body wrapping.
+   * @access private
+   * @return void
+   */
+  function SetWordWrap() {
+    if($this->WordWrap < 1) {
+      return;
+    }
+
+    switch($this->message_type) {
+      case 'alt':
+        /* fall through */
+      case 'alt_attachments':
+        $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
+        break;
+      default:
+        $this->Body = $this->WrapText($this->Body, $this->WordWrap);
+        break;
+    }
+  }
+
+  /**
+   * Assembles message header.
+   * @access private
+   * @return string
+   */
+  function CreateHeader() {
+    $result = '';
+
+    /* Set the boundaries */
+    $uniq_id = md5(uniqid(time()));
+    $this->boundary[1] = 'b1_' . $uniq_id;
+    $this->boundary[2] = 'b2_' . $uniq_id;
+
+    $result .= $this->HeaderLine('Date', $this->RFCDate());
+    if($this->Sender == '') {
+      $result .= $this->HeaderLine('Return-Path', trim($this->From));
+    } else {
+      $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
+    }
+
+    /* To be created automatically by mail() */
+    if($this->Mailer != 'mail') {
+      if(count($this->to) > 0) {
+        $result .= $this->AddrAppend('To', $this->to);
+      } 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[0][0] = trim($this->From);
-        $from[0][1] = $this->FromName;
-        $result .= $this->AddrAppend("From", $from);
+    $from = array();
+    $from[0][0] = trim($this->From);
+    $from[0][1] = $this->FromName;
+    $result .= $this->AddrAppend('From', $from);
 
 
-        // sendmail and mail() extract Bcc from the header before sending
-        if((($this->Mailer == "sendmail") || ($this->Mailer == "mail")) && (count($this->bcc) > 0))
-            $result .= $this->AddrAppend("Bcc", $this->bcc);
+    /* sendmail and mail() extract Cc from the header before sending */
+    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
+      $result .= $this->AddrAppend('Cc', $this->cc);
+    }
 
 
-        if(count($this->ReplyTo) > 0)
-            $result .= $this->AddrAppend("Reply-to", $this->ReplyTo);
+    /* sendmail and mail() extract Bcc from the header before sending */
+    if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
+      $result .= $this->AddrAppend('Bcc', $this->bcc);
+    }
 
 
-        // mail() sets the subject itself
-        if($this->Mailer != "mail")
-            $result .= $this->HeaderLine("Subject", $this->EncodeHeader(trim($this->Subject)));
+    if(count($this->ReplyTo) > 0) {
+      $result .= $this->AddrAppend('Reply-To', $this->ReplyTo);
+    }
 
 
-        $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
-        $result .= $this->HeaderLine("X-Priority", $this->Priority);
+    /* mail() sets the subject itself */
+    if($this->Mailer != 'mail') {
+      $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
+    }
 
 
-        if($this->ConfirmReadingTo != "")
-        {
-            $result .= $this->HeaderLine("Disposition-Notification-To",
-                       "<" . trim($this->ConfirmReadingTo) . ">");
-        }
+    if($this->MessageID != '') {
+      $result .= $this->HeaderLine('Message-ID',$this->MessageID);
+    } else {
+      $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+    }
+    $result .= $this->HeaderLine('X-Priority', $this->Priority);
+    $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.sourceforge.net) [version ' . $this->Version . ']');
 
 
-        // Add custom headers
-        for($index = 0; $index < count($this->CustomHeader); $index++)
-        {
-            $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]),
-                       $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
-        }
-        $result .= $this->HeaderLine("MIME-Version", "1.0");
-
-        switch($this->message_type)
-        {
-            case "plain":
-                $result .= $this->HeaderLine("Content-Transfer-Encoding", $this->Encoding);
-                $result .= sprintf("Content-Type: %s; charset=\"%s\"",
-                                    $this->ContentType, $this->CharSet);
-                break;
-            case "attachments":
-                // fall through
-            case "alt_attachments":
-                if($this->InlineImageExists())
-                {
-                    $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s",
-                                    "multipart/related", $this->LE, $this->LE,
-                                    $this->boundary[1], $this->LE);
-                }
-                else
-                {
-                    $result .= $this->HeaderLine("Content-Type", "multipart/mixed;");
-                    $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
-                }
-                break;
-            case "alt":
-                $result .= $this->HeaderLine("Content-Type", "multipart/alternative;");
-                $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
-                break;
-        }
+    if($this->ConfirmReadingTo != '') {
+      $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
+    }
 
 
-        if($this->Mailer != "mail")
-            $result .= $this->LE.$this->LE;
-
-        return $result;
-    }
-
-    /**
-     * Assembles the message body.  Returns an empty string on failure.
-     * @access private
-     * @return string
-     */
-    function CreateBody() {
-        $result = "";
-
-        $this->SetWordWrap();
-
-        switch($this->message_type)
-        {
-            case "alt":
-                $result .= $this->GetBoundary($this->boundary[1], "",
-                                              "text/plain", "");
-                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-                $result .= $this->GetBoundary($this->boundary[1], "",
-                                              "text/html", "");
-
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-
-                $result .= $this->EndBoundary($this->boundary[1]);
-                break;
-            case "plain":
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                break;
-            case "attachments":
-                $result .= $this->GetBoundary($this->boundary[1], "", "", "");
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE;
-
-                $result .= $this->AttachAll();
-                break;
-            case "alt_attachments":
-                $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
-                $result .= sprintf("Content-Type: %s;%s" .
-                                   "\tboundary=\"%s\"%s",
-                                   "multipart/alternative", $this->LE,
-                                   $this->boundary[2], $this->LE.$this->LE);
-
-                // Create text body
-                $result .= $this->GetBoundary($this->boundary[2], "",
-                                              "text/plain", "") . $this->LE;
-
-                $result .= $this->EncodeString($this->AltBody, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-
-                // Create the HTML body
-                $result .= $this->GetBoundary($this->boundary[2], "",
-                                              "text/html", "") . $this->LE;
-
-                $result .= $this->EncodeString($this->Body, $this->Encoding);
-                $result .= $this->LE.$this->LE;
-
-                $result .= $this->EndBoundary($this->boundary[2]);
-
-                $result .= $this->AttachAll();
-                break;
+    // Add custom headers
+    for($index = 0; $index < count($this->CustomHeader); $index++) {
+      $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
+    }
+    if (!$this->sign_key_file) {
+      $result .= $this->HeaderLine('MIME-Version', '1.0');
+      $result .= $this->GetMailMIME();
+    }
+
+    return $result;
+  }
+
+  /**
+   * Returns the message MIME.
+   * @access private
+   * @return string
+   */
+  function GetMailMIME() {
+    $result = '';
+    switch($this->message_type) {
+      case 'plain':
+        $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
+        $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
+        break;
+      case 'attachments':
+        /* fall through */
+      case 'alt_attachments':
+        if($this->InlineImageExists()){
+          $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
+        } else {
+          $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
+          $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
         }
         }
-        if($this->IsError())
-            $result = "";
+        break;
+      case 'alt':
+        $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
+        $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+        break;
+    }
 
 
-        return $result;
+    if($this->Mailer != 'mail') {
+      $result .= $this->LE.$this->LE;
     }
 
     }
 
-    /**
-     * Returns the start of a message boundary.
-     * @access private
-     */
-    function GetBoundary($boundary, $charSet, $contentType, $encoding) {
-        $result = "";
-        if($charSet == "") { $charSet = $this->CharSet; }
-        if($contentType == "") { $contentType = $this->ContentType; }
-        if($encoding == "") { $encoding = $this->Encoding; }
+    return $result;
+  }
+
+  /**
+   * Assembles the message body.  Returns an empty string on failure.
+   * @access private
+   * @return string
+   */
+  function CreateBody() {
+    $result = '';
+    if ($this->sign_key_file) {
+      $result .= $this->GetMailMIME();
+    }
 
 
-        $result .= $this->TextLine("--" . $boundary);
-        $result .= sprintf("Content-Type: %s; charset = \"%s\"",
-                            $contentType, $charSet);
+    $this->SetWordWrap();
+
+    switch($this->message_type) {
+      case 'alt':
+        $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
+        $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->EndBoundary($this->boundary[1]);
+        break;
+      case 'plain':
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        break;
+      case 'attachments':
+        $result .= $this->GetBoundary($this->boundary[1], '', '', '');
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
         $result .= $this->LE;
         $result .= $this->LE;
-        $result .= $this->HeaderLine("Content-Transfer-Encoding", $encoding);
-        $result .= $this->LE;
-
-        return $result;
-    }
-
-    /**
-     * Returns the end of a message boundary.
-     * @access private
-     */
-    function EndBoundary($boundary) {
-        return $this->LE . "--" . $boundary . "--" . $this->LE;
-    }
-
-    /**
-     * Sets the message type.
-     * @access private
-     * @return void
-     */
-    function SetMessageType() {
-        if(count($this->attachment) < 1 && strlen($this->AltBody) < 1)
-            $this->message_type = "plain";
-        else
-        {
-            if(count($this->attachment) > 0)
-                $this->message_type = "attachments";
-            if(strlen($this->AltBody) > 0 && count($this->attachment) < 1)
-                $this->message_type = "alt";
-            if(strlen($this->AltBody) > 0 && count($this->attachment) > 0)
-                $this->message_type = "alt_attachments";
-        }
+        $result .= $this->AttachAll();
+        break;
+      case 'alt_attachments':
+        $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
+        $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
+        $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
+        $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
+        $result .= $this->EncodeString($this->Body, $this->Encoding);
+        $result .= $this->LE.$this->LE;
+        $result .= $this->EndBoundary($this->boundary[2]);
+        $result .= $this->AttachAll();
+        break;
     }
 
     }
 
-    /**
-     * Returns a formatted header line.
-     * @access private
-     * @return string
-     */
-    function HeaderLine($name, $value) {
-        return $name . ": " . $value . $this->LE;
-    }
-
-    /**
-     * Returns a formatted mail line.
-     * @access private
-     * @return string
-     */
-    function TextLine($value) {
-        return $value . $this->LE;
-    }
-
-    /////////////////////////////////////////////////
-    // ATTACHMENT METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds an attachment from a path on the filesystem.
-     * Returns false if the file could not be found
-     * or accessed.
-     * @param string $path Path to the attachment.
-     * @param string $name Overrides the attachment name.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.
-     * @return bool
-     */
-    function AddAttachment($path, $name = "", $encoding = "base64",
-                           $type = "application/octet-stream") {
-        if(!@is_file($path))
-        {
-            $this->SetError($this->Lang("file_access") . $path);
-            return false;
-        }
+    if($this->IsError()) {
+      $result = '';
+    } else if ($this->sign_key_file) {
+      $file = tempnam("", "mail");
+      $fp = fopen($file, "w");
+      fwrite($fp, $result);
+      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)) {
+        $fp = fopen($signed, "r");
+        $result = fread($fp, filesize($this->sign_key_file));
+        fclose($fp);
+      } else {
+        $this->SetError($this->Lang("signing").openssl_error_string());
+        $result = '';
+      }
 
 
-        $filename = basename($path);
-        if($name == "")
-            $name = $filename;
-
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $path;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $name;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = false; // isStringAttachment
-        $this->attachment[$cur][6] = "attachment";
-        $this->attachment[$cur][7] = 0;
-
-        return true;
-    }
-
-    /**
-     * Attaches all fs, string, and binary attachments to the message.
-     * Returns an empty string on failure.
-     * @access private
-     * @return string
-     */
-    function AttachAll() {
-        // Return text of body
-        $mime = array();
-
-        // Add all attachments
-        for($i = 0; $i < count($this->attachment); $i++)
-        {
-            // Check for string attachment
-            $bString = $this->attachment[$i][5];
-            if ($bString)
-                $string = $this->attachment[$i][0];
-            else
-                $path = $this->attachment[$i][0];
-
-            $filename    = $this->attachment[$i][1];
-            $name        = $this->attachment[$i][2];
-            $encoding    = $this->attachment[$i][3];
-            $type        = $this->attachment[$i][4];
-            $disposition = $this->attachment[$i][6];
-            $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-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);
-
-            // Encode as string attachment
-            if($bString)
-            {
-                $mime[] = $this->EncodeString($string, $encoding);
-                if($this->IsError()) { return ""; }
-                $mime[] = $this->LE.$this->LE;
-            }
-            else
-            {
-                $mime[] = $this->EncodeFile($path, $encoding);
-                if($this->IsError()) { return ""; }
-                $mime[] = $this->LE.$this->LE;
-            }
-        }
+      unlink($file);
+      unlink($signed);
+    }
 
 
-        $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+    return $result;
+  }
+
+  /**
+   * Returns the start of a message boundary.
+   * @access private
+   */
+  function GetBoundary($boundary, $charSet, $contentType, $encoding) {
+    $result = '';
+    if($charSet == '') {
+      $charSet = $this->CharSet;
+    }
+    if($contentType == '') {
+      $contentType = $this->ContentType;
+    }
+    if($encoding == '') {
+      $encoding = $this->Encoding;
+    }
+    $result .= $this->TextLine('--' . $boundary);
+    $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
+    $result .= $this->LE;
+    $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
+    $result .= $this->LE;
+
+    return $result;
+  }
+
+  /**
+   * Returns the end of a message boundary.
+   * @access private
+   */
+  function EndBoundary($boundary) {
+    return $this->LE . '--' . $boundary . '--' . $this->LE;
+  }
+
+  /**
+   * Sets the message type.
+   * @access private
+   * @return void
+   */
+  function SetMessageType() {
+    if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
+      $this->message_type = 'plain';
+    } else {
+      if(count($this->attachment) > 0) {
+        $this->message_type = 'attachments';
+      }
+      if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
+        $this->message_type = 'alt';
+      }
+      if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
+        $this->message_type = 'alt_attachments';
+      }
+    }
+  }
+
+  /* Returns a formatted header line.
+   * @access private
+   * @return string
+   */
+  function HeaderLine($name, $value) {
+    return $name . ': ' . $value . $this->LE;
+  }
+
+  /**
+   * Returns a formatted mail line.
+   * @access private
+   * @return string
+   */
+  function TextLine($value) {
+    return $value . $this->LE;
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, ATTACHMENTS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds an attachment from a path on the filesystem.
+   * Returns false if the file could not be found
+   * or accessed.
+   * @param string $path Path to the attachment.
+   * @param string $name Overrides the attachment name.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return bool
+   */
+  function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+    if(!@is_file($path)) {
+      $this->SetError($this->Lang('file_access') . $path);
+      return false;
+    }
 
 
-        return join("", $mime);
+    $filename = basename($path);
+    if($name == '') {
+      $name = $filename;
     }
 
     }
 
-    /**
-     * Encodes attachment in requested format.  Returns an
-     * empty string on failure.
-     * @access private
-     * @return string
-     */
-    function EncodeFile ($path, $encoding = "base64") {
-        if(!@$fd = fopen($path, "rb"))
-        {
-            $this->SetError($this->Lang("file_open") . $path);
-            return "";
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $path;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $name;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = false; // isStringAttachment
+    $this->attachment[$cur][6] = 'attachment';
+    $this->attachment[$cur][7] = 0;
+
+    return true;
+  }
+
+  /**
+   * Attaches all fs, string, and binary attachments to the message.
+   * Returns an empty string on failure.
+   * @access private
+   * @return string
+   */
+  function AttachAll() {
+    /* Return text of body */
+    $mime = array();
+
+    /* Add all attachments */
+    for($i = 0; $i < count($this->attachment); $i++) {
+      /* Check for string attachment */
+      $bString = $this->attachment[$i][5];
+      if ($bString) {
+        $string = $this->attachment[$i][0];
+      } else {
+        $path = $this->attachment[$i][0];
+      }
+
+      $filename    = $this->attachment[$i][1];
+      $name        = $this->attachment[$i][2];
+      $encoding    = $this->attachment[$i][3];
+      $type        = $this->attachment[$i][4];
+      $disposition = $this->attachment[$i][6];
+      $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-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);
+
+      /* Encode as string attachment */
+      if($bString) {
+        $mime[] = $this->EncodeString($string, $encoding);
+        if($this->IsError()) {
+          return '';
         }
         }
-        $magic_quotes = get_magic_quotes_runtime();
-        set_magic_quotes_runtime(0);
-        $file_buffer = fread($fd, filesize($path));
-        $file_buffer = $this->EncodeString($file_buffer, $encoding);
-        fclose($fd);
-        set_magic_quotes_runtime($magic_quotes);
-
-        return $file_buffer;
-    }
-
-    /**
-     * Encodes string to requested format. Returns an
-     * empty string on failure.
-     * @access private
-     * @return string
-     */
-    function EncodeString ($str, $encoding = "base64") {
-        $encoded = "";
-        switch(strtolower($encoding)) {
-          case "base64":
-              // chunk_split is found in PHP >= 3.0.6
-              $encoded = chunk_split(base64_encode($str), 76, $this->LE);
-              break;
-          case "7bit":
-          case "8bit":
-              $encoded = $this->FixEOL($str);
-              if (substr($encoded, -(strlen($this->LE))) != $this->LE)
-                $encoded .= $this->LE;
-              break;
-          case "binary":
-              $encoded = $str;
-              break;
-          case "quoted-printable":
-              $encoded = $this->EncodeQP($str);
-              break;
-          default:
-              $this->SetError($this->Lang("encoding") . $encoding);
-              break;
+        $mime[] = $this->LE.$this->LE;
+      } else {
+        $mime[] = $this->EncodeFile($path, $encoding);
+        if($this->IsError()) {
+          return '';
         }
         }
-        return $encoded;
-    }
-
-    /**
-     * Encode a header string to best of Q, B, quoted or none.
-     * @access private
-     * @return string
-     */
-    function EncodeHeader ($str, $position = 'text') {
-      $x = 0;
-
-      switch (strtolower($position)) {
-        case 'phrase':
-          if (!preg_match('/[\200-\377]/', $str)) {
-            // Can't use addslashes as we don't know what value has magic_quotes_sybase.
-            $encoded = addcslashes($str, "\0..\37\177\\\"");
-
-            if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str))
-              return ($encoded);
-            else
-              return ("\"$encoded\"");
-          }
-          $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
-          break;
-        case 'comment':
-          $x = preg_match_all('/[()"]/', $str, $matches);
-          // Fall-through
-        case 'text':
-        default:
-          $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
-          break;
+        $mime[] = $this->LE.$this->LE;
       }
       }
+    }
 
 
-      if ($x == 0)
-        return ($str);
+    $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+
+    return join('', $mime);
+  }
+
+  /**
+   * Encodes attachment in requested format.  Returns an
+   * empty string on failure.
+   * @access private
+   * @return string
+   */
+  function EncodeFile ($path, $encoding = 'base64') {
+    if(!@$fd = fopen($path, 'rb')) {
+      $this->SetError($this->Lang('file_open') . $path);
+      return '';
+    }
+    $magic_quotes = get_magic_quotes_runtime();
+    set_magic_quotes_runtime(0);
+    $file_buffer = fread($fd, filesize($path));
+    $file_buffer = $this->EncodeString($file_buffer, $encoding);
+    fclose($fd);
+    set_magic_quotes_runtime($magic_quotes);
+
+    return $file_buffer;
+  }
+
+  /**
+   * Encodes string to requested format. Returns an
+   * empty string on failure.
+   * @access private
+   * @return string
+   */
+  function EncodeString ($str, $encoding = 'base64') {
+    $encoded = '';
+    switch(strtolower($encoding)) {
+      case 'base64':
+        /* chunk_split is found in PHP >= 3.0.6 */
+        $encoded = chunk_split(base64_encode($str), 76, $this->LE);
+        break;
+      case '7bit':
+      case '8bit':
+        $encoded = $this->FixEOL($str);
+        if (substr($encoded, -(strlen($this->LE))) != $this->LE)
+          $encoded .= $this->LE;
+        break;
+      case 'binary':
+        $encoded = $str;
+        break;
+      case 'quoted-printable':
+        $encoded = $this->EncodeQP($str);
+        break;
+      default:
+        $this->SetError($this->Lang('encoding') . $encoding);
+        break;
+    }
+    return $encoded;
+  }
+
+  /**
+   * Encode a header string to best of Q, B, quoted or none.
+   * @access private
+   * @return string
+   */
+  function EncodeHeader ($str, $position = 'text') {
+    $x = 0;
+
+    switch (strtolower($position)) {
+      case 'phrase':
+        if (!preg_match('/[\200-\377]/', $str)) {
+          /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
+          $encoded = addcslashes($str, "\0..\37\177\\\"");
+          if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
+            return ($encoded);
+          } else {
+            return ("\"$encoded\"");
+          }
+        }
+        $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
+        break;
+      case 'comment':
+        $x = preg_match_all('/[()"]/', $str, $matches);
+        /* Fall-through */
+      case 'text':
+      default:
+        $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
+        break;
+    }
+
+    if ($x == 0) {
+      return ($str);
+    }
 
 
-      $maxlen = 75 - 7 - strlen($this->CharSet);
-      // Try to select the encoding which should produce the shortest output
-      if (strlen($str)/3 < $x) {
-        $encoding = 'B';
+    $maxlen = 75 - 7 - strlen($this->CharSet);
+    /* Try to select the encoding which should produce the shortest output */
+    if (strlen($str)/3 < $x) {
+      $encoding = 'B';
+      if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
+     // Use a custom function which correctly encodes and wraps long
+     // multibyte strings without breaking lines within a character
+        $encoded = $this->Base64EncodeWrapMB($str);
+      } else {
         $encoded = base64_encode($str);
         $maxlen -= $maxlen % 4;
         $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
         $encoded = base64_encode($str);
         $maxlen -= $maxlen % 4;
         $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
-      } else {
-        $encoding = 'Q';
-        $encoded = $this->EncodeQ($str, $position);
-        $encoded = $this->WrapText($encoded, $maxlen, true);
-        $encoded = str_replace("=".$this->LE, "\n", trim($encoded));
       }
       }
+    } else {
+      $encoding = 'Q';
+      $encoded = $this->EncodeQ($str, $position);
+      $encoded = $this->WrapText($encoded, $maxlen, true);
+      $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
+    }
 
 
-      $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
-      $encoded = trim(str_replace("\n", $this->LE, $encoded));
+    $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
+    $encoded = trim(str_replace("\n", $this->LE, $encoded));
+
+    return $encoded;
+  }
+
+  /**
+   * Checks if a string contains multibyte characters.
+   * @access private
+   * @param string $str multi-byte text to wrap encode
+   * @return bool
+   */
+  function HasMultiBytes($str) {
+    if (function_exists('mb_strlen')) {
+      return (strlen($str) > mb_strlen($str, $this->CharSet));
+    } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
+      return False;
+    }
+  }
+
+  /**
+   * Correctly encodes and wraps long multibyte strings for mail headers
+   * without breaking lines within a character.
+   * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
+   * @access private
+   * @param string $str multi-byte text to wrap encode
+   * @return string
+   */
+  function Base64EncodeWrapMB($str) {
+    $start = "=?".$this->CharSet."?B?";
+    $end = "?=";
+    $encoded = "";
+
+    $mb_length = mb_strlen($str, $this->CharSet);
+    // Each line must have length <= 75, including $start and $end
+    $length = 75 - strlen($start) - strlen($end);
+    // Average multi-byte ratio
+    $ratio = $mb_length / strlen($str);
+    // Base64 has a 4:3 ratio
+    $offset = $avgLength = floor($length * $ratio * .75);
+
+    for ($i = 0; $i < $mb_length; $i += $offset) {
+      $lookBack = 0;
+
+      do {
+        $offset = $avgLength - $lookBack;
+        $chunk = mb_substr($str, $i, $offset, $this->CharSet);
+        $chunk = base64_encode($chunk);
+        $lookBack++;
+      }
+      while (strlen($chunk) > $length);
 
 
-      return $encoded;
+      $encoded .= $chunk . $this->LE;
     }
 
     }
 
-    /**
-     * Encode string to quoted-printable.
-     * @access private
-     * @return string
-     */
-    function EncodeQP ($str) {
-        $encoded = $this->FixEOL($str);
-        if (substr($encoded, -(strlen($this->LE))) != $this->LE)
-            $encoded .= $this->LE;
-
-        // Replace every high ascii, control and = characters
-        $encoded = preg_replace('/([\000-\010\013\014\016-\037\075\177-\377])/e',
-                  "'='.sprintf('%02X', ord('\\1'))", $encoded);
-        // Replace every spaces and tabs when it's the last character on a line
-        $encoded = preg_replace("/([\011\040])".$this->LE."/e",
-                  "'='.sprintf('%02X', ord('\\1')).'".$this->LE."'", $encoded);
-
-        // Maximum line length of 76 characters before CRLF (74 + space + '=')
-        $encoded = $this->WrapText($encoded, 74, true);
-
-        return $encoded;
-    }
-
-    /**
-     * Encode string to q encoding.
-     * @access private
-     * @return string
-     */
-    function EncodeQ ($str, $position = "text") {
-        // There should not be any EOL in the string
-        $encoded = preg_replace("[\r\n]", "", $str);
-
-        switch (strtolower($position)) {
-          case "phrase":
-            $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
-            break;
-          case "comment":
-            $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
-          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);
-            break;
+    // Chomp the last linefeed
+    $encoded = substr($encoded, 0, -strlen($this->LE));
+    return $encoded;
+  }
+
+  /**
+   * Encode string to quoted-printable.
+   * @access private
+   * @return string
+   */
+  function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
+    $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
+    $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
+    $eol = "\r\n";
+    $escape = '=';
+    $output = '';
+    while( list(, $line) = each($lines) ) {
+      $linlen = strlen($line);
+      $newline = '';
+      for($i = 0; $i < $linlen; $i++) {
+        $c = substr( $line, $i, 1 );
+        $dec = ord( $c );
+        if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
+          $c = '=2E';
         }
         }
-
-        // Replace every spaces to _ (more readable than =20)
-        $encoded = str_replace(" ", "_", $encoded);
-
-        return $encoded;
-    }
-
-    /**
-     * Adds a string or binary attachment (non-filesystem) to the list.
-     * This method can be used to attach ascii or binary data,
-     * such as a BLOB record from a database.
-     * @param string $string String attachment data.
-     * @param string $filename Name of the attachment.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.
-     * @return void
-     */
-    function AddStringAttachment($string, $filename, $encoding = "base64",
-                                 $type = "application/octet-stream") {
-        // Append to $attachment array
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $string;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $filename;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = true; // isString
-        $this->attachment[$cur][6] = "attachment";
-        $this->attachment[$cur][7] = 0;
-    }
-
-    /**
-     * Adds an embedded attachment.  This can include images, sounds, and
-     * just about any other document.  Make sure to set the $type to an
-     * image type.  For JPEG images use "image/jpeg" and for GIF images
-     * use "image/gif".
-     * @param string $path Path to the attachment.
-     * @param string $cid Content ID of the attachment.  Use this to identify
-     *        the Id for accessing the image in an HTML form.
-     * @param string $name Overrides the attachment name.
-     * @param string $encoding File encoding (see $Encoding).
-     * @param string $type File extension (MIME) type.
-     * @return bool
-     */
-    function AddEmbeddedImage($path, $cid, $name = "", $encoding = "base64",
-                              $type = "application/octet-stream") {
-
-        if(!@is_file($path))
-        {
-            $this->SetError($this->Lang("file_access") . $path);
-            return false;
+        if ( $dec == 32 ) {
+          if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
+            $c = '=20';
+          } else if ( $space_conv ) {
+            $c = '=20';
+          }
+        } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
+          $h2 = floor($dec/16);
+          $h1 = floor($dec%16);
+          $c = $escape.$hex[$h2].$hex[$h1];
         }
         }
-
-        $filename = basename($path);
-        if($name == "")
-            $name = $filename;
-
-        // Append to $attachment array
-        $cur = count($this->attachment);
-        $this->attachment[$cur][0] = $path;
-        $this->attachment[$cur][1] = $filename;
-        $this->attachment[$cur][2] = $name;
-        $this->attachment[$cur][3] = $encoding;
-        $this->attachment[$cur][4] = $type;
-        $this->attachment[$cur][5] = false; // isStringAttachment
-        $this->attachment[$cur][6] = "inline";
-        $this->attachment[$cur][7] = $cid;
-
-        return true;
-    }
-
-    /**
-     * Returns true if an inline attachment is present.
-     * @access private
-     * @return bool
-     */
-    function InlineImageExists() {
-        $result = false;
-        for($i = 0; $i < count($this->attachment); $i++)
-        {
-            if($this->attachment[$i][6] == "inline")
-            {
-                $result = true;
-                break;
-            }
+        if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
+          $output .= $newline.$escape.$eol; //  soft line break; " =\r\n" is okay
+          $newline = '';
+          // check if newline first character will be point or not
+          if ( $dec == 46 ) {
+            $c = '=2E';
+          }
         }
         }
+        $newline .= $c;
+      } // end of for
+      $output .= $newline.$eol;
+    } // end of while
+    return trim($output);
+  }
+
+  /**
+   * Encode string to q encoding.
+   * @access private
+   * @return string
+   */
+  function EncodeQ ($str, $position = 'text') {
+    /* There should not be any EOL in the string */
+    $encoded = preg_replace("/[\r\n]/", '', $str);
+
+    switch (strtolower($position)) {
+      case 'phrase':
+        $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+        break;
+      case 'comment':
+        $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+      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);
+        break;
+    }
 
 
-        return $result;
+    /* Replace every spaces to _ (more readable than =20) */
+    $encoded = str_replace(' ', '_', $encoded);
+
+    return $encoded;
+  }
+
+  /**
+   * Adds a string or binary attachment (non-filesystem) to the list.
+   * This method can be used to attach ascii or binary data,
+   * such as a BLOB record from a database.
+   * @param string $string String attachment data.
+   * @param string $filename Name of the attachment.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return void
+   */
+  function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
+    /* Append to $attachment array */
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $string;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $filename;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = true; // isString
+    $this->attachment[$cur][6] = 'attachment';
+    $this->attachment[$cur][7] = 0;
+  }
+
+  /**
+   * Adds an embedded attachment.  This can include images, sounds, and
+   * just about any other document.  Make sure to set the $type to an
+   * image type.  For JPEG images use "image/jpeg" and for GIF images
+   * use "image/gif".
+   * @param string $path Path to the attachment.
+   * @param string $cid Content ID of the attachment.  Use this to identify
+   *        the Id for accessing the image in an HTML form.
+   * @param string $name Overrides the attachment name.
+   * @param string $encoding File encoding (see $Encoding).
+   * @param string $type File extension (MIME) type.
+   * @return bool
+   */
+  function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+
+    if(!@is_file($path)) {
+      $this->SetError($this->Lang('file_access') . $path);
+      return false;
     }
 
     }
 
-    /////////////////////////////////////////////////
-    // MESSAGE RESET METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Clears all recipients assigned in the TO array.  Returns void.
-     * @return void
-     */
-    function ClearAddresses() {
-        $this->to = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the CC array.  Returns void.
-     * @return void
-     */
-    function ClearCCs() {
-        $this->cc = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the BCC array.  Returns void.
-     * @return void
-     */
-    function ClearBCCs() {
-        $this->bcc = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the ReplyTo array.  Returns void.
-     * @return void
-     */
-    function ClearReplyTos() {
-        $this->ReplyTo = array();
-    }
-
-    /**
-     * Clears all recipients assigned in the TO, CC and BCC
-     * array.  Returns void.
-     * @return void
-     */
-    function ClearAllRecipients() {
-        $this->to = array();
-        $this->cc = array();
-        $this->bcc = array();
-    }
-
-    /**
-     * Clears all previously set filesystem, string, and binary
-     * attachments.  Returns void.
-     * @return void
-     */
-    function ClearAttachments() {
-        $this->attachment = array();
-    }
-
-    /**
-     * Clears all custom headers.  Returns void.
-     * @return void
-     */
-    function ClearCustomHeaders() {
-        $this->CustomHeader = array();
-    }
-
-
-    /////////////////////////////////////////////////
-    // MISCELLANEOUS METHODS
-    /////////////////////////////////////////////////
-
-    /**
-     * Adds the error message to the error container.
-     * Returns void.
-     * @access private
-     * @return void
-     */
-    function SetError($msg) {
-        $this->error_count++;
-        $this->ErrorInfo = $msg;
-    }
-
-    /**
-     * Returns the proper RFC 822 formatted date.
-     * @access private
-     * @return string
-     */
-    function RFCDate() {
-        $tz = date("Z");
-        $tzs = ($tz < 0) ? "-" : "+";
-        $tz = abs($tz);
-        $tz = ($tz/3600)*100 + ($tz%3600)/60;
-        $result = sprintf("%s %s%04d", date("D, j M Y H:i:s"), $tzs, $tz);
-
-        return $result;
-    }
-
-    /**
-     * Returns the appropriate server variable.  Should work with both
-     * PHP 4.1.0+ as well as older versions.  Returns an empty string
-     * if nothing is found.
-     * @access private
-     * @return mixed
-     */
-    function ServerVar($varName) {
-        global $HTTP_SERVER_VARS;
-        global $HTTP_ENV_VARS;
-
-        if(!isset($_SERVER))
-        {
-            $_SERVER = $HTTP_SERVER_VARS;
-            if(!isset($_SERVER["REMOTE_ADDR"]))
-                $_SERVER = $HTTP_ENV_VARS; // must be Apache
-        }
-
-        if(isset($_SERVER[$varName]))
-            return $_SERVER[$varName];
-        else
-            return "";
-    }
-
-    /**
-     * Returns the server hostname or 'localhost.localdomain' if unknown.
-     * @access private
-     * @return string
-     */
-    function ServerHostname() {
-        if ($this->Hostname != "")
-            $result = $this->Hostname;
-        elseif ($this->ServerVar('SERVER_NAME') != "")
-            $result = $this->ServerVar('SERVER_NAME');
-        else
-            $result = "localhost.localdomain";
-
-        return $result;
-    }
-
-    /**
-     * Returns a message in the appropriate language.
-     * @access private
-     * @return string
-     */
-    function Lang($key) {
-        if(count($this->language) < 1)
-            $this->SetLanguage("en"); // set the default language
-
-        if(isset($this->language[$key]))
-            return $this->language[$key];
-        else
-            return "Language string failed to load: " . $key;
-    }
-
-    /**
-     * Returns true if an error occurred.
-     * @return bool
-     */
-    function IsError() {
-        return ($this->error_count > 0);
-    }
-
-    /**
-     * Changes every end of line from CR or LF to CRLF.
-     * @access private
-     * @return string
-     */
-    function FixEOL($str) {
-        $str = str_replace("\r\n", "\n", $str);
-        $str = str_replace("\r", "\n", $str);
-        $str = str_replace("\n", $this->LE, $str);
-        return $str;
-    }
-
-    /**
-     * Adds a custom header.
-     * @return void
-     */
-    function AddCustomHeader($custom_header) {
-        $this->CustomHeader[] = explode(":", $custom_header, 2);
+    $filename = basename($path);
+    if($name == '') {
+      $name = $filename;
     }
     }
+
+    /* Append to $attachment array */
+    $cur = count($this->attachment);
+    $this->attachment[$cur][0] = $path;
+    $this->attachment[$cur][1] = $filename;
+    $this->attachment[$cur][2] = $name;
+    $this->attachment[$cur][3] = $encoding;
+    $this->attachment[$cur][4] = $type;
+    $this->attachment[$cur][5] = false;
+    $this->attachment[$cur][6] = 'inline';
+    $this->attachment[$cur][7] = $cid;
+
+    return true;
+  }
+
+  /**
+   * Returns true if an inline attachment is present.
+   * @access private
+   * @return bool
+   */
+  function InlineImageExists() {
+    $result = false;
+    for($i = 0; $i < count($this->attachment); $i++) {
+      if($this->attachment[$i][6] == 'inline') {
+        $result = true;
+        break;
+      }
+    }
+
+    return $result;
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, MESSAGE RESET
+  /////////////////////////////////////////////////
+
+  /**
+   * Clears all recipients assigned in the TO array.  Returns void.
+   * @return void
+   */
+  function ClearAddresses() {
+    $this->to = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the CC array.  Returns void.
+   * @return void
+   */
+  function ClearCCs() {
+    $this->cc = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the BCC array.  Returns void.
+   * @return void
+   */
+  function ClearBCCs() {
+    $this->bcc = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the ReplyTo array.  Returns void.
+   * @return void
+   */
+  function ClearReplyTos() {
+    $this->ReplyTo = array();
+  }
+
+  /**
+   * Clears all recipients assigned in the TO, CC and BCC
+   * array.  Returns void.
+   * @return void
+   */
+  function ClearAllRecipients() {
+    $this->to = array();
+    $this->cc = array();
+    $this->bcc = array();
+  }
+
+  /**
+   * Clears all previously set filesystem, string, and binary
+   * attachments.  Returns void.
+   * @return void
+   */
+  function ClearAttachments() {
+    $this->attachment = array();
+  }
+
+  /**
+   * Clears all custom headers.  Returns void.
+   * @return void
+   */
+  function ClearCustomHeaders() {
+    $this->CustomHeader = array();
+  }
+
+  /////////////////////////////////////////////////
+  // CLASS METHODS, MISCELLANEOUS
+  /////////////////////////////////////////////////
+
+  /**
+   * Adds the error message to the error container.
+   * Returns void.
+   * @access private
+   * @return void
+   */
+  function SetError($msg) {
+    $this->error_count++;
+    $this->ErrorInfo = $msg;
+  }
+
+  /**
+   * Returns the proper RFC 822 formatted date.
+   * @access private
+   * @return string
+   */
+  function RFCDate() {
+    $tz = date('Z');
+    $tzs = ($tz < 0) ? '-' : '+';
+    $tz = abs($tz);
+    $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
+    $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
+
+    return $result;
+  }
+
+  /**
+   * Returns the appropriate server variable.  Should work with both
+   * PHP 4.1.0+ as well as older versions.  Returns an empty string
+   * if nothing is found.
+   * @access private
+   * @return mixed
+   */
+  function ServerVar($varName) {
+    global $HTTP_SERVER_VARS;
+    global $HTTP_ENV_VARS;
+
+    if(!isset($_SERVER)) {
+      $_SERVER = $HTTP_SERVER_VARS;
+      if(!isset($_SERVER['REMOTE_ADDR'])) {
+        $_SERVER = $HTTP_ENV_VARS; // must be Apache
+      }
+    }
+
+    if(isset($_SERVER[$varName])) {
+      return $_SERVER[$varName];
+    } else {
+      return '';
+    }
+  }
+
+  /**
+   * Returns the server hostname or 'localhost.localdomain' if unknown.
+   * @access private
+   * @return string
+   */
+  function ServerHostname() {
+    if ($this->Hostname != '') {
+      $result = $this->Hostname;
+    } elseif ($this->ServerVar('SERVER_NAME') != '') {
+      $result = $this->ServerVar('SERVER_NAME');
+    } else {
+      $result = 'localhost.localdomain';
+    }
+
+    return $result;
+  }
+
+  /**
+   * Returns a message in the appropriate language.
+   * @access private
+   * @return string
+   */
+  function Lang($key) {
+    if(count($this->language) < 1) {
+      $this->SetLanguage('en'); // set the default language
+    }
+
+    if(isset($this->language[$key])) {
+      return $this->language[$key];
+    } else {
+      return 'Language string failed to load: ' . $key;
+    }
+  }
+
+  /**
+   * Returns true if an error occurred.
+   * @return bool
+   */
+  function IsError() {
+    return ($this->error_count > 0);
+  }
+
+  /**
+   * Changes every end of line from CR or LF to CRLF.
+   * @access private
+   * @return string
+   */
+  function FixEOL($str) {
+    $str = str_replace("\r\n", "\n", $str);
+    $str = str_replace("\r", "\n", $str);
+    $str = str_replace("\n", $this->LE, $str);
+    return $str;
+  }
+
+  /**
+   * Adds a custom header.
+   * @return void
+   */
+  function AddCustomHeader($custom_header) {
+    $this->CustomHeader[] = explode(':', $custom_header, 2);
+  }
+
+  /**
+   * Evaluates the message and returns modifications for inline images and backgrounds
+   * @access public
+   * @return $message
+   */
+  function MsgHTML($message,$basedir='') {
+    preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
+    if(isset($images[2])) {
+      foreach($images[2] as $i => $url) {
+        // do not change urls for absolute images (thanks to corvuscorax)
+        if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
+          $filename = basename($url);
+          $directory = dirname($url);
+          ($directory == '.')?$directory='':'';
+          $cid = 'cid:' . md5($filename);
+          $fileParts = split("\.", $filename);
+          $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 ( $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);
+          }
+        }
+      }
+    }
+    $this->IsHTML(true);
+    $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;
+    }
+    if ( empty($this->AltBody) ) {
+      $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
+    }
+  }
+
+  /**
+   * Gets the mime type of the embedded or inline image
+   * @access private
+   * @return mime type of ext
+   */
+  function _mime_types($ext = '') {
+    $mimes = array(
+      'hqx'  =>  'application/mac-binhex40',
+      'cpt'   =>  'application/mac-compactpro',
+      'doc'   =>  'application/msword',
+      'bin'   =>  'application/macbinary',
+      'dms'   =>  'application/octet-stream',
+      'lha'   =>  'application/octet-stream',
+      'lzh'   =>  'application/octet-stream',
+      'exe'   =>  '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',
+      'dcr'   =>  'application/x-director',
+      'dir'   =>  'application/x-director',
+      'dxr'   =>  'application/x-director',
+      'dvi'   =>  'application/x-dvi',
+      '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',
+      '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',
+      'mid'   =>  'audio/midi',
+      'midi'  =>  'audio/midi',
+      'mpga'  =>  'audio/mpeg',
+      'mp2'   =>  'audio/mpeg',
+      'mp3'   =>  'audio/mpeg',
+      'aif'   =>  'audio/x-aiff',
+      'aiff'  =>  'audio/x-aiff',
+      'aifc'  =>  'audio/x-aiff',
+      'ram'   =>  'audio/x-pn-realaudio',
+      'rm'    =>  'audio/x-pn-realaudio',
+      'rpm'   =>  'audio/x-pn-realaudio-plugin',
+      'ra'    =>  'audio/x-realaudio',
+      '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',
+      'shtml' =>  'text/html',
+      'txt'   =>  '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',
+      'word'  =>  'application/msword',
+      'xl'    =>  'application/excel',
+      'eml'   =>  'message/rfc822'
+    );
+    return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
+  }
+
+  /**
+   * Set (or reset) Class Objects (variables)
+   *
+   * Usage Example:
+   * $page->set('X-Priority', '3');
+   *
+   * @access public
+   * @param string $name Parameter Name
+   * @param mixed $value Parameter Value
+   * NOTE: will not work with arrays, there are no arrays to set/reset
+   */
+  function set ( $name, $value = '' ) {
+    if ( isset($this->$name) ) {
+      $this->$name = $value;
+    } else {
+      $this->SetError('Cannot set or reset variable ' . $name);
+      return false;
+    }
+  }
+
+  /**
+   * Read a file from a supplied filename and return it.
+   *
+   * @access public
+   * @param string $filename Parameter File Name
+   */
+  function getFile($filename) {
+    $return = '';
+    if ($fp = fopen($filename, 'rb')) {
+      while (!feof($fp)) {
+        $return .= fread($fp, 1024);
+      }
+      fclose($fp);
+      return $return;
+    } else {
+      return false;
+    }
+  }
+
+  /**
+   * Strips newlines to prevent header injection.
+   * @access private
+   * @param string $str String
+   * @return string
+   */
+  function SecureHeader($str) {
+    $str = trim($str);
+    $str = str_replace("\r", "", $str);
+    $str = str_replace("\n", "", $str);
+    return $str;
+  }
+
+  /**
+   * Set the private key file and password to sign the message.
+   *
+   * @access public
+   * @param string $key_filename Parameter File Name
+   * @param string $key_pass Password for private key
+   */
+  function Sign($key_filename, $key_pass) {
+    $this->sign_key_file = $key_filename;
+    $this->sign_key_pass = $key_pass;
+  }
+
 }
 
 ?>
 }
 
 ?>
index bdb7903fd8a77ff37291d548e5a946a8f8d44125..c11676c4944895f7cd2efde77cf687dc6e3fb158 100644 (file)
  *
  * pop3 class
  *
  *
  * pop3 class
  *
- * $Id: class-pop3.php 8082 2008-06-14 16:36:13Z westi $
+ * $Id: class-pop3.php 9503 2008-11-03 23:25:11Z ryan $
  */
 
  */
 
-/**
- * POP3
- *
- * @package SquirrelMail
- */
 class POP3 {
     var $ERROR      = '';       //  Error string.
 
 class POP3 {
     var $ERROR      = '';       //  Error string.
 
index dd8b951880ea7fd8177b50d0ea191b9d0bca23a0..048bd0f7c0e0a11197abecb1d575b8464877420c 100644 (file)
 <?php
 <?php
-/**
- * SMTP - PHP SMTP class
- *
- * Define an SMTP class that can be used to connect and communicate with any
- * SMTP server. It implements all the SMTP functions defined in RFC821 except
- * TURN.
- *
- * @version 1.02
- * @author Chris Ryan
- * @license LGPL
- * @package PHPMailer
+/*~ class.smtp.php
+.---------------------------------------------------------------------------.
+|  Software: PHPMailer - PHP email class                                    |
+|   Version: 2.0.2                                                          |
+|   Contact: via sourceforge.net support pages (also www.codeworxtech.com)  |
+|      Info: http://phpmailer.sourceforge.net                               |
+|   Support: http://sourceforge.net/projects/phpmailer/                     |
+| ------------------------------------------------------------------------- |
+|    Author: Andy Prevost (project admininistrator)                         |
+|    Author: Brent R. Matzelle (original founder)                           |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved.               |
+| Copyright (c) 2001-2003, Brent R. Matzelle                                |
+| ------------------------------------------------------------------------- |
+|   License: Distributed under the Lesser General Public License (LGPL)     |
+|            http://www.gnu.org/copyleft/lesser.html                        |
+| This program is distributed in the hope that it will be useful - WITHOUT  |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or     |
+| FITNESS FOR A PARTICULAR PURPOSE.                                         |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com):                |
+| - Web Hosting on highly optimized fast and secure servers                 |
+| - Technology Consulting                                                   |
+| - Oursourcing (highly qualified programmers and graphic designers)        |
+'---------------------------------------------------------------------------'
  */
  */
-
 /**
  * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
  * commands except TURN which will always return a not implemented
  * error. SMTP also provides some utility methods for sending mail
  * to an SMTP server.
 /**
  * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
  * commands except TURN which will always return a not implemented
  * error. SMTP also provides some utility methods for sending mail
  * to an SMTP server.
- *
  * @package PHPMailer
  * @author Chris Ryan
  */
  * @package PHPMailer
  * @author Chris Ryan
  */
+
 class SMTP
 {
 class SMTP
 {
-    /**
-     *  SMTP server port
-     *  @var int
-     */
-    var $SMTP_PORT = 25;
-
-    /**
-     *  SMTP reply line ending
-     *  @var string
-     */
-    var $CRLF = "\r\n";
-
-    /**
-     *  Sets whether debugging is turned on
-     *  @var bool
-     */
-    var $do_debug;       # the level of debug to perform
-
-    /**#@+
-     * @access private
-     */
-    var $smtp_conn;      # the socket to the server
-    var $error;          # error if any on the last call
-    var $helo_rply;      # the reply the server sent to us for HELO
-    /**#@-*/
-
-    /**
-     * Initialize the class so that the data is in a known state.
-     * @access public
-     * @return void
-     */
-    function SMTP() {
-        $this->smtp_conn = 0;
-        $this->error = null;
-        $this->helo_rply = null;
-
-        $this->do_debug = 0;
+  /**
+   *  SMTP server port
+   *  @var int
+   */
+  var $SMTP_PORT = 25;
+
+  /**
+   *  SMTP reply line ending
+   *  @var string
+   */
+  var $CRLF = "\r\n";
+
+  /**
+   *  Sets whether debugging is turned on
+   *  @var bool
+   */
+  var $do_debug;       # the level of debug to perform
+
+  /**
+   *  Sets VERP use on/off (default is off)
+   *  @var bool
+   */
+  var $do_verp = false;
+
+  /**#@+
+   * @access private
+   */
+  var $smtp_conn;      # the socket to the server
+  var $error;          # error if any on the last call
+  var $helo_rply;      # the reply the server sent to us for HELO
+  /**#@-*/
+
+  /**
+   * Initialize the class so that the data is in a known state.
+   * @access public
+   * @return void
+   */
+  function SMTP() {
+    $this->smtp_conn = 0;
+    $this->error = null;
+    $this->helo_rply = null;
+
+    $this->do_debug = 0;
+  }
+
+  /*************************************************************
+   *                    CONNECTION FUNCTIONS                  *
+   ***********************************************************/
+
+  /**
+   * Connect to the server specified on the port specified.
+   * If the port is not specified use the default SMTP_PORT.
+   * If tval is specified then a connection will try and be
+   * established with the server for that number of seconds.
+   * If tval is not specified the default is 30 seconds to
+   * try on the connection.
+   *
+   * SMTP CODE SUCCESS: 220
+   * SMTP CODE FAILURE: 421
+   * @access public
+   * @return bool
+   */
+  function Connect($host,$port=0,$tval=30) {
+    # set the error val to null so there is no confusion
+    $this->error = null;
+
+    # make sure we are __not__ connected
+    if($this->connected()) {
+      # ok we are connected! what should we do?
+      # for now we will just give an error saying we
+      # are already connected
+      $this->error = array("error" => "Already connected to a server");
+      return false;
     }
 
     }
 
-    /*************************************************************
-     *                    CONNECTION FUNCTIONS                  *
-     ***********************************************************/
-
-    /**
-     * Connect to the server specified on the port specified.
-     * If the port is not specified use the default SMTP_PORT.
-     * If tval is specified then a connection will try and be
-     * established with the server for that number of seconds.
-     * If tval is not specified the default is 30 seconds to
-     * try on the connection.
-     *
-     * SMTP CODE SUCCESS: 220
-     * SMTP CODE FAILURE: 421
-     * @access public
-     * @return bool
-     */
-    function Connect($host,$port=0,$tval=30) {
-        # set the error val to null so there is no confusion
-        $this->error = null;
-
-        # make sure we are __not__ connected
-        if($this->connected()) {
-            # ok we are connected! what should we do?
-            # for now we will just give an error saying we
-            # are already connected
-            $this->error =
-                array("error" => "Already connected to a server");
-            return false;
-        }
-
-        if(empty($port)) {
-            $port = $this->SMTP_PORT;
-        }
-
-        #connect to the smtp server
-        $this->smtp_conn = fsockopen($host,    # the host of the server
-                                     $port,    # the port to use
-                                     $errno,   # error number if any
-                                     $errstr,  # error message if any
-                                     $tval);   # give up after ? secs
-        # verify we connected properly
-        if(empty($this->smtp_conn)) {
-            $this->error = array("error" => "Failed to connect to server",
-                                 "errno" => $errno,
-                                 "errstr" => $errstr);
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": $errstr ($errno)" . $this->CRLF;
-            }
-            return false;
-        }
+    if(empty($port)) {
+      $port = $this->SMTP_PORT;
+    }
 
 
-        # sometimes the SMTP server takes a little longer to respond
-        # so we will give it a longer timeout for the first read
-        // Windows still does not have support for this timeout function
-        if(substr(PHP_OS, 0, 3) != "WIN")
-           socket_set_timeout($this->smtp_conn, $tval, 0);
+    #connect to the smtp server
+    $this->smtp_conn = fsockopen($host,    # the host of the server
+                                 $port,    # the port to use
+                                 $errno,   # error number if any
+                                 $errstr,  # error message if any
+                                 $tval);   # give up after ? secs
+    # verify we connected properly
+    if(empty($this->smtp_conn)) {
+      $this->error = array("error" => "Failed to connect to server",
+                           "errno" => $errno,
+                           "errstr" => $errstr);
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": $errstr ($errno)" . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        # get any announcement stuff
-        $announce = $this->get_lines();
+    # sometimes the SMTP server takes a little longer to respond
+    # so we will give it a longer timeout for the first read
+    // Windows still does not have support for this timeout function
+    if(substr(PHP_OS, 0, 3) != "WIN")
+     socket_set_timeout($this->smtp_conn, $tval, 0);
 
 
-        # set the timeout  of any socket functions at 1/10 of a second
-        //if(function_exists("socket_set_timeout"))
-        //   socket_set_timeout($this->smtp_conn, 0, 100000);
+    # get any announcement stuff
+    $announce = $this->get_lines();
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
-        }
+    # set the timeout  of any socket functions at 1/10 of a second
+    //if(function_exists("socket_set_timeout"))
+    //   socket_set_timeout($this->smtp_conn, 0, 100000);
 
 
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
     }
 
     }
 
-    /**
-     * Performs SMTP authentication.  Must be run after running the
-     * Hello() method.  Returns true if successfully authenticated.
-     * @access public
-     * @return bool
-     */
-    function Authenticate($username, $password) {
-        // Start authentication
-        fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 334) {
-            $this->error =
-                array("error" => "AUTH not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-
-        // Send encoded username
-        fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 334) {
-            $this->error =
-                array("error" => "Username not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
+    return true;
+  }
+
+  /**
+   * Performs SMTP authentication.  Must be run after running the
+   * Hello() method.  Returns true if successfully authenticated.
+   * @access public
+   * @return bool
+   */
+  function Authenticate($username, $password) {
+    // Start authentication
+    fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "AUTH not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        // Send encoded password
-        fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($code != 235) {
-            $this->error =
-                array("error" => "Password not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
+    // Send encoded username
+    fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 334) {
+      $this->error =
+        array("error" => "Username not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        return true;
+    // Send encoded password
+    fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
+
+    if($code != 235) {
+      $this->error =
+        array("error" => "Password not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
     }
 
     }
 
-    /**
-     * Returns true if connected to a server otherwise false
-     * @access private
-     * @return bool
-     */
-    function Connected() {
-        if(!empty($this->smtp_conn)) {
-            $sock_status = socket_get_status($this->smtp_conn);
-            if($sock_status["eof"]) {
-                # hmm this is an odd situation... the socket is
-                # valid but we aren't connected anymore
-                if($this->do_debug >= 1) {
-                    echo "SMTP -> NOTICE:" . $this->CRLF .
-                         "EOF caught while checking if connected";
-                }
-                $this->Close();
-                return false;
-            }
-            return true; # everything looks good
+    return true;
+  }
+
+  /**
+   * Returns true if connected to a server otherwise false
+   * @access private
+   * @return bool
+   */
+  function Connected() {
+    if(!empty($this->smtp_conn)) {
+      $sock_status = socket_get_status($this->smtp_conn);
+      if($sock_status["eof"]) {
+        # hmm this is an odd situation... the socket is
+        # valid but we are not connected anymore
+        if($this->do_debug >= 1) {
+            echo "SMTP -> NOTICE:" . $this->CRLF .
+                 "EOF caught while checking if connected";
         }
         }
+        $this->Close();
         return false;
         return false;
+      }
+      return true; # everything looks good
     }
     }
-
-    /**
-     * Closes the socket and cleans up the state of the class.
-     * It is not considered good to use this function without
-     * first trying to use QUIT.
-     * @access public
-     * @return void
-     */
-    function Close() {
-        $this->error = null; # so there is no confusion
-        $this->helo_rply = null;
-        if(!empty($this->smtp_conn)) {
-            # close the connection and cleanup
-            fclose($this->smtp_conn);
-            $this->smtp_conn = 0;
-        }
+    return false;
+  }
+
+  /**
+   * Closes the socket and cleans up the state of the class.
+   * It is not considered good to use this function without
+   * first trying to use QUIT.
+   * @access public
+   * @return void
+   */
+  function Close() {
+    $this->error = null; # so there is no confusion
+    $this->helo_rply = null;
+    if(!empty($this->smtp_conn)) {
+      # close the connection and cleanup
+      fclose($this->smtp_conn);
+      $this->smtp_conn = 0;
+    }
+  }
+
+  /***************************************************************
+   *                        SMTP COMMANDS                       *
+   *************************************************************/
+
+  /**
+   * Issues a data command and sends the msg_data to the server
+   * finializing the mail transaction. $msg_data is the message
+   * that is to be send with the headers. Each header needs to be
+   * on a single line followed by a <CRLF> with the message headers
+   * and the message body being seperated by and additional <CRLF>.
+   *
+   * Implements rfc 821: DATA <CRLF>
+   *
+   * SMTP CODE INTERMEDIATE: 354
+   *     [data]
+   *     <CRLF>.<CRLF>
+   *     SMTP CODE SUCCESS: 250
+   *     SMTP CODE FAILURE: 552,554,451,452
+   * SMTP CODE FAILURE: 451,554
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  function Data($msg_data) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Data() without being connected");
+      return false;
     }
 
     }
 
+    fputs($this->smtp_conn,"DATA" . $this->CRLF);
 
 
-    /***************************************************************
-     *                        SMTP COMMANDS                       *
-     *************************************************************/
-
-    /**
-     * Issues a data command and sends the msg_data to the server
-     * finializing the mail transaction. $msg_data is the message
-     * that is to be send with the headers. Each header needs to be
-     * on a single line followed by a <CRLF> with the message headers
-     * and the message body being separated by and additional <CRLF>.
-     *
-     * Implements rfc 821: DATA <CRLF>
-     *
-     * SMTP CODE INTERMEDIATE: 354
-     *     [data]
-     *     <CRLF>.<CRLF>
-     *     SMTP CODE SUCCESS: 250
-     *     SMTP CODE FAILURE: 552,554,451,452
-     * SMTP CODE FAILURE: 451,554
-     * SMTP CODE ERROR  : 500,501,503,421
-     * @access public
-     * @return bool
-     */
-    function Data($msg_data) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Data() without being connected");
-            return false;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        fputs($this->smtp_conn,"DATA" . $this->CRLF);
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    if($code != 354) {
+      $this->error =
+        array("error" => "DATA command not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    # the server is ready to accept data!
+    # according to rfc 821 we should not send more than 1000
+    # including the CRLF
+    # characters on a single line so we will break the data up
+    # into lines by \r and/or \n then if needed we will break
+    # each of those into smaller lines to fit within the limit.
+    # in addition we will be looking for lines that start with
+    # a period '.' and append and additional period '.' to that
+    # line. NOTE: this does not count towards are limit.
+
+    # normalize the line breaks so we know the explode works
+    $msg_data = str_replace("\r\n","\n",$msg_data);
+    $msg_data = str_replace("\r","\n",$msg_data);
+    $lines = explode("\n",$msg_data);
+
+    # we need to find a good way to determine is headers are
+    # in the msg_data or if it is a straight msg body
+    # currently I am assuming rfc 822 definitions of msg headers
+    # and if the first field of the first line (':' sperated)
+    # does not contain a space then it _should_ be a header
+    # and we can process all lines before a blank "" line as
+    # headers.
+    $field = substr($lines[0],0,strpos($lines[0],":"));
+    $in_headers = false;
+    if(!empty($field) && !strstr($field," ")) {
+      $in_headers = true;
+    }
 
 
-        if($code != 354) {
-            $this->error =
-                array("error" => "DATA command not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
+    $max_line_length = 998; # used below; set here for ease in change
 
 
-        # the server is ready to accept data!
-        # according to rfc 821 we should not send more than 1000
-        # including the CRLF
-        # characters on a single line so we will break the data up
-        # into lines by \r and/or \n then if needed we will break
-        # each of those into smaller lines to fit within the limit.
-        # in addition we will be looking for lines that start with
-        # a period '.' and append and additional period '.' to that
-        # line. NOTE: this does not count towards are limit.
-
-        # normalize the line breaks so we know the explode works
-        $msg_data = str_replace("\r\n","\n",$msg_data);
-        $msg_data = str_replace("\r","\n",$msg_data);
-        $lines = explode("\n",$msg_data);
-
-        # we need to find a good way to determine is headers are
-        # in the msg_data or if it is a straight msg body
-        # currently I'm assuming rfc 822 definitions of msg headers
-        # and if the first field of the first line (':' sperated)
-        # does not contain a space then it _should_ be a header
-        # and we can process all lines before a blank "" line as
-        # headers.
-        $field = substr($lines[0],0,strpos($lines[0],":"));
+    while(list(,$line) = @each($lines)) {
+      $lines_out = null;
+      if($line == "" && $in_headers) {
         $in_headers = false;
         $in_headers = false;
-        if(!empty($field) && !strstr($field," ")) {
-            $in_headers = true;
+      }
+      # ok we need to break this line up into several
+      # smaller lines
+      while(strlen($line) > $max_line_length) {
+        $pos = strrpos(substr($line,0,$max_line_length)," ");
+
+        # Patch to fix DOS attack
+        if(!$pos) {
+          $pos = $max_line_length - 1;
         }
 
         }
 
-        $max_line_length = 998; # used below; set here for ease in change
-
-        while(list(,$line) = @each($lines)) {
-            $lines_out = null;
-            if($line == "" && $in_headers) {
-                $in_headers = false;
-            }
-            # ok we need to break this line up into several
-            # smaller lines
-            while(strlen($line) > $max_line_length) {
-                $pos = strrpos(substr($line,0,$max_line_length)," ");
-
-                # Patch to fix DOS attack
-                if(!$pos) {
-                    $pos = $max_line_length - 1;
-                }
-
-                $lines_out[] = substr($line,0,$pos);
-                $line = substr($line,$pos + 1);
-                # if we are processing headers we need to
-                # add a LWSP-char to the front of the new line
-                # rfc 822 on long msg headers
-                if($in_headers) {
-                    $line = "\t" . $line;
-                }
-            }
-            $lines_out[] = $line;
-
-            # now send the lines to the server
-            while(list(,$line_out) = @each($lines_out)) {
-                if(strlen($line_out) > 0)
-                {
-                    if(substr($line_out, 0, 1) == ".") {
-                        $line_out = "." . $line_out;
-                    }
-                }
-                fputs($this->smtp_conn,$line_out . $this->CRLF);
-            }
+        $lines_out[] = substr($line,0,$pos);
+        $line = substr($line,$pos + 1);
+        # if we are processing headers we need to
+        # add a LWSP-char to the front of the new line
+        # rfc 822 on long msg headers
+        if($in_headers) {
+          $line = "\t" . $line;
         }
         }
+      }
+      $lines_out[] = $line;
 
 
-        # ok all the message data has been sent so lets get this
-        # over with aleady
-        fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
-
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "DATA not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
+      # now send the lines to the server
+      while(list(,$line_out) = @each($lines_out)) {
+        if(strlen($line_out) > 0)
+        {
+          if(substr($line_out, 0, 1) == ".") {
+            $line_out = "." . $line_out;
+          }
         }
         }
-        return true;
+        fputs($this->smtp_conn,$line_out . $this->CRLF);
+      }
     }
 
     }
 
-    /**
-     * Expand takes the name and asks the server to list all the
-     * people who are members of the _list_. Expand will return
-     * back and array of the result or false if an error occurs.
-     * Each value in the array returned has the format of:
-     *     [ <full-name> <sp> ] <path>
-     * The definition of <path> is defined in rfc 821
-     *
-     * Implements rfc 821: EXPN <SP> <string> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE FAILURE: 550
-     * SMTP CODE ERROR  : 500,501,502,504,421
-     * @access public
-     * @return string array
-     */
-    function Expand($name) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Expand() without being connected");
-            return false;
-        }
+    # ok all the message data has been sent so lets get this
+    # over with aleady
+    fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
 
 
-        fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+    }
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    if($code != 250) {
+      $this->error =
+        array("error" => "DATA not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Expand takes the name and asks the server to list all the
+   * people who are members of the _list_. Expand will return
+   * back and array of the result or false if an error occurs.
+   * Each value in the array returned has the format of:
+   *     [ <full-name> <sp> ] <path>
+   * The definition of <path> is defined in rfc 821
+   *
+   * Implements rfc 821: EXPN <SP> <string> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE FAILURE: 550
+   * SMTP CODE ERROR  : 500,501,502,504,421
+   * @access public
+   * @return string array
+   */
+  function Expand($name) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+            "error" => "Called Expand() without being connected");
+      return false;
+    }
 
 
-        if($code != 250) {
-            $this->error =
-                array("error" => "EXPN not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
+    fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
 
 
-        # parse the reply and place in our array to return to user
-        $entries = explode($this->CRLF,$rply);
-        while(list(,$l) = @each($entries)) {
-            $list[] = substr($l,4);
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        return $list;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Sends the HELO command to the smtp server.
-     * This makes sure that we and the server are in
-     * the same known state.
-     *
-     * Implements from rfc 821: HELO <SP> <domain> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500, 501, 504, 421
-     * @access public
-     * @return bool
-     */
-    function Hello($host="") {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Hello() without being connected");
-            return false;
-        }
-
-        # if a hostname for the HELO wasn't specified determine
-        # a suitable one to send
-        if(empty($host)) {
-            # we need to determine some sort of appopiate default
-            # to send to the server
-            $host = "localhost";
-        }
+    if($code != 250) {
+      $this->error =
+        array("error" => "EXPN not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        // Send extended hello first (RFC 2821)
-        if(!$this->SendHello("EHLO", $host))
-        {
-            if(!$this->SendHello("HELO", $host))
-                return false;
-        }
+    # parse the reply and place in our array to return to user
+    $entries = explode($this->CRLF,$rply);
+    while(list(,$l) = @each($entries)) {
+      $list[] = substr($l,4);
+    }
 
 
-        return true;
+    return $list;
+  }
+
+  /**
+   * Sends the HELO command to the smtp server.
+   * This makes sure that we and the server are in
+   * the same known state.
+   *
+   * Implements from rfc 821: HELO <SP> <domain> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500, 501, 504, 421
+   * @access public
+   * @return bool
+   */
+  function Hello($host="") {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+            "error" => "Called Hello() without being connected");
+      return false;
     }
 
     }
 
-    /**
-     * Sends a HELO/EHLO command.
-     * @access private
-     * @return bool
-     */
-    function SendHello($hello, $host) {
-        fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+    # if a hostname for the HELO was not specified determine
+    # a suitable one to send
+    if(empty($host)) {
+      # we need to determine some sort of appopiate default
+      # to send to the server
+      $host = "localhost";
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    // Send extended hello first (RFC 2821)
+    if(!$this->SendHello("EHLO", $host))
+    {
+      if(!$this->SendHello("HELO", $host))
+          return false;
+    }
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
-        }
+    return true;
+  }
 
 
-        if($code != 250) {
-            $this->error =
-                array("error" => $hello . " not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
+  /**
+   * Sends a HELO/EHLO command.
+   * @access private
+   * @return bool
+   */
+  function SendHello($hello, $host) {
+    fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
 
 
-        $this->helo_rply = $rply;
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Gets help information on the keyword specified. If the keyword
-     * is not specified then returns generic help, ussually contianing
-     * A list of keywords that help is available on. This function
-     * returns the results back to the user. It is up to the user to
-     * handle the returned data. If an error occurs then false is
-     * returned with $this->error set appropiately.
-     *
-     * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
-     *
-     * SMTP CODE SUCCESS: 211,214
-     * SMTP CODE ERROR  : 500,501,502,504,421
-     * @access public
-     * @return string
-     */
-    function Help($keyword="") {
-        $this->error = null; # to avoid confusion
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Help() without being connected");
-            return false;
-        }
-
-        $extra = "";
-        if(!empty($keyword)) {
-            $extra = " " . $keyword;
-        }
+    if($code != 250) {
+      $this->error =
+        array("error" => $hello . " not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
+    $this->helo_rply = $rply;
+
+    return true;
+  }
+
+  /**
+   * Gets help information on the keyword specified. If the keyword
+   * is not specified then returns generic help, ussually contianing
+   * A list of keywords that help is available on. This function
+   * returns the results back to the user. It is up to the user to
+   * handle the returned data. If an error occurs then false is
+   * returned with $this->error set appropiately.
+   *
+   * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
+   *
+   * SMTP CODE SUCCESS: 211,214
+   * SMTP CODE ERROR  : 500,501,502,504,421
+   * @access public
+   * @return string
+   */
+  function Help($keyword="") {
+    $this->error = null; # to avoid confusion
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Help() without being connected");
+      return false;
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    $extra = "";
+    if(!empty($keyword)) {
+      $extra = " " . $keyword;
+    }
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
 
 
-        if($code != 211 && $code != 214) {
-            $this->error =
-                array("error" => "HELP not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        return $rply;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command.
-     *
-     * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,421
-     * @access public
-     * @return bool
-     */
-    function Mail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Mail() without being connected");
-            return false;
-        }
+    if($code != 211 && $code != 214) {
+      $this->error =
+        array("error" => "HELP not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $this->CRLF);
+    return $rply;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command.
+   *
+   * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,421
+   * @access public
+   * @return bool
+   */
+  function Mail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Mail() without being connected");
+      return false;
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    $useVerp = ($this->do_verp ? "XVERP" : "");
+    fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        if($code != 250) {
-            $this->error =
-                array("error" => "MAIL not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Sends the command NOOP to the SMTP server.
-     *
-     * Implements from rfc 821: NOOP <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500, 421
-     * @access public
-     * @return bool
-     */
-    function Noop() {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Noop() without being connected");
-            return false;
-        }
+    if($code != 250) {
+      $this->error =
+        array("error" => "MAIL not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the command NOOP to the SMTP server.
+   *
+   * Implements from rfc 821: NOOP <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500, 421
+   * @access public
+   * @return bool
+   */
+  function Noop() {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Noop() without being connected");
+      return false;
+    }
 
 
-        fputs($this->smtp_conn,"NOOP" . $this->CRLF);
+    fputs($this->smtp_conn,"NOOP" . $this->CRLF);
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
-
-        if($code != 250) {
-            $this->error =
-                array("error" => "NOOP not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Sends the quit command to the server and then closes the socket
-     * if there is no error or the $close_on_error argument is true.
-     *
-     * Implements from rfc 821: QUIT <CRLF>
-     *
-     * SMTP CODE SUCCESS: 221
-     * SMTP CODE ERROR  : 500
-     * @access public
-     * @return bool
-     */
-    function Quit($close_on_error=true) {
-        $this->error = null; # so there is no confusion
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Quit() without being connected");
-            return false;
-        }
-
-        # send the quit command to the server
-        fputs($this->smtp_conn,"quit" . $this->CRLF);
-
-        # get any good-bye messages
-        $byemsg = $this->get_lines();
+    if($code != 250) {
+      $this->error =
+        array("error" => "NOOP not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the quit command to the server and then closes the socket
+   * if there is no error or the $close_on_error argument is true.
+   *
+   * Implements from rfc 821: QUIT <CRLF>
+   *
+   * SMTP CODE SUCCESS: 221
+   * SMTP CODE ERROR  : 500
+   * @access public
+   * @return bool
+   */
+  function Quit($close_on_error=true) {
+    $this->error = null; # so there is no confusion
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Quit() without being connected");
+      return false;
+    }
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
-        }
+    # send the quit command to the server
+    fputs($this->smtp_conn,"quit" . $this->CRLF);
 
 
-        $rval = true;
-        $e = null;
-
-        $code = substr($byemsg,0,3);
-        if($code != 221) {
-            # use e as a tmp var cause Close will overwrite $this->error
-            $e = array("error" => "SMTP server rejected quit command",
-                       "smtp_code" => $code,
-                       "smtp_rply" => substr($byemsg,4));
-            $rval = false;
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $e["error"] . ": " .
-                         $byemsg . $this->CRLF;
-            }
-        }
+    # get any good-bye messages
+    $byemsg = $this->get_lines();
 
 
-        if(empty($e) || $close_on_error) {
-            $this->Close();
-        }
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
+    }
 
 
-        return $rval;
+    $rval = true;
+    $e = null;
+
+    $code = substr($byemsg,0,3);
+    if($code != 221) {
+      # use e as a tmp var cause Close will overwrite $this->error
+      $e = array("error" => "SMTP server rejected quit command",
+                 "smtp_code" => $code,
+                 "smtp_rply" => substr($byemsg,4));
+      $rval = false;
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $e["error"] . ": " .
+                 $byemsg . $this->CRLF;
+      }
     }
 
     }
 
-    /**
-     * Sends the command RCPT to the SMTP server with the TO: argument of $to.
-     * Returns true if the recipient was accepted false if it was rejected.
-     *
-     * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250,251
-     * SMTP CODE FAILURE: 550,551,552,553,450,451,452
-     * SMTP CODE ERROR  : 500,501,503,421
-     * @access public
-     * @return bool
-     */
-    function Recipient($to) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Recipient() without being connected");
-            return false;
-        }
+    if(empty($e) || $close_on_error) {
+      $this->Close();
+    }
 
 
-        fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+    return $rval;
+  }
+
+  /**
+   * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+   * Returns true if the recipient was accepted false if it was rejected.
+   *
+   * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250,251
+   * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+   * SMTP CODE ERROR  : 500,501,503,421
+   * @access public
+   * @return bool
+   */
+  function Recipient($to) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Recipient() without being connected");
+      return false;
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        if($code != 250 && $code != 251) {
-            $this->error =
-                array("error" => "RCPT not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Sends the RSET command to abort and transaction that is
-     * currently in progress. Returns true if successful false
-     * otherwise.
-     *
-     * Implements rfc 821: RSET <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE ERROR  : 500,501,504,421
-     * @access public
-     * @return bool
-     */
-    function Reset() {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Reset() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"RSET" . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    if($code != 250 && $code != 251) {
+      $this->error =
+        array("error" => "RCPT not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Sends the RSET command to abort and transaction that is
+   * currently in progress. Returns true if successful false
+   * otherwise.
+   *
+   * Implements rfc 821: RSET <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE ERROR  : 500,501,504,421
+   * @access public
+   * @return bool
+   */
+  function Reset() {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Reset() without being connected");
+      return false;
+    }
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    fputs($this->smtp_conn,"RSET" . $this->CRLF);
 
 
-        if($code != 250) {
-            $this->error =
-                array("error" => "RSET failed",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in.
-     *
-     * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function Send($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Send() without being connected");
-            return false;
-        }
+    if($code != 250) {
+      $this->error =
+        array("error" => "RSET failed",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
 
 
-        fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in.
+   *
+   * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function Send($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Send() without being connected");
+      return false;
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        if($code != 250) {
-            $this->error =
-                array("error" => "SEND not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in and send them an email.
-     *
-     * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function SendAndMail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                "error" => "Called SendAndMail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+    if($code != 250) {
+      $this->error =
+        array("error" => "SEND not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in and send them an email.
+   *
+   * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function SendAndMail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+          "error" => "Called SendAndMail() without being connected");
+      return false;
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        if($code != 250) {
-            $this->error =
-                array("error" => "SAML not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * Starts a mail transaction from the email address specified in
-     * $from. Returns true if successful or false otherwise. If True
-     * the mail transaction is started and then one or more Recipient
-     * commands may be called followed by a Data command. This command
-     * will send the message to the users terminal if they are logged
-     * in or mail it to them if they are not.
-     *
-     * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE SUCCESS: 552,451,452
-     * SMTP CODE SUCCESS: 500,501,502,421
-     * @access public
-     * @return bool
-     */
-    function SendOrMail($from) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                "error" => "Called SendOrMail() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
+    if($code != 250) {
+      $this->error =
+        array("error" => "SAML not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * Starts a mail transaction from the email address specified in
+   * $from. Returns true if successful or false otherwise. If True
+   * the mail transaction is started and then one or more Recipient
+   * commands may be called followed by a Data command. This command
+   * will send the message to the users terminal if they are logged
+   * in or mail it to them if they are not.
+   *
+   * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE SUCCESS: 552,451,452
+   * SMTP CODE SUCCESS: 500,501,502,421
+   * @access public
+   * @return bool
+   */
+  function SendOrMail($from) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+          "error" => "Called SendOrMail() without being connected");
+      return false;
+    }
 
 
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        if($code != 250) {
-            $this->error =
-                array("error" => "SOML not accepted from server",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return true;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /**
-     * This is an optional command for SMTP that this class does not
-     * support. This method is here to make the RFC821 Definition
-     * complete for this class and __may__ be implimented in the future
-     *
-     * Implements from rfc 821: TURN <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250
-     * SMTP CODE FAILURE: 502
-     * SMTP CODE ERROR  : 500, 503
-     * @access public
-     * @return bool
-     */
-    function Turn() {
-        $this->error = array("error" => "This method, TURN, of the SMTP ".
-                                        "is not implemented");
-        if($this->do_debug >= 1) {
-            echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
-        }
-        return false;
+    if($code != 250) {
+      $this->error =
+        array("error" => "SOML not accepted from server",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return true;
+  }
+
+  /**
+   * This is an optional command for SMTP that this class does not
+   * support. This method is here to make the RFC821 Definition
+   * complete for this class and __may__ be implimented in the future
+   *
+   * Implements from rfc 821: TURN <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250
+   * SMTP CODE FAILURE: 502
+   * SMTP CODE ERROR  : 500, 503
+   * @access public
+   * @return bool
+   */
+  function Turn() {
+    $this->error = array("error" => "This method, TURN, of the SMTP ".
+                                    "is not implemented");
+    if($this->do_debug >= 1) {
+      echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
+    }
+    return false;
+  }
+
+  /**
+   * Verifies that the name is recognized by the server.
+   * Returns false if the name could not be verified otherwise
+   * the response from the server is returned.
+   *
+   * Implements rfc 821: VRFY <SP> <string> <CRLF>
+   *
+   * SMTP CODE SUCCESS: 250,251
+   * SMTP CODE FAILURE: 550,551,553
+   * SMTP CODE ERROR  : 500,501,502,421
+   * @access public
+   * @return int
+   */
+  function Verify($name) {
+    $this->error = null; # so no confusion is caused
+
+    if(!$this->connected()) {
+      $this->error = array(
+              "error" => "Called Verify() without being connected");
+      return false;
     }
 
     }
 
-    /**
-     * Verifies that the name is recognized by the server.
-     * Returns false if the name could not be verified otherwise
-     * the response from the server is returned.
-     *
-     * Implements rfc 821: VRFY <SP> <string> <CRLF>
-     *
-     * SMTP CODE SUCCESS: 250,251
-     * SMTP CODE FAILURE: 550,551,553
-     * SMTP CODE ERROR  : 500,501,502,421
-     * @access public
-     * @return int
-     */
-    function Verify($name) {
-        $this->error = null; # so no confusion is caused
-
-        if(!$this->connected()) {
-            $this->error = array(
-                    "error" => "Called Verify() without being connected");
-            return false;
-        }
-
-        fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
-
-        $rply = $this->get_lines();
-        $code = substr($rply,0,3);
+    fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
 
 
-        if($this->do_debug >= 2) {
-            echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
-        }
+    $rply = $this->get_lines();
+    $code = substr($rply,0,3);
 
 
-        if($code != 250 && $code != 251) {
-            $this->error =
-                array("error" => "VRFY failed on name '$name'",
-                      "smtp_code" => $code,
-                      "smtp_msg" => substr($rply,4));
-            if($this->do_debug >= 1) {
-                echo "SMTP -> ERROR: " . $this->error["error"] .
-                         ": " . $rply . $this->CRLF;
-            }
-            return false;
-        }
-        return $rply;
+    if($this->do_debug >= 2) {
+      echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
     }
 
     }
 
-    /*******************************************************************
-     *                       INTERNAL FUNCTIONS                       *
-     ******************************************************************/
-
-    /**
-     * Read in as many lines as possible
-     * either before eof or socket timeout occurs on the operation.
-     * With SMTP we can tell if we have more lines to read if the
-     * 4th character is '-' symbol. If it is a space then we don't
-     * need to read anything else.
-     * @access private
-     * @return string
-     */
-    function get_lines() {
-        $data = "";
-        while($str = fgets($this->smtp_conn,515)) {
-            if($this->do_debug >= 4) {
-                echo "SMTP -> get_lines(): \$data was \"$data\"" .
-                         $this->CRLF;
-                echo "SMTP -> get_lines(): \$str is \"$str\"" .
-                         $this->CRLF;
-            }
-            $data .= $str;
-            if($this->do_debug >= 4) {
-                echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
-            }
-            # if the 4th character is a space then we are done reading
-            # so just break the loop
-            if(substr($str,3,1) == " ") { break; }
-        }
-        return $data;
+    if($code != 250 && $code != 251) {
+      $this->error =
+        array("error" => "VRFY failed on name '$name'",
+              "smtp_code" => $code,
+              "smtp_msg" => substr($rply,4));
+      if($this->do_debug >= 1) {
+        echo "SMTP -> ERROR: " . $this->error["error"] .
+                 ": " . $rply . $this->CRLF;
+      }
+      return false;
+    }
+    return $rply;
+  }
+
+  /*******************************************************************
+   *                       INTERNAL FUNCTIONS                       *
+   ******************************************************************/
+
+  /**
+   * Read in as many lines as possible
+   * either before eof or socket timeout occurs on the operation.
+   * With SMTP we can tell if we have more lines to read if the
+   * 4th character is '-' symbol. If it is a space then we don't
+   * need to read anything else.
+   * @access private
+   * @return string
+   */
+  function get_lines() {
+    $data = "";
+    while($str = @fgets($this->smtp_conn,515)) {
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data was \"$data\"" .
+                 $this->CRLF;
+        echo "SMTP -> get_lines(): \$str is \"$str\"" .
+                 $this->CRLF;
+      }
+      $data .= $str;
+      if($this->do_debug >= 4) {
+        echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
+      }
+      # if the 4th character is a space then we are done reading
+      # so just break the loop
+      if(substr($str,3,1) == " ") { break; }
     }
     }
+    return $data;
+  }
 
 }
 
 
 }
 
index 5ec5dce4d8c1dca0d39a4747fd3e6b62ef2bfeb2..b1b32d2faa9bbd82e8da6a7c161257de6864f02f 100644 (file)
@@ -1,22 +1,12 @@
 <?php
 <?php
-/**
- * Snoopy - the PHP net client
- * @author Monte Ohrt <monte@ispi.net>
- * @copyright 1999-2000 ispi, all rights reserved
- * @version 1.01
- * @license GNU Lesser GPL
- * @link http://snoopy.sourceforge.net/
- * @package Snoopy
- */
-
 if ( !in_array('Snoopy', get_declared_classes() ) ) :
 if ( !in_array('Snoopy', get_declared_classes() ) ) :
-/**
- * Snoopy - the PHP net client
- *
- * @author Monte Ohrt <monte@ispi.net>
- * @copyright (c): 1999-2000 ispi, all rights reserved
- * @version 1.01
- *
+/*************************************************
+
+Snoopy - the PHP net client
+Author: Monte Ohrt <monte@ispi.net>
+Copyright (c): 1999-2008 New Digital Group, all rights reserved
+Version: 1.2.4
+
  * This library 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; either
  * This library 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; either
@@ -30,19 +20,15 @@ if ( !in_array('Snoopy', get_declared_classes() ) ) :
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * You may contact the author of Snoopy by e-mail at:
- * monte@ispi.net
- *
- * Or, write to:
- * Monte Ohrt
- * CTO, ispi
- * 237 S. 70th suite 220
- * Lincoln, NE 68510
- *
- * @link http://snoopy.sourceforge.net/ The latest version of Snoopy can be
- *             obtained
- */
+
+You may contact the author of Snoopy by e-mail at:
+monte@ohrt.com
+
+The latest version of Snoopy can be obtained from:
+http://snoopy.sourceforge.net/
+
+*************************************************/
+
 class Snoopy
 {
        /**** Public variables ****/
 class Snoopy
 {
        /**** Public variables ****/
@@ -56,7 +42,7 @@ class Snoopy
        var $proxy_user         =       "";                                     // proxy user to use
        var $proxy_pass         =       "";                                     // proxy password to use
 
        var $proxy_user         =       "";                                     // proxy user to use
        var $proxy_pass         =       "";                                     // proxy password to use
 
-       var $agent                      =       "Snoopy v1.2.3";        // agent we masquerade as
+       var $agent                      =       "Snoopy v1.2.4";        // agent we masquerade as
        var     $referer                =       "";                                     // referer info to pass
        var $cookies            =       array();                        // array of cookies to pass
                                                                                                // $cookies["username"]="joe";
        var     $referer                =       "";                                     // referer info to pass
        var $cookies            =       array();                        // array of cookies to pass
                                                                                                // $cookies["username"]="joe";
@@ -85,7 +71,7 @@ class Snoopy
        var $error                      =       "";                                     // error messages sent here
        var     $response_code  =       "";                                     // response code returned from server
        var     $headers                =       array();                        // headers returned from server sent here
        var $error                      =       "";                                     // error messages sent here
        var     $response_code  =       "";                                     // response code returned from server
        var     $headers                =       array();                        // headers returned from server sent here
-       var     $maxlength              =       8192;                           // max return data length (body)
+       var     $maxlength              =       500000;                         // max return data length (body)
        var $read_timeout       =       0;                                      // timeout on read operations, in seconds
                                                                                                // supported only since PHP 4 Beta 4
                                                                                                // set to 0 to disallow timeouts
        var $read_timeout       =       0;                                      // timeout on read operations, in seconds
                                                                                                // supported only since PHP 4 Beta 4
                                                                                                // set to 0 to disallow timeouts
@@ -727,13 +713,13 @@ class Snoopy
                                                        chr(176),
                                                        chr(39),
                                                        chr(128),
                                                        chr(176),
                                                        chr(39),
                                                        chr(128),
-                                                       "ä",
-                                                       "ö",
-                                                       "ü",
-                                                       "Ä",
-                                                       "Ö",
-                                                       "Ãœ",
-                                                       "ß",
+                                                       "ä",
+                                                       "ö",
+                                                       "ü",
+                                                       "Ä",
+                                                       "Ö",
+                                                       "Ãœ",
+                                                       "ß",
                                                );
 
                $text = preg_replace($search,$replace,$document);
                                                );
 
                $text = preg_replace($search,$replace,$document);
@@ -1020,8 +1006,7 @@ class Snoopy
 
                $headerfile = tempnam($temp_dir, "sno");
 
 
                $headerfile = tempnam($temp_dir, "sno");
 
-               $safer_URI = strtr( $URI, "\"", " " ); // strip quotes from the URI to avoid shell access
-               exec(escapeshellcmd($this->curl_path." -D \"$headerfile\"".$cmdline_params." \"".$safer_URI."\""),$results,$return);
+               exec($this->curl_path." -k -D \"$headerfile\"".$cmdline_params." \"".escapeshellcmd($URI)."\"",$results,$return);
 
                if($return)
                {
 
                if($return)
                {
@@ -1245,9 +1230,7 @@ class Snoopy
                                                if (!is_readable($file_name)) continue;
 
                                                $fp = fopen($file_name, "r");
                                                if (!is_readable($file_name)) continue;
 
                                                $fp = fopen($file_name, "r");
-                                               while (!feof($fp)) {
-                                                       $file_content .= fread($fp, filesize($file_name));
-                                               }
+                                               $file_content = fread($fp, filesize($file_name));
                                                fclose($fp);
                                                $base_name = basename($file_name);
 
                                                fclose($fp);
                                                $base_name = basename($file_name);
 
@@ -1264,5 +1247,4 @@ class Snoopy
        }
 }
 endif;
        }
 }
 endif;
-
 ?>
 ?>
index 1f7bb8db20b9322ab52bc56851225778448e6285..e4c9c450b6711c29a1ca3bbb51db09f7cdd109ea 100644 (file)
@@ -1,5 +1,21 @@
 <?php
 <?php
-
+/**
+ * BackPress Scripts enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r74
+ */
+
+/**
+ * BackPress enqueued dependiences class.
+ *
+ * @package BackPress
+ * @uses _WP_Dependency
+ * @since r74
+ */
 class WP_Dependencies {
        var $registered = array();
        var $queue = array();
 class WP_Dependencies {
        var $registered = array();
        var $queue = array();
@@ -79,7 +95,7 @@ class WP_Dependencies {
                                        return false; // Abort this branch.
                                else
                                        continue; // We're at the top level.  Move on to the next one.
                                        return false; // Abort this branch.
                                else
                                        continue; // We're at the top level.  Move on to the next one.
-                       }                                       
+                       }
 
                        $this->to_do[$handle] = true;
                }
 
                        $this->to_do[$handle] = true;
                }
index 7652aecef75a594a16cff8bebc7d4d2b3dc2cfad..9b098aba1f9c38b2ee29a08c2c8a69250c7cb3ea 100644 (file)
@@ -1,5 +1,21 @@
 <?php
 <?php
-
+/**
+ * BackPress Scripts enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r16
+ */
+
+/**
+ * BackPress Scripts enqueue class.
+ *
+ * @package BackPress
+ * @uses WP_Dependencies
+ * @since r16
+ */
 class WP_Scripts extends WP_Dependencies {
        var $base_url; // Full URL with trailing slash
        var $default_version;
 class WP_Scripts extends WP_Dependencies {
        var $base_url; // Full URL with trailing slash
        var $default_version;
@@ -31,10 +47,15 @@ class WP_Scripts extends WP_Dependencies {
                echo "\t$object_name = {\n";
                $eol = '';
                foreach ( $this->registered[$handle]->extra['l10n'][1] as $var => $val ) {
                echo "\t$object_name = {\n";
                $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 ) . '"';
                        $eol = ",\n";
                }
                echo "\n\t}\n";
                        echo "$eol\t\t$var: \"" . js_escape( $val ) . '"';
                        $eol = ",\n";
                }
                echo "\n\t}\n";
+               echo isset($after) ? "\t$after\n" : '';
                echo "/* ]]> */\n";
                echo "</script>\n";
 
                echo "/* ]]> */\n";
                echo "</script>\n";
 
index 8533943c1f68c3dbfdc7a4a1ea3595cffea2850f..3caf63971ec06630c6434a739b958f2207511693 100644 (file)
@@ -1,5 +1,21 @@
 <?php
 <?php
-
+/**
+ * BackPress Styles enqueue.
+ *
+ * These classes were refactored from the WordPress WP_Scripts and WordPress
+ * script enqueue API.
+ *
+ * @package BackPress
+ * @since r74
+ */
+
+/**
+ * BackPress Styles enqueue class.
+ *
+ * @package BackPress
+ * @uses WP_Dependencies
+ * @since r74
+ */
 class WP_Styles extends WP_Dependencies {
        var $base_url;
        var $default_version;
 class WP_Styles extends WP_Dependencies {
        var $base_url;
        var $default_version;
index 3c3a4db89fd7e112f5b7fe69d2552f606bf9b3ca..4bcd9fe8f63ed140fe3d8f7ab6dd02a42753d4d7 100644 (file)
 <?php
 <?php
+/**
+ * Holds Most of the WordPress classes.
+ *
+ * Some of the other classes are contained in other files. For example, the
+ * WordPress cache is in cache.php and the WordPress roles API is in
+ * capabilities.php. The third party libraries are contained in their own
+ * separate files.
+ *
+ * @package WordPress
+ */
 
 
+/**
+ * WordPress environment setup class.
+ *
+ * @package WordPress
+ * @since 2.0.0
+ */
 class WP {
 class WP {
-       var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term');
-
-       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');
+       /**
+        * Public query variables.
+        *
+        * Long list of public query variables.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var array
+        */
+       var $public_query_vars = array('m', 'p', 'posts', 'w', 'cat', 'withcomments', 'withoutcomments', 's', 'search', 'exact', 'sentence', 'debug', 'calendar', 'page', 'paged', 'more', 'tb', 'pb', 'author', 'order', 'orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'tag', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup', 'attachment', 'attachment_id', 'subpost', 'subpost_id', 'preview', 'robots', 'taxonomy', 'term', 'cpage');
+
+       /**
+        * Private query variables.
+        *
+        * Long list of private query variables.
+        *
+        * @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');
+
+       /**
+        * Extra query variables set by the user.
+        *
+        * @since 2.1.0
+        * @var array
+        */
        var $extra_query_vars = array();
 
        var $extra_query_vars = array();
 
+       /**
+        * Query variables for setting up the WordPress Query Loop.
+        *
+        * @since 2.0.0
+        * @var array
+        */
        var $query_vars;
        var $query_vars;
+
+       /**
+        * String parsed to set the query variables.
+        *
+        * @since 2.0.0
+        * @var string
+        */
        var $query_string;
        var $query_string;
+
+       /**
+        * Permalink or requested URI.
+        *
+        * @since 2.0.0
+        * @var string
+        */
        var $request;
        var $request;
+
+       /**
+        * Rewrite rule the request matched.
+        *
+        * @since 2.0.0
+        * @var string
+        */
        var $matched_rule;
        var $matched_rule;
+
+       /**
+        * Rewrite query the request matched.
+        *
+        * @since 2.0.0
+        * @var string
+        */
        var $matched_query;
        var $matched_query;
+
+       /**
+        * Whether already did the permalink.
+        *
+        * @since 2.0.0
+        * @var bool
+        */
        var $did_permalink = false;
 
        var $did_permalink = false;
 
+       /**
+        * Add name to list of public query variables.
+        *
+        * @since 2.1.0
+        *
+        * @param string $qv Query variable name.
+        */
        function add_query_var($qv) {
                if ( !in_array($qv, $this->public_query_vars) )
                        $this->public_query_vars[] = $qv;
        }
 
        function add_query_var($qv) {
                if ( !in_array($qv, $this->public_query_vars) )
                        $this->public_query_vars[] = $qv;
        }
 
+       /**
+        * Set the value of a query variable.
+        *
+        * @since 2.3.0
+        *
+        * @param string $key Query variable name.
+        * @param mixed $value Query variable value.
+        */
        function set_query_var($key, $value) {
                $this->query_vars[$key] = $value;
        }
 
        function set_query_var($key, $value) {
                $this->query_vars[$key] = $value;
        }
 
+       /**
+        * Parse request to find correct WordPress query.
+        *
+        * Sets up the query variables based on the request. There are also many
+        * filters and actions that can be used to further manipulate the result.
+        *
+        * @since 2.0.0
+        *
+        * @param array|string $extra_query_vars Set the extra query variables.
+        */
        function parse_request($extra_query_vars = '') {
                global $wp_rewrite;
 
        function parse_request($extra_query_vars = '') {
                global $wp_rewrite;
 
@@ -90,7 +196,7 @@ class WP {
 
                        // Look for matches.
                        $request_match = $request;
 
                        // Look for matches.
                        $request_match = $request;
-                       foreach ($rewrite as $match => $query) {
+                       foreach ( (array) $rewrite as $match => $query) {
                                // Don't try to match against AtomPub calls
                                if ( $req_uri == 'wp-app.php' )
                                        break;
                                // Don't try to match against AtomPub calls
                                if ( $req_uri == 'wp-app.php' )
                                        break;
@@ -110,7 +216,8 @@ class WP {
                                        $query = preg_replace("!^.+\?!", '', $query);
 
                                        // Substitute the substring matches into the query.
                                        $query = preg_replace("!^.+\?!", '', $query);
 
                                        // Substitute the substring matches into the query.
-                                       eval("\$query = \"" . addslashes($query) . "\";");
+                                       eval("@\$query = \"" . addslashes($query) . "\";");
+
                                        $this->matched_query = $query;
 
                                        // Parse the query.
                                        $this->matched_query = $query;
 
                                        // Parse the query.
@@ -171,7 +278,7 @@ class WP {
                        }
                }
 
                        }
                }
 
-               foreach ($this->private_query_vars as $var) {
+               foreach ( (array) $this->private_query_vars as $var) {
                        if (isset($this->extra_query_vars[$var]))
                                $this->query_vars[$var] = $this->extra_query_vars[$var];
                        elseif (isset($GLOBALS[$var]) && '' != $GLOBALS[$var])
                        if (isset($this->extra_query_vars[$var]))
                                $this->query_vars[$var] = $this->extra_query_vars[$var];
                        elseif (isset($GLOBALS[$var]) && '' != $GLOBALS[$var])
@@ -186,6 +293,14 @@ class WP {
                do_action_ref_array('parse_request', array(&$this));
        }
 
                do_action_ref_array('parse_request', array(&$this));
        }
 
+       /**
+        * Send additional HTTP headers for caching, content type, etc.
+        *
+        * Sets the X-Pingback header, 404 status (if 404), Content-type. If showing
+        * a feed, it will also send last-modified, etag, and 304 status if needed.
+        *
+        * @since 2.0.0
+        */
        function send_headers() {
                @header('X-Pingback: '. get_bloginfo('pingback_url'));
                if ( is_user_logged_in() )
        function send_headers() {
                @header('X-Pingback: '. get_bloginfo('pingback_url'));
                if ( is_user_logged_in() )
@@ -240,9 +355,17 @@ class WP {
                do_action_ref_array('send_headers', array(&$this));
        }
 
                do_action_ref_array('send_headers', array(&$this));
        }
 
+       /**
+        * Sets the query string property based off of the query variable property.
+        *
+        * The 'query_string' filter is deprecated, but still works. Plugins should
+        * use the 'request' filter instead.
+        *
+        * @since 2.0.0
+        */
        function build_query_string() {
                $this->query_string = '';
        function build_query_string() {
                $this->query_string = '';
-               foreach (array_keys($this->query_vars) as $wpvar) {
+               foreach ( (array) array_keys($this->query_vars) as $wpvar) {
                        if ( '' != $this->query_vars[$wpvar] ) {
                                $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
                                if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars.
                        if ( '' != $this->query_vars[$wpvar] ) {
                                $this->query_string .= (strlen($this->query_string) < 1) ? '' : '&';
                                if ( !is_scalar($this->query_vars[$wpvar]) ) // Discard non-scalars.
@@ -258,10 +381,23 @@ class WP {
                }
        }
 
                }
        }
 
+       /**
+        * Setup the WordPress Globals.
+        *
+        * The query_vars property will be extracted to the GLOBALS. So care should
+        * be taken when naming global variables that might interfere with the
+        * WordPress environment.
+        *
+        * @global string $query_string Query string for the loop.
+        * @global int $more Only set, if single page or post.
+        * @global int $single If single page or post. Only set, if single page or post.
+        *
+        * @since 2.0.0
+        */
        function register_globals() {
                global $wp_query;
                // Extract updated query vars back into global namespace.
        function register_globals() {
                global $wp_query;
                // Extract updated query vars back into global namespace.
-               foreach ($wp_query->query_vars as $key => $value) {
+               foreach ( (array) $wp_query->query_vars as $key => $value) {
                        $GLOBALS[$key] = $value;
                }
 
                        $GLOBALS[$key] = $value;
                }
 
@@ -276,31 +412,66 @@ class WP {
                }
        }
 
                }
        }
 
+       /**
+        * Setup the current user.
+        *
+        * @since 2.0.0
+        */
        function init() {
                wp_get_current_user();
        }
 
        function init() {
                wp_get_current_user();
        }
 
+       /**
+        * Setup the Loop based on the query variables.
+        *
+        * @uses WP::$query_vars
+        * @since 2.0.0
+        */
        function query_posts() {
                global $wp_the_query;
                $this->build_query_string();
                $wp_the_query->query($this->query_vars);
        }
 
        function query_posts() {
                global $wp_the_query;
                $this->build_query_string();
                $wp_the_query->query($this->query_vars);
        }
 
+       /**
+        * Set the Headers for 404, if permalink is not found.
+        *
+        * Issue a 404 if a permalink request doesn't match any posts.  Don't issue
+        * a 404 if one was already issued, if the request was a search, or if the
+        * request was a regular query string request rather than a permalink
+        * request. Issues a 200, if not 404.
+        *
+        * @since 2.0.0
+        */
        function handle_404() {
                global $wp_query;
        function handle_404() {
                global $wp_query;
-               // Issue a 404 if a permalink request doesn't match any posts.  Don't
-               // issue a 404 if one was already issued, if the request was a search,
-               // or if the request was a regular query string request rather than a
-               // permalink request.
+
                if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
                if ( (0 == count($wp_query->posts)) && !is_404() && !is_search() && ( $this->did_permalink || (!empty($_SERVER['QUERY_STRING']) && (false === strpos($_SERVER['REQUEST_URI'], '?'))) ) ) {
+                       // Don't 404 for these queries if they matched an object.
+                       if ( ( is_tag() || is_category() || is_author() ) && $wp_query->get_queried_object() ) {
+                               if ( !is_404() )
+                                       status_header( 200 );
+                               return;
+                       }
                        $wp_query->set_404();
                        status_header( 404 );
                        nocache_headers();
                        $wp_query->set_404();
                        status_header( 404 );
                        nocache_headers();
-               }       elseif( is_404() != true ) {
+               } elseif ( !is_404() ) {
                        status_header( 200 );
                }
        }
 
                        status_header( 200 );
                }
        }
 
+       /**
+        * Sets up all of the variables required by the WordPress environment.
+        *
+        * The action 'wp' has one parameter that references the WP object. It
+        * allows for accessing the properties and methods to further manipulate the
+        * object.
+        *
+        * @since 2.0.0
+        *
+        * @param string|array $query_args Passed to {@link parse_request()}
+        */
        function main($query_args = '') {
                $this->init();
                $this->parse_request($query_args);
        function main($query_args = '') {
                $this->init();
                $this->parse_request($query_args);
@@ -311,15 +482,67 @@ class WP {
                do_action_ref_array('wp', array(&$this));
        }
 
                do_action_ref_array('wp', array(&$this));
        }
 
+       /**
+        * PHP4 Constructor - Does nothing.
+        *
+        * Call main() method when ready to run setup.
+        *
+        * @since 2.0.0
+        *
+        * @return WP
+        */
        function WP() {
                // Empty.
        }
 }
 
        function WP() {
                // Empty.
        }
 }
 
+/**
+ * WordPress Error class.
+ *
+ * Container for checking for WordPress errors and error messages. Return
+ * WP_Error and use {@link is_wp_error()} to check if this class is returned.
+ * Many core WordPress functions pass this class in the event of an error and
+ * if not handled properly will result in code errors.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
 class WP_Error {
 class WP_Error {
+       /**
+        * Stores the list of errors.
+        *
+        * @since 2.1.0
+        * @var array
+        * @access private
+        */
        var $errors = array();
        var $errors = array();
+
+       /**
+        * Stores the list of data for error codes.
+        *
+        * @since 2.1.0
+        * @var array
+        * @access private
+        */
        var $error_data = array();
 
        var $error_data = array();
 
+       /**
+        * PHP4 Constructor - Sets up error message.
+        *
+        * If code parameter is empty then nothing will be done. It is possible to
+        * add multiple messages to the same code, but with other methods in the
+        * class.
+        *
+        * All parameters are optional, but if the code parameter is set, then the
+        * data parameter is optional.
+        *
+        * @since 2.1.0
+        *
+        * @param string|int $code Error code
+        * @param string $message Error message
+        * @param mixed $data Optional. Error data.
+        * @return WP_Error
+        */
        function WP_Error($code = '', $message = '', $data = '') {
                if ( empty($code) )
                        return;
        function WP_Error($code = '', $message = '', $data = '') {
                if ( empty($code) )
                        return;
@@ -330,6 +553,14 @@ class WP_Error {
                        $this->error_data[$code] = $data;
        }
 
                        $this->error_data[$code] = $data;
        }
 
+       /**
+        * Retrieve all error codes.
+        *
+        * @since 2.1.0
+        * @access public
+        *
+        * @return array List of error codes, if avaiable.
+        */
        function get_error_codes() {
                if ( empty($this->errors) )
                        return array();
        function get_error_codes() {
                if ( empty($this->errors) )
                        return array();
@@ -337,6 +568,14 @@ class WP_Error {
                return array_keys($this->errors);
        }
 
                return array_keys($this->errors);
        }
 
+       /**
+        * Retrieve first error code available.
+        *
+        * @since 2.1.0
+        * @access public
+        *
+        * @return string|int Empty string, if no error codes.
+        */
        function get_error_code() {
                $codes = $this->get_error_codes();
 
        function get_error_code() {
                $codes = $this->get_error_codes();
 
@@ -346,11 +585,19 @@ class WP_Error {
                return $codes[0];
        }
 
                return $codes[0];
        }
 
+       /**
+        * Retrieve all error messages or error messages matching code.
+        *
+        * @since 2.1.0
+        *
+        * @param string|int $code Optional. Retrieve messages matching code, if exists.
+        * @return array Error strings on success, or empty array on failure (if using codee parameter).
+        */
        function get_error_messages($code = '') {
                // Return all messages if no code specified.
                if ( empty($code) ) {
                        $all_messages = array();
        function get_error_messages($code = '') {
                // Return all messages if no code specified.
                if ( empty($code) ) {
                        $all_messages = array();
-                       foreach ( $this->errors as $code => $messages )
+                       foreach ( (array) $this->errors as $code => $messages )
                                $all_messages = array_merge($all_messages, $messages);
 
                        return $all_messages;
                                $all_messages = array_merge($all_messages, $messages);
 
                        return $all_messages;
@@ -362,6 +609,17 @@ class WP_Error {
                        return array();
        }
 
                        return array();
        }
 
+       /**
+        * Get single error message.
+        *
+        * This will get the first message available for the code. If no code is
+        * given then the first code available will be used.
+        *
+        * @since 2.1.0
+        *
+        * @param string|int $code Optional. Error code to retrieve message.
+        * @return string
+        */
        function get_error_message($code = '') {
                if ( empty($code) )
                        $code = $this->get_error_code();
        function get_error_message($code = '') {
                if ( empty($code) )
                        $code = $this->get_error_code();
@@ -371,6 +629,14 @@ class WP_Error {
                return $messages[0];
        }
 
                return $messages[0];
        }
 
+       /**
+        * Retrieve error data for error code.
+        *
+        * @since 2.1.0
+        *
+        * @param string|int $code Optional. Error code.
+        * @return mixed Null, if no errors.
+        */
        function get_error_data($code = '') {
                if ( empty($code) )
                        $code = $this->get_error_code();
        function get_error_data($code = '') {
                if ( empty($code) )
                        $code = $this->get_error_code();
@@ -380,12 +646,32 @@ class WP_Error {
                return null;
        }
 
                return null;
        }
 
+       /**
+        * Append more error messages to list of error messages.
+        *
+        * @since 2.1.0
+        * @access public
+        *
+        * @param string|int $code Error code.
+        * @param string $message Error message.
+        * @param mixed $data Optional. Error data.
+        */
        function add($code, $message, $data = '') {
                $this->errors[$code][] = $message;
                if ( ! empty($data) )
                        $this->error_data[$code] = $data;
        }
 
        function add($code, $message, $data = '') {
                $this->errors[$code][] = $message;
                if ( ! empty($data) )
                        $this->error_data[$code] = $data;
        }
 
+       /**
+        * Add data for error code.
+        *
+        * The error code can only contain one error data.
+        *
+        * @since 2.1.0
+        *
+        * @param mixed $data Error data.
+        * @param string|int $code Error code.
+        */
        function add_data($data, $code = '') {
                if ( empty($code) )
                        $code = $this->get_error_code();
        function add_data($data, $code = '') {
                if ( empty($code) )
                        $code = $this->get_error_code();
@@ -394,64 +680,169 @@ class WP_Error {
        }
 }
 
        }
 }
 
+/**
+ * Check whether variable is a WordPress Error.
+ *
+ * Looks at the object and if a WP_Error class. Does not check to see if the
+ * parent is also WP_Error, so can't inherit WP_Error and still use this
+ * function.
+ *
+ * @since 2.1.0
+ *
+ * @param mixed $thing Check if unknown variable is WordPress Error object.
+ * @return bool True, if WP_Error. False, if not WP_Error.
+ */
 function is_wp_error($thing) {
        if ( is_object($thing) && is_a($thing, 'WP_Error') )
                return true;
        return false;
 }
 
 function is_wp_error($thing) {
        if ( is_object($thing) && is_a($thing, 'WP_Error') )
                return true;
        return false;
 }
 
-/*
+/**
  * A class for displaying various tree-like structures.
  * A class for displaying various tree-like structures.
- * Extend the Walker class to use it, see examples at the bottom
+ *
+ * Extend the Walker class to use it, see examples at the below. Child classes
+ * do not need to implement all of the abstract methods in the class. The child
+ * only needs to implement the methods that are needed. Also, the methods are
+ * not strictly abstract in that the parameter definition needs to be followed.
+ * The child classes can have additional parameters.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @abstract
  */
 class Walker {
  */
 class Walker {
+       /**
+        * What the class handles.
+        *
+        * @since 2.1.0
+        * @var string
+        * @access public
+        */
        var $tree_type;
        var $tree_type;
+
+       /**
+        * DB fields to use.
+        *
+        * @since 2.1.0
+        * @var array
+        * @access protected
+        */
        var $db_fields;
 
        var $db_fields;
 
-       //abstract callbacks
+       /**
+        * Max number of pages walked by the paged walker
+        *
+        * @since 2.7.0
+        * @var int
+        * @access protected
+        */
+       var $max_pages = 1;
+
+       /**
+        * Starts the list before the elements are added.
+        *
+        * Additional parameters are used in child classes. The args parameter holds
+        * additional values that may be used with the child class methods. This
+        * method is called at the start of the output list.
+        *
+        * @since 2.1.0
+        * @abstract
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        */
        function start_lvl(&$output) {}
        function start_lvl(&$output) {}
+
+       /**
+        * Ends the list of after the elements are added.
+        *
+        * Additional parameters are used in child classes. The args parameter holds
+        * additional values that may be used with the child class methods. This
+        * method finishes the list at the end of output of the elements.
+        *
+        * @since 2.1.0
+        * @abstract
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        */
        function end_lvl(&$output)   {}
        function end_lvl(&$output)   {}
+
+       /**
+        * Start the element output.
+        *
+        * Additional parameters are used in child classes. The args parameter holds
+        * additional values that may be used with the child class methods. Includes
+        * the element output also.
+        *
+        * @since 2.1.0
+        * @abstract
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        */
        function start_el(&$output)  {}
        function start_el(&$output)  {}
+
+       /**
+        * Ends the element output, if needed.
+        *
+        * Additional parameters are used in child classes. The args parameter holds
+        * additional values that may be used with the child class methods.
+        *
+        * @since 2.1.0
+        * @abstract
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        */
        function end_el(&$output)    {}
 
        function end_el(&$output)    {}
 
-       /*
-        * display one element if the element doesn't have any children
-        * otherwise, display the element and its children
-        */
+       /**
+        * Traverse elements to create list from elements.
+        *
+        * Display one element if the element doesn't have any children otherwise,
+        * display the element and its children. Will only traverse up to the max
+        * depth and no ignore elements under that depth. It is possible to set the
+        * max depth to include all depths, see walk() method.
+        *
+        * This method shouldn't be called directly, use the walk() method instead.
+        *
+        * @since 2.5.0
+        *
+        * @param object $element Data object
+        * @param array $children_elements List of elements to continue traversing.
+        * @param int $max_depth Max depth to traverse.
+        * @param int $depth Depth of current element.
+        * @param array $args
+        * @param string $output Passed by reference. Used to append additional content.
+        * @return null Null on failure with no changes to parameters.
+        */
        function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
 
                if ( !$element )
                        return;
 
                $id_field = $this->db_fields['id'];
        function display_element( $element, &$children_elements, $max_depth, $depth=0, $args, &$output ) {
 
                if ( !$element )
                        return;
 
                $id_field = $this->db_fields['id'];
-               $parent_field = $this->db_fields['parent'];
 
                //display this element
 
                //display this element
+               if ( is_array( $args[0] ) )
+                       $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] );
                $cb_args = array_merge( array(&$output, $element, $depth), $args);
                call_user_func_array(array(&$this, 'start_el'), $cb_args);
 
                $cb_args = array_merge( array(&$output, $element, $depth), $args);
                call_user_func_array(array(&$this, 'start_el'), $cb_args);
 
-               if ( $max_depth == 0 ||
-                    ($max_depth != 0 &&  $max_depth > $depth+1 )) { //whether to descend
-
-                       $num_elements = sizeof( $children_elements );
-                       for ( $i = 0; $i < $num_elements; $i++ ) {
+               $id = $element->$id_field;
 
 
-                               $child = $children_elements[$i];
-                               if ( $child->$parent_field == $element->$id_field ) {
+               // descend only when the depth is right and there are childrens for this element
+               if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) {
 
 
-                                       if ( !isset($newlevel) ) {
-                                               $newlevel = true;
-                                               //start the child delimiter
-                                               $cb_args = array_merge( array(&$output, $depth), $args);
-                                               call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
-                                       }
+                       foreach( $children_elements[ $id ] as $child ){
 
 
-                                       array_splice( $children_elements, $i, 1 );
-                                       $num_elements--;
-                                       $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
-                                       $i = -1;
+                               if ( !isset($newlevel) ) {
+                                       $newlevel = true;
+                                       //start the child delimiter
+                                       $cb_args = array_merge( array(&$output, $depth), $args);
+                                       call_user_func_array(array(&$this, 'start_lvl'), $cb_args);
                                }
                                }
+                               $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output );
                        }
                        }
+                       unset( $children_elements[ $id ] );
                }
 
                if ( isset($newlevel) && $newlevel ){
                }
 
                if ( isset($newlevel) && $newlevel ){
@@ -465,13 +856,20 @@ class Walker {
                call_user_func_array(array(&$this, 'end_el'), $cb_args);
        }
 
                call_user_func_array(array(&$this, 'end_el'), $cb_args);
        }
 
-       /*
-       * displays array of elements hierarchically
-       * it is a generic function which does not assume any existing order of elements
-       * max_depth = -1 means flatly display every element
-       * max_depth = 0  means display all levels
-       * max_depth > 0  specifies the number of display levels.
-       */
+       /**
+        * Display array of elements hierarchically.
+        *
+        * It is a generic function which does not assume any existing order of
+        * elements. max_depth = -1 means flatly display every element. max_depth =
+        * 0 means display all levels. max_depth > 0  specifies the number of
+        * display levels.
+        *
+        * @since 2.1.0
+        *
+        * @param array $elements
+        * @param int $max_depth
+        * @return string
+        */
        function walk( $elements, $max_depth) {
 
                $args = array_slice(func_get_args(), 2);
        function walk( $elements, $max_depth) {
 
                $args = array_slice(func_get_args(), 2);
@@ -496,7 +894,9 @@ class Walker {
 
                /*
                 * need to display in hierarchical order
 
                /*
                 * need to display in hierarchical order
-                * splice elements into two buckets: those without parent and those with parent
+                * seperate elements into two buckets: top level and children elements
+                * children_elements is two dimensional array, eg.
+                * children_elements[10][] contains all sub-elements whose parent is 10.
                 */
                $top_level_elements = array();
                $children_elements  = array();
                 */
                $top_level_elements = array();
                $children_elements  = array();
@@ -504,26 +904,25 @@ class Walker {
                        if ( 0 == $e->$parent_field )
                                $top_level_elements[] = $e;
                        else
                        if ( 0 == $e->$parent_field )
                                $top_level_elements[] = $e;
                        else
-                               $children_elements[] = $e;
+                               $children_elements[ $e->$parent_field ][] = $e;
                }
 
                /*
                }
 
                /*
-                * none of the elements is top level
-                * the first one must be root of the sub elements
+                * when none of the elements is top level
+                * assume the first one must be root of the sub elements
                 */
                 */
-               if ( !$top_level_elements ) {
-
-                       $root = $children_elements[0];
-                       $num_elements = sizeof($children_elements);
-                       for ( $i = 0; $i < $num_elements; $i++ ) {
-
-                               $child = $children_elements[$i];
-                               if ($root->$parent_field == $child->$parent_field ) {
-                                       $top_level_elements[] = $child;
-                                       array_splice( $children_elements, $i, 1 );
-                                       $num_elements--;
-                                       $i--;
-                               }
+               if ( empty($top_level_elements) ) {
+
+                       $first = array_slice( $elements, 0, 1 );
+                       $root = $first[0];
+
+                       $top_level_elements = array();
+                       $children_elements  = array();
+                       foreach ( $elements as $e) {
+                               if ( $root->$parent_field == $e->$parent_field )
+                                       $top_level_elements[] = $e;
+                               else
+                                       $children_elements[ $e->$parent_field ][] = $e;
                        }
                }
 
                        }
                }
 
@@ -531,33 +930,229 @@ class Walker {
                        $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
 
                /*
                        $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
 
                /*
-               * if we are displaying all levels, and remaining children_elements is not empty,
-               * then we got orphans, which should be displayed regardless
-               */
-               if ( ( $max_depth == 0 ) && sizeof( $children_elements ) > 0 ) {
+                * if we are displaying all levels, and remaining children_elements is not empty,
+                * then we got orphans, which should be displayed regardless
+                */
+               if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) {
                        $empty_array = array();
                        $empty_array = array();
-                       foreach ( $children_elements as $orphan_e )
-                               $this->display_element( $orphan_e, $empty_array, 1, 0, $args, $output );
+                       foreach ( $children_elements as $orphans )
+                               foreach( $orphans as $op )
+                                       $this->display_element( $op, $empty_array, 1, 0, $args, $output );
                 }
                 }
+
                 return $output;
        }
                 return $output;
        }
+
+       /**
+        * paged_walk() - produce a page of nested elements
+        *
+        * Given an array of hierarchical elements, the maximum depth, a specific page number,
+        * and number of elements per page, this function first determines all top level root elements
+        * belonging to that page, then lists them and all of their children in hierarchical order.
+        *
+        * @package WordPress
+        * @since 2.7
+        * @param $max_depth = 0  means display all levels; $max_depth > 0  specifies the number of display levels.
+        * @param $page_num the specific page number, beginning with 1.
+        * @return XHTML of the specified page of elements
+        */
+       function paged_walk( $elements, $max_depth, $page_num, $per_page ) {
+
+               /* sanity check */
+               if ( empty($elements) || $max_depth < -1 )
+                       return '';
+
+               $args = array_slice( func_get_args(), 4 );
+               $output = '';
+
+               $id_field = $this->db_fields['id'];
+               $parent_field = $this->db_fields['parent'];
+
+               $count = -1;
+               if ( -1 == $max_depth )
+                       $total_top = count( $elements );
+               if ( $page_num < 1 || $per_page < 0  ) {
+                       // No paging
+                       $paging = false;
+                       $start = 0;
+                       if ( -1 == $max_depth )
+                               $end = $total_top;
+                       $this->max_pages = 1;
+               } else {
+                       $paging = true;
+                       $start = ( (int)$page_num - 1 ) * (int)$per_page;
+                       $end   = $start + $per_page;
+                       if ( -1 == $max_depth )
+                               $this->max_pages = ceil($total_top / $per_page);
+               }
+
+               // flat display
+               if ( -1 == $max_depth ) {
+                       if ( !empty($args[0]['reverse_top_level']) ) {
+                               $elements = array_reverse( $elements );
+                               $oldstart = $start;
+                               $start = $total_top - $end;
+                               $end = $total_top - $oldstart;
+                       }
+
+                       $empty_array = array();
+                       foreach ( $elements as $e ) {
+                               $count++;
+                               if ( $count < $start )
+                                       continue;
+                               if ( $count >= $end )
+                                       break;
+                               $this->display_element( $e, $empty_array, 1, 0, $args, $output );
+                       }
+                       return $output;
+               }
+
+               /*
+                * seperate elements into two buckets: top level and children elements
+                * children_elements is two dimensional array, eg.
+                * children_elements[10][] contains all sub-elements whose parent is 10.
+                */
+               $top_level_elements = array();
+               $children_elements  = array();
+               foreach ( $elements as $e) {
+                       if ( 0 == $e->$parent_field )
+                               $top_level_elements[] = $e;
+                       else
+                               $children_elements[ $e->$parent_field ][] = $e;
+               }
+
+               $total_top = count( $top_level_elements );
+               if ( $paging )
+                       $this->max_pages = ceil($total_top / $per_page);
+               else
+                       $end = $total_top;
+
+               if ( !empty($args[0]['reverse_top_level']) ) {
+                       $top_level_elements = array_reverse( $top_level_elements );
+                       $oldstart = $start;
+                       $start = $total_top - $end;
+                       $end = $total_top - $oldstart;
+               }
+               if ( !empty($args[0]['reverse_children']) ) {
+                       foreach ( $children_elements as $parent => $children )
+                               $children_elements[$parent] = array_reverse( $children );
+               }
+
+               foreach ( $top_level_elements as $e ) {
+                       $count++;
+
+                       //for the last page, need to unset earlier children in order to keep track of orphans
+                       if ( $end >= $total_top && $count < $start )
+                                       $this->unset_children( $e, $children_elements );
+
+                       if ( $count < $start )
+                               continue;
+
+                       if ( $count >= $end )
+                               break;
+
+                       $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output );
+               }
+
+               if ( $end >= $total_top && count( $children_elements ) > 0 ) {
+                       $empty_array = array();
+                       foreach ( $children_elements as $orphans )
+                               foreach( $orphans as $op )
+                                       $this->display_element( $op, $empty_array, 1, 0, $args, $output );
+               }
+
+               return $output;
+       }
+
+       function get_number_of_root_elements( $elements ){
+
+               $num = 0;
+               $parent_field = $this->db_fields['parent'];
+
+               foreach ( $elements as $e) {
+                       if ( 0 == $e->$parent_field )
+                               $num++;
+               }
+               return $num;
+       }
+
+       // unset all the children for a given top level element
+       function unset_children( $e, &$children_elements ){
+
+               if ( !$e || !$children_elements )
+                       return;
+
+               $id_field = $this->db_fields['id'];
+               $id = $e->$id_field;
+
+               if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) )
+                       foreach ( (array) $children_elements[$id] as $child )
+                               $this->unset_children( $child, $children_elements );
+
+               if ( isset($children_elements[$id]) )
+                       unset( $children_elements[$id] );
+
+       }
 }
 
 }
 
+/**
+ * Create HTML list of pages.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @uses Walker
+ */
 class Walker_Page extends Walker {
 class Walker_Page extends Walker {
+       /**
+        * @see Walker::$tree_type
+        * @since 2.1.0
+        * @var string
+        */
        var $tree_type = 'page';
        var $tree_type = 'page';
-       var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
 
 
+       /**
+        * @see Walker::$db_fields
+        * @since 2.1.0
+        * @todo Decouple this.
+        * @var array
+        */
+       var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
+
+       /**
+        * @see Walker::start_lvl()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param int $depth Depth of page. Used for padding.
+        */
        function start_lvl(&$output, $depth) {
                $indent = str_repeat("\t", $depth);
                $output .= "\n$indent<ul>\n";
        }
 
        function start_lvl(&$output, $depth) {
                $indent = str_repeat("\t", $depth);
                $output .= "\n$indent<ul>\n";
        }
 
+       /**
+        * @see Walker::end_lvl()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param int $depth Depth of page. Used for padding.
+        */
        function end_lvl(&$output, $depth) {
                $indent = str_repeat("\t", $depth);
                $output .= "$indent</ul>\n";
        }
 
        function end_lvl(&$output, $depth) {
                $indent = str_repeat("\t", $depth);
                $output .= "$indent</ul>\n";
        }
 
-       function start_el(&$output, $page, $depth, $current_page, $args) {
+       /**
+        * @see Walker::start_el()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $page Page data object.
+        * @param int $depth Depth of page. Used for padding.
+        * @param int $current_page Page ID.
+        * @param array $args
+        */
+       function start_el(&$output, $page, $depth, $args, $current_page) {
                if ( $depth )
                        $indent = str_repeat("\t", $depth);
                else
                if ( $depth )
                        $indent = str_repeat("\t", $depth);
                else
@@ -567,15 +1162,17 @@ class Walker_Page extends Walker {
                $css_class = 'page_item page-item-'.$page->ID;
                if ( !empty($current_page) ) {
                        $_current_page = get_page( $current_page );
                $css_class = 'page_item page-item-'.$page->ID;
                if ( !empty($current_page) ) {
                        $_current_page = get_page( $current_page );
-                       if ( in_array($page->ID, (array) $_current_page->ancestors) )
+                       if ( isset($_current_page->ancestors) && in_array($page->ID, (array) $_current_page->ancestors) )
                                $css_class .= ' current_page_ancestor';
                        if ( $page->ID == $current_page )
                                $css_class .= ' current_page_item';
                        elseif ( $_current_page && $page->ID == $_current_page->post_parent )
                                $css_class .= ' current_page_parent';
                                $css_class .= ' current_page_ancestor';
                        if ( $page->ID == $current_page )
                                $css_class .= ' current_page_item';
                        elseif ( $_current_page && $page->ID == $_current_page->post_parent )
                                $css_class .= ' current_page_parent';
+               } elseif ( $page->ID == get_option('page_for_posts') ) {
+                       $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)) . '">' . apply_filters('the_title', $page->post_title) . '</a>';
+               $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>';
 
                if ( !empty($show_date) ) {
                        if ( 'modified' == $show_date )
 
                if ( !empty($show_date) ) {
                        if ( 'modified' == $show_date )
@@ -587,20 +1184,56 @@ class Walker_Page extends Walker {
                }
        }
 
                }
        }
 
+       /**
+        * @see Walker::end_el()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $page Page data object. Not used.
+        * @param int $depth Depth of page. Not Used.
+        */
        function end_el(&$output, $page, $depth) {
                $output .= "</li>\n";
        }
 
 }
 
        function end_el(&$output, $page, $depth) {
                $output .= "</li>\n";
        }
 
 }
 
+/**
+ * Create HTML dropdown list of pages.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @uses Walker
+ */
 class Walker_PageDropdown extends Walker {
 class Walker_PageDropdown extends Walker {
+       /**
+        * @see Walker::$tree_type
+        * @since 2.1.0
+        * @var string
+        */
        var $tree_type = 'page';
        var $tree_type = 'page';
-       var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
 
 
+       /**
+        * @see Walker::$db_fields
+        * @since 2.1.0
+        * @todo Decouple this
+        * @var array
+        */
+       var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
+
+       /**
+        * @see Walker::start_el()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $page Page data object.
+        * @param int $depth Depth of page in reference to parent pages. Used for padding.
+        * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
+        */
        function start_el(&$output, $page, $depth, $args) {
                $pad = str_repeat('&nbsp;', $depth * 3);
 
        function start_el(&$output, $page, $depth, $args) {
                $pad = str_repeat('&nbsp;', $depth * 3);
 
-               $output .= "\t<option value=\"$page->ID\"";
+               $output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
                if ( $page->ID == $args['selected'] )
                        $output .= ' selected="selected"';
                $output .= '>';
                if ( $page->ID == $args['selected'] )
                        $output .= ' selected="selected"';
                $output .= '>';
@@ -610,10 +1243,37 @@ class Walker_PageDropdown extends Walker {
        }
 }
 
        }
 }
 
+/**
+ * Create HTML list of categories.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @uses Walker
+ */
 class Walker_Category extends Walker {
 class Walker_Category extends Walker {
+       /**
+        * @see Walker::$tree_type
+        * @since 2.1.0
+        * @var string
+        */
        var $tree_type = 'category';
        var $tree_type = 'category';
-       var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
 
 
+       /**
+        * @see Walker::$db_fields
+        * @since 2.1.0
+        * @todo Decouple this
+        * @var array
+        */
+       var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+       /**
+        * @see Walker::start_lvl()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param int $depth Depth of category. Used for tab indentation.
+        * @param array $args Will only append content if style argument value is 'list'.
+        */
        function start_lvl(&$output, $depth, $args) {
                if ( 'list' != $args['style'] )
                        return;
        function start_lvl(&$output, $depth, $args) {
                if ( 'list' != $args['style'] )
                        return;
@@ -622,6 +1282,14 @@ class Walker_Category extends Walker {
                $output .= "$indent<ul class='children'>\n";
        }
 
                $output .= "$indent<ul class='children'>\n";
        }
 
+       /**
+        * @see Walker::end_lvl()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param int $depth Depth of category. Used for tab indentation.
+        * @param array $args Will only append content if style argument value is 'list'.
+        */
        function end_lvl(&$output, $depth, $args) {
                if ( 'list' != $args['style'] )
                        return;
        function end_lvl(&$output, $depth, $args) {
                if ( 'list' != $args['style'] )
                        return;
@@ -630,6 +1298,15 @@ class Walker_Category extends Walker {
                $output .= "$indent</ul>\n";
        }
 
                $output .= "$indent</ul>\n";
        }
 
+       /**
+        * @see Walker::start_el()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $category Category data object.
+        * @param int $depth Depth of category in reference to parents.
+        * @param array $args
+        */
        function start_el(&$output, $category, $depth, $args) {
                extract($args);
 
        function start_el(&$output, $category, $depth, $args) {
                extract($args);
 
@@ -695,6 +1372,15 @@ class Walker_Category extends Walker {
                }
        }
 
                }
        }
 
+       /**
+        * @see Walker::end_el()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $page Not used.
+        * @param int $depth Depth of category. Not used.
+        * @param array $args Only uses 'list' for whether should append to output.
+        */
        function end_el(&$output, $page, $depth, $args) {
                if ( 'list' != $args['style'] )
                        return;
        function end_el(&$output, $page, $depth, $args) {
                if ( 'list' != $args['style'] )
                        return;
@@ -704,15 +1390,43 @@ class Walker_Category extends Walker {
 
 }
 
 
 }
 
+/**
+ * Create HTML dropdown list of Categories.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ * @uses Walker
+ */
 class Walker_CategoryDropdown extends Walker {
 class Walker_CategoryDropdown extends Walker {
+       /**
+        * @see Walker::$tree_type
+        * @since 2.1.0
+        * @var string
+        */
        var $tree_type = 'category';
        var $tree_type = 'category';
-       var $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this
 
 
+       /**
+        * @see Walker::$db_fields
+        * @since 2.1.0
+        * @todo Decouple this
+        * @var array
+        */
+       var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+       /**
+        * @see Walker::start_el()
+        * @since 2.1.0
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $category Category data object.
+        * @param int $depth Depth of category. Used for padding.
+        * @param array $args Uses 'selected', 'show_count', and 'show_last_update' keys, if they exist.
+        */
        function start_el(&$output, $category, $depth, $args) {
                $pad = str_repeat('&nbsp;', $depth * 3);
 
                $cat_name = apply_filters('list_cats', $category->name, $category);
        function start_el(&$output, $category, $depth, $args) {
                $pad = str_repeat('&nbsp;', $depth * 3);
 
                $cat_name = apply_filters('list_cats', $category->name, $category);
-               $output .= "\t<option value=\"".$category->term_id."\"";
+               $output .= "\t<option class=\"level-$depth\" value=\"".$category->term_id."\"";
                if ( $category->term_id == $args['selected'] )
                        $output .= ' selected="selected"';
                $output .= '>';
                if ( $category->term_id == $args['selected'] )
                        $output .= ' selected="selected"';
                $output .= '>';
@@ -727,20 +1441,64 @@ class Walker_CategoryDropdown extends Walker {
        }
 }
 
        }
 }
 
+/**
+ * Send XML response back to AJAX request.
+ *
+ * @package WordPress
+ * @since 2.1.0
+ */
 class WP_Ajax_Response {
 class WP_Ajax_Response {
+       /**
+        * Store XML responses to send.
+        *
+        * @since 2.1.0
+        * @var array
+        * @access private
+        */
        var $responses = array();
 
        var $responses = array();
 
+       /**
+        * PHP4 Constructor - Passes args to {@link WP_Ajax_Response::add()}.
+        *
+        * @since 2.1.0
+        * @see WP_Ajax_Response::add()
+        *
+        * @param string|array $args Optional. Will be passed to add() method.
+        * @return WP_Ajax_Response
+        */
        function WP_Ajax_Response( $args = '' ) {
                if ( !empty($args) )
                        $this->add($args);
        }
 
        function WP_Ajax_Response( $args = '' ) {
                if ( !empty($args) )
                        $this->add($args);
        }
 
-       // a WP_Error object can be passed in 'id' or 'data'
+       /**
+        * Append to XML response based on given arguments.
+        *
+        * The arguments that can be passed in the $args parameter are below. It is
+        * also possible to pass a WP_Error object in either the 'id' or 'data'
+        * argument. The parameter isn't actually optional, content should be given
+        * in order to send the correct response.
+        *
+        * 'what' argument is a string that is the XMLRPC response type.
+        * 'action' argument is a boolean or string that acts like a nonce.
+        * 'id' argument can be WP_Error or an integer.
+        * 'old_id' argument is false by default or an integer of the previous ID.
+        * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
+        * html ID = after, -html ID = before.
+        * 'data' argument is a string with the content or message.
+        * 'supplemental' argument is an array of strings that will be children of
+        * the supplemental element.
+        *
+        * @since 2.1.0
+        *
+        * @param string|array $args Override defaults.
+        * @return string XML response.
+        */
        function add( $args = '' ) {
                $defaults = array(
                        'what' => 'object', 'action' => false,
                        'id' => '0', 'old_id' => false,
        function add( $args = '' ) {
                $defaults = array(
                        'what' => 'object', 'action' => false,
                        'id' => '0', 'old_id' => false,
-                       'position' => 1, // -1 = top, 1 = bottom, html ID = after, -html ID = before
+                       'position' => 1,
                        'data' => '', 'supplemental' => array()
                );
 
                        'data' => '', 'supplemental' => array()
                );
 
@@ -755,7 +1513,7 @@ class WP_Ajax_Response {
 
                $response = '';
                if ( is_wp_error($data) ) {
 
                $response = '';
                if ( is_wp_error($data) ) {
-                       foreach ( $data->get_error_codes() as $code ) {
+                       foreach ( (array) $data->get_error_codes() as $code ) {
                                $response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message($code) . "]]></wp_error>";
                                if ( !$error_data = $data->get_error_data($code) )
                                        continue;
                                $response .= "<wp_error code='$code'><![CDATA[" . $data->get_error_message($code) . "]]></wp_error>";
                                if ( !$error_data = $data->get_error_data($code) )
                                        continue;
@@ -781,7 +1539,7 @@ class WP_Ajax_Response {
                }
 
                $s = '';
                }
 
                $s = '';
-               if ( (array) $supplemental ) {
+               if ( is_array($supplemental) ) {
                        foreach ( $supplemental as $k => $v )
                                $s .= "<$k><![CDATA[$v]]></$k>";
                        $s = "<supplemental>$s</supplemental>";
                        foreach ( $supplemental as $k => $v )
                                $s .= "<$k><![CDATA[$v]]></$k>";
                        $s = "<supplemental>$s</supplemental>";
@@ -802,10 +1560,17 @@ class WP_Ajax_Response {
                return $x;
        }
 
                return $x;
        }
 
+       /**
+        * Display XML formatted responses.
+        *
+        * Sets the content type header to text/xml.
+        *
+        * @since 2.1.0
+        */
        function send() {
                header('Content-Type: text/xml');
                echo "<?xml version='1.0' standalone='yes'?><wp_ajax>";
        function send() {
                header('Content-Type: text/xml');
                echo "<?xml version='1.0' standalone='yes'?><wp_ajax>";
-               foreach ( $this->responses as $response )
+               foreach ( (array) $this->responses as $response )
                        echo $response;
                echo '</wp_ajax>';
                die();
                        echo $response;
                echo '</wp_ajax>';
                die();
index a04741739b2451c7e1b74c8c6a59e3190f6d477f..a4a126bc4f647e0f4dc5cc927801b137699b6db8 100644 (file)
  * If the comment has an empty comment_author field, then 'Anonymous' person is
  * assumed.
  *
  * If the comment has an empty comment_author field, then 'Anonymous' person is
  * assumed.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls 'get_comment_author' hook on the comment author
  *
  * @return string The comment author
  */
 function get_comment_author() {
        global $comment;
  * @uses apply_filters() Calls 'get_comment_author' hook on the comment author
  *
  * @return string The comment author
  */
 function get_comment_author() {
        global $comment;
-       if ( empty($comment->comment_author) )
-               $author = __('Anonymous');
-       else
+       if ( empty($comment->comment_author) ) {
+               if (!empty($comment->user_id)){
+                       $user=get_userdata($comment->user_id);
+                       $author=$user->user_login;
+               } else {
+                       $author = __('Anonymous');
+               }
+       } else {
                $author = $comment->comment_author;
                $author = $comment->comment_author;
+       }
        return apply_filters('get_comment_author', $author);
 }
 
        return apply_filters('get_comment_author', $author);
 }
 
@@ -42,7 +48,7 @@ function comment_author() {
 /**
  * Retrieve the email of the author of the current comment.
  *
 /**
  * Retrieve the email of the author of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email
  * @uses $comment
  *
  * @uses apply_filters() Calls the 'get_comment_author_email' hook on the comment author email
  * @uses $comment
  *
@@ -80,6 +86,7 @@ function comment_author_email() {
  *
  * @since 0.71
  * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email
  *
  * @since 0.71
  * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email
+ * @uses get_comment_author_email_link() For generating the link
  * @global object $comment The current Comment row object
  *
  * @param string $linktext The text to display instead of the comment author's email address
  * @global object $comment The current Comment row object
  *
  * @param string $linktext The text to display instead of the comment author's email address
@@ -87,20 +94,45 @@ function comment_author_email() {
  * @param string $after The text or HTML to display after the email link.
  */
 function comment_author_email_link($linktext='', $before='', $after='') {
  * @param string $after The text or HTML to display after the email link.
  */
 function comment_author_email_link($linktext='', $before='', $after='') {
+       if ( $link = get_comment_author_email_link( $linktext, $before, $after ) )
+               echo $link;
+}
+
+/**
+ * Return the html email link to the author of the current comment.
+ *
+ * Care should be taken to protect the email address and assure that email
+ * harvesters do not capture your commentors' email address. Most assume that
+ * their email address will not appear in raw form on the blog. Doing so will
+ * enable anyone, including those that people don't want to get the email
+ * address and use it for their own means good and bad.
+ *
+ * @since 2.7
+ * @uses apply_filters() Calls 'comment_email' hook for the display of the comment author's email
+ * @global object $comment The current Comment row object
+ *
+ * @param string $linktext The text to display instead of the comment author's email address
+ * @param string $before The text or HTML to display before the email link.
+ * @param string $after The text or HTML to display after the email link.
+ */
+function get_comment_author_email_link($linktext='', $before='', $after='') {
        global $comment;
        $email = apply_filters('comment_email', $comment->comment_author_email);
        if ((!empty($email)) && ($email != '@')) {
        $display = ($linktext != '') ? $linktext : $email;
        global $comment;
        $email = apply_filters('comment_email', $comment->comment_author_email);
        if ((!empty($email)) && ($email != '@')) {
        $display = ($linktext != '') ? $linktext : $email;
-               echo $before;
-               echo "<a href='mailto:$email'>$display</a>";
-               echo $after;
+               $return  = $before;
+               $return .= "<a href='mailto:$email'>$display</a>";
+               $return .= $after;
+               return $return;
+       } else {
+               return '';
        }
 }
 
 /**
  * Retrieve the html link to the url of the author of the current comment.
  *
        }
 }
 
 /**
  * Retrieve the html link to the url of the author of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author
  *
  * @return string Comment Author name or HTML link for author's URL
  * @uses apply_filters() Calls 'get_comment_author_link' hook on the complete link HTML or author
  *
  * @return string Comment Author name or HTML link for author's URL
@@ -113,7 +145,7 @@ function get_comment_author_link() {
        if ( empty( $url ) || 'http://' == $url )
                $return = $author;
        else
        if ( empty( $url ) || 'http://' == $url )
                $return = $author;
        else
-               $return = "<a href='$url' rel='external nofollow'>$author</a>";
+               $return = "<a href='$url' rel='external nofollow' class='url'>$author</a>";
        return apply_filters('get_comment_author_link', $return);
 }
 
        return apply_filters('get_comment_author_link', $return);
 }
 
@@ -130,7 +162,7 @@ function comment_author_link() {
 /**
  * Retrieve the IP address of the author of the current comment.
  *
 /**
  * Retrieve the IP address of the author of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $comment
  * @uses apply_filters()
  *
  * @uses $comment
  * @uses apply_filters()
  *
@@ -154,7 +186,7 @@ function comment_author_IP() {
 /**
  * Retrieve the url of the author of the current comment.
  *
 /**
  * Retrieve the url of the author of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL
  *
  * @return string
  * @uses apply_filters() Calls 'get_comment_author_url' hook on the comment author's URL
  *
  * @return string
@@ -185,7 +217,7 @@ function comment_author_url() {
  * Encapsulate the HTML link between the $before and $after. So it will appear
  * in the order of $before, link, and finally $after.
  *
  * Encapsulate the HTML link between the $before and $after. So it will appear
  * in the order of $before, link, and finally $after.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls the 'get_comment_author_url_link' on the complete HTML before returning.
  *
  * @param string $linktext The text to display instead of the comment author's email address
  * @uses apply_filters() Calls the 'get_comment_author_url_link' on the complete HTML before returning.
  *
  * @param string $linktext The text to display instead of the comment author's email address
@@ -218,10 +250,98 @@ function comment_author_url_link( $linktext = '', $before = '', $after = '' ) {
        echo get_comment_author_url_link( $linktext, $before, $after );
 }
 
        echo get_comment_author_url_link( $linktext, $before, $after );
 }
 
+/**
+ * Generates semantic classes for each comment element
+ *
+ * @since 2.7.0
+ *
+ * @param string|array $class One or more classes to add to the class list
+ * @param int $comment_id An optional comment ID
+ * @param int $post_id An optional post ID
+ * @param bool $echo Whether comment_class should echo or return
+ */
+function comment_class( $class = '', $comment_id = null, $post_id = null, $echo = true ) {
+       // Separates classes with a single space, collates classes for comment DIV
+       $class = 'class="' . join( ' ', get_comment_class( $class, $comment_id, $post_id ) ) . '"';
+       if ( $echo)
+               echo $class;
+       else
+               return $class;
+}
+
+/**
+ * Returns the classes for the comment div as an array
+ *
+ * @since 2.7.0
+ *
+ * @param string|array $class One or more classes to add to the class list
+ * @param int $comment_id An optional comment ID
+ * @param int $post_id An optional post ID
+ * @return array Array of classes
+ */
+function get_comment_class( $class = '', $comment_id = null, $post_id = null ) {
+       global $comment_alt, $comment_depth, $comment_thread_alt;
+
+       $comment = get_comment($comment_id);
+
+       $classes = array();
+
+       // Get the comment type (comment, trackback),
+       $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
+
+       // 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;
+               // For comment authors who are the author of the post
+               if ( $post = get_post($post_id) ) {
+                       if ( $comment->user_id === $post->post_author )
+                               $classes[] = 'bypostauthor';
+               }
+       }
+
+       if ( empty($comment_alt) )
+               $comment_alt = 0;
+       if ( empty($comment_depth) )
+               $comment_depth = 1;
+       if ( empty($comment_thread_alt) )
+               $comment_thread_alt = 0;
+
+       if ( $comment_alt % 2 ) {
+               $classes[] = 'odd';
+               $classes[] = 'alt';
+       } else {
+               $classes[] = 'even';
+       }
+
+       $comment_alt++;
+
+       // Alt for top-level comments
+       if ( 1 == $comment_depth ) {
+               if ( $comment_thread_alt % 2 ) {
+                       $classes[] = 'thread-odd';
+                       $classes[] = 'thread-alt';
+               } else {
+                       $classes[] = 'thread-even';
+               }
+               $comment_thread_alt++;
+       }
+
+       $classes[] = "depth-$comment_depth";
+
+       if ( !empty($class) ) {
+               if ( !is_array( $class ) )
+                       $class = preg_split('#\s+#', $class);
+               $classes = array_merge($classes, $class);
+       }
+
+       return apply_filters('comment_class', $classes, $class, $comment_id, $post_id);
+}
+
 /**
  * Retrieve the comment date of the current comment.
  *
 /**
  * Retrieve the comment date of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively
  * @uses $comment
  *
  * @uses apply_filters() Calls 'get_comment_date' hook with the formated date and the $d parameter respectively
  * @uses $comment
  *
@@ -255,7 +375,7 @@ function comment_date( $d = '' ) {
  * If the word count is less than 20, then no truncating is done and no '...'
  * will appear.
  *
  * If the word count is less than 20, then no truncating is done and no '...'
  * will appear.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $comment
  * @uses apply_filters() Calls 'get_comment_excerpt' on truncated comment
  *
  * @uses $comment
  * @uses apply_filters() Calls 'get_comment_excerpt' on truncated comment
  *
@@ -283,7 +403,7 @@ function get_comment_excerpt() {
 /**
  * Display the excerpt of the current comment.
  *
 /**
  * Display the excerpt of the current comment.
  *
- * @since 1.2
+ * @since 1.2.0
  * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt
  */
 function comment_excerpt() {
  * @uses apply_filters() Calls 'comment_excerpt' hook before displaying excerpt
  */
 function comment_excerpt() {
@@ -293,7 +413,7 @@ function comment_excerpt() {
 /**
  * Retrieve the comment id of the current comment.
  *
 /**
  * Retrieve the comment id of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $comment
  * @uses apply_filters() Calls the 'get_comment_ID' hook for the comment ID
  *
  * @uses $comment
  * @uses apply_filters() Calls the 'get_comment_ID' hook for the comment ID
  *
@@ -315,22 +435,55 @@ function comment_ID() {
 }
 
 /**
 }
 
 /**
- * Retrieve the link to the current comment.
+ * Retrieve the link to a given comment.
  *
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $comment
  *
  * @uses $comment
  *
+ * @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 current comment
  */
-function get_comment_link() {
-       global $comment;
-       return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
+function get_comment_link( $comment = null, $args = array() ) {
+       global $wp_rewrite, $in_comment_loop;
+
+       $comment = get_comment($comment);
+
+       // Backwards compat
+       if ( !is_array($args) ) {
+               $page = $args;
+               $args = array();
+               $args['page'] = $page;
+       }
+
+       $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
+       $args = wp_parse_args( $args, $defaults );
+
+       if ( '' === $args['per_page'] && get_option('page_comments') )
+               $args['per_page'] = get_option('comments_per_page');
+
+       if ( empty($args['per_page']) ) {
+               $args['per_page'] = 0;
+               $args['page'] = 0;
+       }
+
+       if ( $args['per_page'] ) {
+               if ( '' == $args['page'] )
+                       $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;
+               else
+                       return add_query_arg( 'cpage', $args['page'], get_permalink( $comment->comment_post_ID ) ) . '#comment-' . $comment->comment_ID;
+       } else {
+               return get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
+       }
 }
 
 /**
  * Retrieves the link to the current post comments.
  *
 }
 
 /**
  * Retrieves the link to the current post comments.
  *
- * @since 1.5
+ * @since 1.5.0
  *
  * @return string The link to the comments
  */
  *
  * @return string The link to the comments
  */
@@ -353,7 +506,7 @@ function comments_link( $deprecated = '', $deprecated = '' ) {
 /**
  * Retrieve the amount of comments a post has.
  *
 /**
  * Retrieve the amount of comments a post has.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls the 'get_comments_number' hook on the number of comments
  *
  * @param int $post_id The Post ID
  * @uses apply_filters() Calls the 'get_comments_number' hook on the number of comments
  *
  * @param int $post_id The Post ID
@@ -404,7 +557,7 @@ function comments_number( $zero = false, $one = false, $more = false, $deprecate
 /**
  * Retrieve the text of the current comment.
  *
 /**
  * Retrieve the text of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $comment
  *
  * @return string The comment content
  * @uses $comment
  *
  * @return string The comment content
@@ -428,7 +581,7 @@ function comment_text() {
 /**
  * Retrieve the comment time of the current comment.
  *
 /**
  * Retrieve the comment time of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $comment
  * @uses apply_filter() Calls 'get_comment_time' hook with the formatted time, the $d parameter, and $gmt parameter passed.
  *
  * @uses $comment
  * @uses apply_filter() Calls 'get_comment_time' hook with the formatted time, the $d parameter, and $gmt parameter passed.
  *
@@ -460,7 +613,7 @@ function comment_time( $d = '' ) {
 /**
  * Retrieve the comment type of the current comment.
  *
 /**
  * Retrieve the comment type of the current comment.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $comment
  * @uses apply_filters() Calls the 'get_comment_type' hook on the comment type
  *
  * @uses $comment
  * @uses apply_filters() Calls the 'get_comment_type' hook on the comment type
  *
@@ -505,7 +658,7 @@ function comment_type($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pin
  * retrieve the pretty path. If permalinks weren't enabled, the ID of the
  * current post is used and appended to the correct page to go to.
  *
  * retrieve the pretty path. If permalinks weren't enabled, the ID of the
  * current post is used and appended to the correct page to go to.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
  * @uses $id
  *
  * @uses apply_filters() Calls 'trackback_url' on the resulting trackback URL
  * @uses $id
  *
@@ -562,7 +715,7 @@ function trackback_rdf($deprecated = '') {
 /**
  * Whether the current post is open for comments.
  *
 /**
  * Whether the current post is open for comments.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $post
  *
  * @param int $post_id An optional post ID to check instead of the current post.
  * @uses $post
  *
  * @param int $post_id An optional post ID to check instead of the current post.
@@ -579,7 +732,7 @@ function comments_open( $post_id=NULL ) {
 /**
  * Whether the current post is open for pings.
  *
 /**
  * Whether the current post is open for pings.
  *
- * @since 1.5
+ * @since 1.5.0
  * @uses $post
  *
  * @param int $post_id An optional post ID to check instead of the current post.
  * @uses $post
  *
  * @param int $post_id An optional post ID to check instead of the current post.
@@ -603,14 +756,20 @@ function pings_open( $post_id = NULL ) {
  * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in
  * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
  *
  * above. Does not exist in versions prior to 2.0.10 in the 2.0 branch and in
  * the 2.1 branch, prior to 2.1.3. Technically added in 2.2.0.
  *
- * @since 2.0.10 Backported to 2.0 branch
+ * Backported to 2.0.10.
+ *
  * @since 2.1.3
  * @uses $post Gets the ID of the current post for the token
  */
 function wp_comment_form_unfiltered_html_nonce() {
        global $post;
  * @since 2.1.3
  * @uses $post Gets the ID of the current post for the token
  */
 function wp_comment_form_unfiltered_html_nonce() {
        global $post;
+
+       $post_id = 0;
+       if ( !empty($post) )
+               $post_id = $post->ID;
+
        if ( current_user_can('unfiltered_html') )
        if ( current_user_can('unfiltered_html') )
-               wp_nonce_field('unfiltered-html-comment_' . $post->ID, '_wp_unfiltered_html_comment', false);
+               wp_nonce_field('unfiltered-html-comment_' . $post_id, '_wp_unfiltered_html_comment', false);
 }
 
 /**
 }
 
 /**
@@ -629,7 +788,7 @@ function wp_comment_form_unfiltered_html_nonce() {
  * default theme. If either does not exist, then the WordPress process will be
  * halted. It is advised for that reason, that the default theme is not deleted.
  *
  * default theme. If either does not exist, then the WordPress process will be
  * halted. It is advised for that reason, that the default theme is not deleted.
  *
- * @since 1.5
+ * @since 1.5.0
  * @global array $comment List of comment objects for the current post
  * @uses $wpdb
  * @uses $id
  * @global array $comment List of comment objects for the current post
  * @uses $wpdb
  * @uses $id
@@ -637,14 +796,18 @@ function wp_comment_form_unfiltered_html_nonce() {
  * @uses $withcomments Will not try to get the comments if the post has none.
  *
  * @param string $file Optional, default '/comments.php'. The file to load
  * @uses $withcomments Will not try to get the comments if the post has none.
  *
  * @param string $file Optional, default '/comments.php'. The file to load
+ * @param bool $separate_comments Optional, whether to separate the comments by comment type. Default is false.
  * @return null Returns null if no comments appear
  */
  * @return null Returns null if no comments appear
  */
-function comments_template( $file = '/comments.php' ) {
-       global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity;
+function comments_template( $file = '/comments.php', $separate_comments = false ) {
+       global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity, $overridden_cpage;
 
        if ( ! (is_single() || is_page() || $withcomments) )
                return;
 
 
        if ( ! (is_single() || is_page() || $withcomments) )
                return;
 
+       if ( empty($file) )
+               $file = '/comments.php';
+
        $req = get_option('require_name_email');
        $commenter = wp_get_current_commenter();
        extract($commenter, EXTR_SKIP);
        $req = get_option('require_name_email');
        $commenter = wp_get_current_commenter();
        extract($commenter, EXTR_SKIP);
@@ -658,17 +821,32 @@ function comments_template( $file = '/comments.php' ) {
                $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", $post->ID, $comment_author, $comment_author_email));
        }
 
-       // keep $comments for legacy's sake (remember $table*? ;) )
-       $comments = $wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );
+       // keep $comments for legacy's sake
+       $wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );
+       $comments = &$wp_query->comments;
        $wp_query->comment_count = count($wp_query->comments);
        $wp_query->comment_count = count($wp_query->comments);
-       update_comment_cache($comments);
+       update_comment_cache($wp_query->comments);
+
+       if ( $separate_comments ) {
+               $wp_query->comments_by_type = &separate_comments($comments);
+               $comments_by_type = &$wp_query->comments_by_type;
+       }
+
+       $overridden_cpage = FALSE;
+       if ( '' == get_query_var('cpage') && get_option('page_comments') ) {
+               set_query_var( 'cpage', 'newest' == get_option('default_comments_page') ? get_comment_pages_count() : 1 );
+               $overridden_cpage = TRUE;
+       }
 
        define('COMMENTS_TEMPLATE', true);
 
        define('COMMENTS_TEMPLATE', true);
-       $include = apply_filters('comments_template', TEMPLATEPATH . $file );
+
+       $include = apply_filters('comments_template', STYLESHEETPATH . $file );
        if ( file_exists( $include ) )
                require( $include );
        if ( file_exists( $include ) )
                require( $include );
+       elseif ( file_exists( TEMPLATEPATH . $file ) )
+               require( TEMPLATEPATH .  $file );
        else
        else
-               require( WP_CONTENT_DIR . '/themes/default/comments.php');
+               require( get_theme_root() . '/default/comments.php');
 }
 
 /**
 }
 
 /**
@@ -734,11 +912,9 @@ function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more =
                return;
        }
 
                return;
        }
 
-       if ( !empty($post->post_password) ) { // if there's a password
-               if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) || $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password ) {  // and it doesn't match the cookie
-                       echo __('Enter your password to view comments');
-                       return;
-               }
+       if ( post_password_required() ) {
+               echo __('Enter your password to view comments');
+               return;
        }
 
        echo '<a href="';
        }
 
        echo '<a href="';
@@ -769,4 +945,418 @@ function comments_popup_link( $zero = 'No Comments', $one = '1 Comment', $more =
        echo '</a>';
 }
 
        echo '</a>';
 }
 
-?>
\ No newline at end of file
+/**
+ * Retrieve HTML content for reply to comment link.
+ *
+ * The default arguments that can be override are 'add_below', 'respond_id',
+ * 'reply_text', 'login_text', and 'depth'. The 'login_text' argument will be
+ * used, if the user must log in or register first before posting a comment. The
+ * 'reply_text' will be used, if they can post a reply. The 'add_below' and
+ * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function
+ * parameters.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Optional. Override default options.
+ * @param int $comment Optional. Comment being replied to.
+ * @param int $post Optional. Post that the comment is going to be displayed on.
+ * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
+ */
+function get_comment_reply_link($args = array(), $comment = null, $post = null) {
+       global $user_ID;
+
+       $defaults = array('add_below' => 'comment', 'respond_id' => 'respond', 'reply_text' => __('Reply'),
+               'login_text' => __('Log in to Reply'), 'depth' => 0, 'before' => '', 'after' => '');
+
+       $args = wp_parse_args($args, $defaults);
+
+       if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] )
+               return;
+
+       extract($args, EXTR_SKIP);
+
+       $comment = get_comment($comment);
+       $post = get_post($post);
+
+       if ( 'open' != $post->comment_status )
+               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>';
+       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>";
+       return apply_filters('comment_reply_link', $before . $link . $after, $args, $comment, $post);
+}
+
+/**
+ * Displays the HTML content for reply to comment link.
+ *
+ * @since 2.7.0
+ * @see get_comment_reply_link() Echoes result
+ *
+ * @param array $args Optional. Override default options.
+ * @param int $comment Optional. Comment being replied to.
+ * @param int $post Optional. Post that the comment is going to be displayed on.
+ * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
+ */
+function comment_reply_link($args = array(), $comment = null, $post = null) {
+       echo get_comment_reply_link($args, $comment, $post);
+}
+
+/**
+ * Retrieve HTML content for reply to post link.
+ *
+ * The default arguments that can be override are 'add_below', 'respond_id',
+ * 'reply_text', 'login_text', and 'depth'. The 'login_text' argument will be
+ * used, if the user must log in or register first before posting a comment. The
+ * 'reply_text' will be used, if they can post a reply. The 'add_below' and
+ * 'respond_id' arguments are for the JavaScript moveAddCommentForm() function
+ * parameters.
+ *
+ * @since 2.7.0
+ *
+ * @param array $args Optional. Override default options.
+ * @param int|object $post Optional. Post that the comment is going to be displayed on.  Defaults to current post.
+ * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
+ */
+function get_post_reply_link($args = array(), $post = null) {
+       global $user_ID;
+
+       $defaults = array('add_below' => 'post', 'respond_id' => 'respond', 'reply_text' => __('Leave a Comment'),
+               'login_text' => __('Log in to leave a Comment'), 'before' => '', 'after' => '');
+
+       $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 ) {
+               $link = '<a rel="nofollow" href="' . site_url('wp-login.php?redirect_to=' . 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>";
+       }
+       return apply_filters('post_comments_link', $before . $link . $after, $post);
+}
+
+/**
+ * Displays the HTML content for reply to post link.
+ * @since 2.7.0
+ * @see get_post_reply_link()
+ *
+ * @param array $args Optional. Override default options.
+ * @param int|object $post Optional. Post that the comment is going to be displayed on.
+ * @return string|bool|null Link to show comment form, if successful. False, if comments are closed.
+ */
+function post_reply_link($args = array(), $post = null) {
+       echo get_post_reply_link($args, $post);
+}
+
+/**
+ * Retrieve HTML content for cancel comment reply link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $text Optional. Text to display for cancel reply link.
+ */
+function get_cancel_comment_reply_link($text = '') {
+       if ( empty($text) )
+               $text = __('Click here to cancel reply.');
+
+       $style = isset($_GET['replytocom']) ? '' : ' style="display:none;"';
+       $link = wp_specialchars( 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);
+}
+
+/**
+ * Display HTML content for cancel comment reply link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $text Optional. Text to display for cancel reply link.
+ */
+function cancel_comment_reply_link($text = '') {
+       echo get_cancel_comment_reply_link($text);
+}
+
+/**
+ * Output hidden input HTML for replying to comments.
+ *
+ * @since 2.7.0
+ */
+function comment_id_fields() {
+       global $id;
+
+       $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
+       echo "<input type='hidden' name='comment_post_ID' value='$id' id='comment_post_ID' />\n";
+       echo "<input type='hidden' name='comment_parent' id='comment_parent' value='$replytoid' />\n";
+}
+
+/**
+ * Display text based on comment reply status. Only affects users with Javascript disabled.
+ *
+ * @since 2.7.0
+ *
+ * @param string $noreplytext Optional. Text to display when not replying to a 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 ) {
+       global $comment;
+
+       $replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;
+
+       if ( 0 == $replytoid )
+               echo $noreplytext;
+       else {
+               $comment = get_comment($replytoid);
+               $author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author() . '</a>' : get_comment_author();
+               printf( $replytext, $author );
+       }
+}
+
+/**
+ * HTML comment list class.
+ *
+ * @package WordPress
+ * @uses Walker
+ * @since unknown
+ */
+class Walker_Comment extends Walker {
+       /**
+        * @see Walker::$tree_type
+        * @since unknown
+        * @var string
+        */
+       var $tree_type = 'comment';
+
+       /**
+        * @see Walker::$db_fields
+        * @since unknown
+        * @var array
+        */
+       var $db_fields = array ('parent' => 'comment_parent', 'id' => 'comment_ID');
+
+       /**
+        * @see Walker::start_lvl()
+        * @since unknown
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param int $depth Depth of comment.
+        * @param array $args Uses 'style' argument for type of HTML list.
+        */
+       function start_lvl(&$output, $depth, $args) {
+               $GLOBALS['comment_depth'] = $depth + 1;
+
+               switch ( $args['style'] ) {
+                       case 'div':
+                               break;
+                       case 'ol':
+                               echo "<ol class='children'>\n";
+                               break;
+                       default:
+                       case 'ul':
+                               echo "<ul class='children'>\n";
+                               break;
+               }
+       }
+
+       /**
+        * @see Walker::end_lvl()
+        * @since unknown
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param int $depth Depth of comment.
+        * @param array $args Will only append content if style argument value is 'ol' or 'ul'.
+        */
+       function end_lvl(&$output, $depth, $args) {
+               $GLOBALS['comment_depth'] = $depth + 1;
+
+               switch ( $args['style'] ) {
+                       case 'div':
+                               break;
+                       case 'ol':
+                               echo "</ol>\n";
+                               break;
+                       default:
+                       case 'ul':
+                               echo "</ul>\n";
+                               break;
+               }
+       }
+
+       /**
+        * @see Walker::start_el()
+        * @since unknown
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $comment Comment data object.
+        * @param int $depth Depth of comment in reference to parents.
+        * @param array $args
+        */
+       function start_el(&$output, $comment, $depth, $args) {
+               $depth++;
+               $GLOBALS['comment_depth'] = $depth;
+
+               if ( !empty($args['callback']) ) {
+                       call_user_func($args['callback'], $comment, $args, $depth);
+                       return;
+               }
+
+               $GLOBALS['comment'] = $comment;
+               extract($args, EXTR_SKIP);
+
+               if ( 'div' == $args['style'] ) {
+                       $tag = 'div';
+                       $add_below = 'comment';
+               } else {
+                       $tag = 'li';
+                       $add_below = 'div-comment';
+               }
+?>
+               <<?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() ?>">
+               <?php endif; ?>
+               <div class="comment-author vcard">
+               <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
+               <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
+               </div>
+<?php if ($comment->comment_approved == '0') : ?>
+               <em><?php _e('Your comment is awaiting moderation.') ?></em>
+               <br />
+<?php endif; ?>
+
+               <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'&nbsp;&nbsp;','') ?></div>
+
+               <?php comment_text() ?>
+
+               <div class="reply">
+               <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
+               </div>
+               <?php if ( 'ul' == $args['style'] ) : ?>
+               </div>
+               <?php endif; ?>
+<?php
+       }
+
+       /**
+        * @see Walker::end_el()
+        * @since unknown
+        *
+        * @param string $output Passed by reference. Used to append additional content.
+        * @param object $comment
+        * @param int $depth Depth of comment.
+        * @param array $args
+        */
+       function end_el(&$output, $comment, $depth, $args) {
+               if ( !empty($args['end-callback']) ) {
+                       call_user_func($args['end-callback'], $comment, $args, $depth);
+                       return;
+               }
+               if ( 'div' == $args['style'] )
+                       echo "</div>\n";
+               else
+                       echo "</li>\n";
+       }
+
+}
+
+/**
+ * List comments
+ *
+ * Used in the comments.php template to list comments for a particular post
+ *
+ * @since 2.7.0
+ * @uses Walker_Comment
+ *
+ * @param string|array $args Formatting options
+ * @param array $comments Optional array of comment objects.  Defaults to $wp_query->comments
+ */
+function wp_list_comments($args = array(), $comments = null ) {
+       global $wp_query, $comment_alt, $comment_depth, $comment_thread_alt, $overridden_cpage, $in_comment_loop;
+
+       $in_comment_loop = true;
+
+       $comment_alt = $comment_thread_alt = 0;
+       $comment_depth = 1;
+
+       $defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
+               'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '');
+
+       $r = wp_parse_args( $args, $defaults );
+
+       // Figure out what comments we'll be looping through ($_comments)
+       if ( null !== $comments ) {
+               $comments = (array) $comments;
+               if ( empty($comments) )
+                       return;
+               if ( 'all' != $r['type'] ) {
+                       $comments_by_type = &separate_comments($comments);
+                       if ( empty($comments_by_type[$r['type']]) )
+                               return;
+                       $_comments = $comments_by_type[$r['type']];
+               } else {
+                       $_comments = $comments;
+               }
+       } else {
+               if ( empty($wp_query->comments) )
+                       return;
+               if ( 'all' != $r['type'] ) {
+                       if ( empty($wp_query->comments_by_type) )
+                               $wp_query->comments_by_type = &separate_comments($wp_query->comments);
+                       if ( empty($wp_query->comments_by_type[$r['type']]) )
+                               return;
+                       $_comments = $wp_query->comments_by_type[$r['type']];
+               } else {
+                       $_comments = $wp_query->comments;
+               }
+       }
+
+       if ( '' === $r['per_page'] && get_option('page_comments') )
+               $r['per_page'] = get_query_var('comments_per_page');
+
+       if ( empty($r['per_page']) ) {
+               $r['per_page'] = 0;
+               $r['page'] = 0;
+       }
+
+       if ( '' === $r['max_depth'] ) {
+               if ( get_option('thread_comments') )
+                       $r['max_depth'] = get_option('thread_comments_depth');
+               else
+                       $r['max_depth'] = -1;
+       }
+
+       if ( '' === $r['page'] ) {
+               if ( empty($overridden_cpage) ) {
+                       $r['page'] = get_query_var('cpage');
+               } else {
+                       $threaded = ( -1 == $r['max_depth'] ) ? false : true;
+                       $r['page'] = ( 'newest' == get_option('default_comments_page') ) ? get_comment_pages_count($_comments, $r['per_page'], $threaded) : 1;
+                       set_query_var( 'cpage', $r['page'] );
+               }
+       }
+       // Validation check
+       $r['page'] = intval($r['page']);
+       if ( 0 == $r['page'] && 0 != $r['per_page'] )
+               $r['page'] = 1;
+
+       if ( null === $r['reverse_top_level'] )
+               $r['reverse_top_level'] = ( 'desc' == get_option('comment_order') ) ? TRUE : FALSE;
+
+       extract( $r, EXTR_SKIP );
+
+       if ( empty($walker) )
+               $walker = new Walker_Comment;
+
+       $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
+       $wp_query->max_num_comment_pages = $walker->max_pages;
+
+       $in_comment_loop = false;
+}
+
+?>
index 0873db528b8477b7d1c7324be8d6011dfd7df05e..18bf0e196541b858dc3e83841d49006bfb837d50 100644 (file)
@@ -3,19 +3,20 @@
  * Manages WordPress comments
  *
  * @package WordPress
  * Manages WordPress comments
  *
  * @package WordPress
+ * @subpackage Comment
  */
 
 /**
  * Checks whether a comment passes internal checks to be allowed to add.
  *
  * If comment moderation is set in the administration, then all comments,
  */
 
 /**
  * Checks whether a comment passes internal checks to be allowed to add.
  *
  * If comment moderation is set in the administration, then all comments,
- * regardless of their type and whitelist will be set to false.
+ * regardless of their type and whitelist will be set to false. If the number of
+ * links exceeds the amount in the administration, then the check fails. If any
+ * of the parameter contents match the blacklist of words, then the check fails.
  *
  * If the number of links exceeds the amount in the administration, then the
  *
  * If the number of links exceeds the amount in the administration, then the
- * check fails.
- *
- * If any of the parameter contents match the blacklist of words, then the check
- * fails.
+ * check fails. If any of the parameter contents match the blacklist of words,
+ * then the check fails.
  *
  * If the comment is a trackback and part of the blogroll, then the trackback is
  * automatically whitelisted. If the comment author was approved before, then
  *
  * If the comment is a trackback and part of the blogroll, then the trackback is
  * automatically whitelisted. If the comment author was approved before, then
@@ -24,7 +25,7 @@
  * If none of the checks fail, then the failback is to set the check to pass
  * (return true).
  *
  * If none of the checks fail, then the failback is to set the check to pass
  * (return true).
  *
- * @since 1.2
+ * @since 1.2.0
  * @uses $wpdb
  *
  * @param string $author Comment Author's name
  * @uses $wpdb
  *
  * @param string $author Comment Author's name
@@ -44,14 +45,14 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
        if ( 1 == get_option('comment_moderation') )
                return false; // If moderation is set to manual
 
        if ( 1 == get_option('comment_moderation') )
                return false; // If moderation is set to manual
 
-       if ( preg_match_all("|(href\t*?=\t*?['\"]?)?(https?:)?//|i", $comment, $out) >= get_option('comment_max_links') )
+       if ( get_option('comment_max_links') && preg_match_all("/<[Aa][^>]*[Hh][Rr][Ee][Ff]=['\"]([^\"'>]+)[^>]*>/", apply_filters('comment_text',$comment), $out) >= get_option('comment_max_links') )
                return false; // Check # of external links
 
        $mod_keys = trim(get_option('moderation_keys'));
        if ( !empty($mod_keys) ) {
                $words = explode("\n", $mod_keys );
 
                return false; // Check # of external links
 
        $mod_keys = trim(get_option('moderation_keys'));
        if ( !empty($mod_keys) ) {
                $words = explode("\n", $mod_keys );
 
-               foreach ($words as $word) {
+               foreach ( (array) $words as $word) {
                        $word = trim($word);
 
                        // Skip empty lines
                        $word = trim($word);
 
                        // Skip empty lines
@@ -101,7 +102,7 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
 /**
  * Retrieve the approved comments for post $post_id.
  *
 /**
  * Retrieve the approved comments for post $post_id.
  *
- * @since 2.0
+ * @since 2.0.0
  * @uses $wpdb
  *
  * @param int $post_id The ID of the post
  * @uses $wpdb
  *
  * @param int $post_id The ID of the post
@@ -116,16 +117,17 @@ function get_approved_comments($post_id) {
  * Retrieves comment data given a comment ID or comment object.
  *
  * If an object is passed then the comment data will be cached and then returned
  * Retrieves comment data given a comment ID or comment object.
  *
  * If an object is passed then the comment data will be cached and then returned
- * after being passed through a filter.
+ * after being passed through a filter. If the comment is empty, then the global
+ * comment variable will be used, if it is set.
  *
  * If the comment is empty, then the global comment variable will be used, if it
  * is set.
  *
  *
  * If the comment is empty, then the global comment variable will be used, if it
  * is set.
  *
- * @since 2.0
+ * @since 2.0.0
  * @uses $wpdb
  *
  * @param object|string|int $comment Comment to retrieve.
  * @uses $wpdb
  *
  * @param object|string|int $comment Comment to retrieve.
- * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants
+ * @param string $output Optional. OBJECT or ARRAY_A or ARRAY_N constants.
  * @return object|array|null Depends on $output value.
  */
 function &get_comment(&$comment, $output = OBJECT) {
  * @return object|array|null Depends on $output value.
  */
 function &get_comment(&$comment, $output = OBJECT) {
@@ -153,70 +155,121 @@ function &get_comment(&$comment, $output = OBJECT) {
        if ( $output == OBJECT ) {
                return $_comment;
        } elseif ( $output == ARRAY_A ) {
        if ( $output == OBJECT ) {
                return $_comment;
        } elseif ( $output == ARRAY_A ) {
-               return get_object_vars($_comment);
+               $__comment = get_object_vars($_comment);
+               return $__comment;
        } elseif ( $output == ARRAY_N ) {
        } elseif ( $output == ARRAY_N ) {
-               return array_values(get_object_vars($_comment));
+               $__comment = array_values(get_object_vars($_comment));
+               return $__comment;
        } else {
                return $_comment;
        }
 }
 
 /**
        } else {
                return $_comment;
        }
 }
 
 /**
- * Retrieve an array of comment data about comment $comment_ID.
- *
- * get_comment() technically does the same thing as this function. This function
- * also appears to reference variables and then not use them or not update them
- * when needed. It is advised to switch to get_comment(), since this function
- * might be deprecated in favor of using get_comment().
+ * Retrieve a list of comments.
  *
  *
- * @deprecated Use get_comment()
- * @see get_comment()
- * @since 0.71
+ * The list of comment arguments are 'status', 'orderby', 'comment_date_gmt',
+ * 'order', 'number', 'offset', and 'post_id'.
  *
  *
- * @uses $postc Comment cache, might not be used any more
- * @uses $id
- * @uses $wpdb Database Object
+ * @since 2.7.0
+ * @uses $wpdb
  *
  *
- * @param int $comment_ID The ID of the comment
- * @param int $no_cache Whether to use the cache or not (casted to bool)
- * @param bool $include_unapproved Whether to include unapproved comments or not
- * @return array The comment data
+ * @param mixed $args Optional. Array or string of options to override defaults.
+ * @return array List of comments.
  */
  */
-function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
-       global $postc, $wpdb;
-       if ( $no_cache ) {
-               $query = $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID = %d", $comment_ID);
-               if ( false == $include_unapproved )
-                       $query .= " AND comment_approved = '1'";
-               $myrow = $wpdb->get_row($query, ARRAY_A);
+function get_comments( $args = '' ) {
+       global $wpdb;
+
+       $defaults = array('status' => '', 'orderby' => 'comment_date_gmt', 'order' => 'DESC', 'number' => '', 'offset' => '', 'post_id' => 0);
+
+       $args = wp_parse_args( $args, $defaults );
+       extract( $args, EXTR_SKIP );
+
+       // $args can be whatever, only use the args defined in defaults to compute the key
+       $key = md5( serialize( compact(array_keys($defaults)) )  );
+       $last_changed = wp_cache_get('last_changed', 'comment');
+       if ( !$last_changed ) {
+               $last_changed = time();
+               wp_cache_set('last_changed', $last_changed, 'comment');
+       }
+       $cache_key = "get_comments:$key:$last_changed";
+
+       if ( $cache = wp_cache_get( $cache_key, 'comment' ) ) {
+               return $cache;
+       }
+
+       $post_id = absint($post_id);
+
+       if ( 'hold' == $status )
+               $approved = "comment_approved = '0'";
+       elseif ( 'approve' == $status )
+               $approved = "comment_approved = '1'";
+       elseif ( 'spam' == $status )
+               $approved = "comment_approved = 'spam'";
+       else
+               $approved = "( comment_approved = '0' OR comment_approved = '1' )";
+
+       $order = ( 'ASC' == $order ) ? 'ASC' : 'DESC';
+
+       $orderby = 'comment_date_gmt';  // Hard code for now
+
+       $number = absint($number);
+       $offset = absint($offset);
+
+       if ( !empty($number) ) {
+               if ( $offset )
+                       $number = 'LIMIT ' . $offset . ',' . $number;
+               else
+                       $number = 'LIMIT ' . $number;
+
        } else {
        } else {
-               $myrow['comment_ID']           = $postc->comment_ID;
-               $myrow['comment_post_ID']      = $postc->comment_post_ID;
-               $myrow['comment_author']       = $postc->comment_author;
-               $myrow['comment_author_email'] = $postc->comment_author_email;
-               $myrow['comment_author_url']   = $postc->comment_author_url;
-               $myrow['comment_author_IP']    = $postc->comment_author_IP;
-               $myrow['comment_date']         = $postc->comment_date;
-               $myrow['comment_content']      = $postc->comment_content;
-               $myrow['comment_karma']        = $postc->comment_karma;
-               $myrow['comment_approved']     = $postc->comment_approved;
-               $myrow['comment_type']         = $postc->comment_type;
+               $number = '';
        }
        }
-       return $myrow;
+
+       if ( ! empty($post_id) )
+               $post_where = $wpdb->prepare( 'comment_post_ID = %d AND', $post_id );
+       else
+               $post_where = '';
+
+       $comments = $wpdb->get_results( "SELECT * FROM $wpdb->comments WHERE $post_where $approved ORDER BY $orderby $order $number" );
+       wp_cache_add( $cache_key, $comments, 'comment' );
+
+       return $comments;
 }
 
 /**
 }
 
 /**
- * The date the last comment was modified.
+ * Retrieve all of the WordPress supported comment statuses.
  *
  *
- * {@internal Missing Long Description}}
+ * Comments have a limited set of valid status values, this provides the comment
+ * status values and descriptions.
+ *
+ * @package WordPress
+ * @subpackage Post
+ * @since 2.7.0
+ *
+ * @return array List of comment statuses.
+ */
+function get_comment_statuses( ) {
+       $status = array(
+               'hold'          => __('Unapproved'),
+               'approve'       => __('Approved'),
+               'spam'          => _c('Spam|adjective'),
+       );
+
+       return $status;
+}
+
+
+/**
+ * The date the last comment was modified.
  *
  * @since 1.5.0
  * @uses $wpdb
  * @global array $cache_lastcommentmodified
  *
  * @param string $timezone Which timezone to use in reference to 'gmt', 'blog',
  *
  * @since 1.5.0
  * @uses $wpdb
  * @global array $cache_lastcommentmodified
  *
  * @param string $timezone Which timezone to use in reference to 'gmt', 'blog',
- *             or 'server' locations
- * @return string Last comment modified date
+ *             or 'server' locations.
+ * @return string Last comment modified date.
  */
 function get_lastcommentmodified($timezone = 'server') {
        global $cache_lastcommentmodified, $wpdb;
  */
 function get_lastcommentmodified($timezone = 'server') {
        global $cache_lastcommentmodified, $wpdb;
@@ -246,13 +299,15 @@ function get_lastcommentmodified($timezone = 'server') {
 /**
  * The amount of comments in a post or total comments.
  *
 /**
  * The amount of comments in a post or total comments.
  *
- * {@internal Missing Long Description}}
+ * A lot like {@link wp_count_comments()}, in that they both return comment
+ * stats (albeit with different types). The {@link wp_count_comments()} actual
+ * caches, but this function does not.
  *
  * @since 2.0.0
  * @uses $wpdb
  *
  *
  * @since 2.0.0
  * @uses $wpdb
  *
- * @param int $post_id Optional. Comment amount in post if > 0, else total comments blog wide
- * @return array The amount of spam, approved, awaiting moderation, and total
+ * @param int $post_id Optional. Comment amount in post if > 0, else total comments blog wide.
+ * @return array The amount of spam, approved, awaiting moderation, and total comments.
  */
 function get_comment_count( $post_id = 0 ) {
        global $wpdb;
  */
 function get_comment_count( $post_id = 0 ) {
        global $wpdb;
@@ -333,8 +388,6 @@ function sanitize_comment_cookies() {
 /**
  * Validates whether this comment is allowed to be made or not.
  *
 /**
  * Validates whether this comment is allowed to be made or not.
  *
- * {@internal Missing Long Description}}
- *
  * @since 2.0.0
  * @uses $wpdb
  * @uses apply_filters() Calls 'pre_comment_approved' hook on the type of comment
  * @since 2.0.0
  * @uses $wpdb
  * @uses apply_filters() Calls 'pre_comment_approved' hook on the type of comment
@@ -353,8 +406,12 @@ function wp_allow_comment($commentdata) {
        if ( $comment_author_email )
                $dupe .= "OR comment_author_email = '$comment_author_email' ";
        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
        if ( $comment_author_email )
                $dupe .= "OR comment_author_email = '$comment_author_email' ";
        $dupe .= ") AND comment_content = '$comment_content' LIMIT 1";
-       if ( $wpdb->get_var($dupe) )
+       if ( $wpdb->get_var($dupe) ) {
+               if ( defined('DOING_AJAX') )
+                       die( __('Duplicate comment detected; it looks as though you\'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\'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 );
 
@@ -364,7 +421,7 @@ function wp_allow_comment($commentdata) {
                $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));
        }
 
                $post_author = $wpdb->get_var($wpdb->prepare("SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1", $comment_post_ID));
        }
 
-       if ( $userdata && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
+       if ( isset($userdata) && ( $user_id == $post_author || $user->has_cap('moderate_comments') ) ) {
                // The author and the admins get respect.
                $approved = 1;
         } else {
                // The author and the admins get respect.
                $approved = 1;
         } else {
@@ -382,18 +439,21 @@ function wp_allow_comment($commentdata) {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Check whether comment flooding is occurring.
  *
  *
- * {@internal Missing Long Description}}
+ * Won't run, if current user can manage options, so to not block
+ * administrators.
  *
  * @since 2.3.0
  * @uses $wpdb
  *
  * @since 2.3.0
  * @uses $wpdb
- * @uses apply_filters() {@internal Missing Description}}
- * @uses do_action() {@internal Missing Description}}
- *
- * @param string $ip {@internal Missing Description}}
- * @param string $email {@internal Missing Description}}
- * @param unknown_type $date {@internal Missing Description}}
+ * @uses apply_filters() Calls 'comment_flood_filter' filter with first
+ *             parameter false, last comment timestamp, new comment timestamp.
+ * @uses do_action() Calls 'comment_flood_trigger' action with parameters with
+ *             last comment timestamp and new comment timestamp.
+ *
+ * @param string $ip Comment IP.
+ * @param string $email Comment author email address.
+ * @param string $date MySQL time string.
  */
 function check_comment_flood_db( $ip, $email, $date ) {
        global $wpdb;
  */
 function check_comment_flood_db( $ip, $email, $date ) {
        global $wpdb;
@@ -405,18 +465,148 @@ function check_comment_flood_db( $ip, $email, $date ) {
                $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);
-                       wp_die( __('You are posting comments too quickly.  Slow down.') );
+
+                       if ( defined('DOING_AJAX') )
+                               die( __('You are posting comments too quickly.  Slow down.') );
+
+                       wp_die( __('You are posting comments too quickly.  Slow down.'), '', array('response' => 403) );
                }
        }
 }
 
 /**
                }
        }
 }
 
 /**
- * Does comment contain blacklisted characters or words.
+ * Separates an array of comments into an array keyed by comment_type.
+ *
+ * @since 2.7.0
+ *
+ * @param array $comments Array of comments
+ * @return array Array of comments keyed by comment_type.
+ */
+function &separate_comments(&$comments) {
+       $comments_by_type = array('comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array());
+       $count = count($comments);
+       for ( $i = 0; $i < $count; $i++ ) {
+               $type = $comments[$i]->comment_type;
+               if ( empty($type) )
+                       $type = 'comment';
+               $comments_by_type[$type][] = &$comments[$i];
+               if ( 'trackback' == $type || 'pingback' == $type )
+                       $comments_by_type['pings'][] = &$comments[$i];
+       }
+
+       return $comments_by_type;
+}
+
+/**
+ * Calculate the total number of comment pages.
  *
  *
- * {@internal Missing Long Description}}
+ * @since 2.7.0
+ * @uses get_query_var() Used to fill in the default for $per_page parameter.
+ * @uses get_option() Used to fill in defaults for parameters.
+ * @uses Walker_Comment
+ *
+ * @param array $comments Optional array of comment objects.  Defaults to $wp_query->comments
+ * @param int $per_page Optional comments per page.
+ * @param boolean $threaded Optional control over flat or threaded comments.
+ * @return int Number of comment pages.
+ */
+function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
+       global $wp_query;
+
+       if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) )
+               return $wp_query->max_num_comment_pages;
+
+       if ( !$comments || !is_array($comments) )
+               $comments = $wp_query->comments;
+
+       if ( empty($comments) )
+               return 0;
+
+       if ( !isset($per_page) )
+               $per_page = (int) get_query_var('comments_per_page');
+       if ( 0 === $per_page )
+               $per_page = (int) get_option('comments_per_page');
+       if ( 0 === $per_page )
+               return 1;
+
+       if ( !isset($threaded) )
+               $threaded = get_option('thread_comments');
+
+       if ( $threaded ) {
+               $walker = new Walker_Comment;
+               $count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page );
+       } else {
+               $count = ceil( count( $comments ) / $per_page );
+       }
+
+       return $count;
+}
+
+/**
+ * Calculate what page number a comment will appear on for comment paging.
+ *
+ * @since 2.7.0
+ * @uses get_comment() Gets the full comment of the $comment_ID parameter.
+ * @uses get_option() Get various settings to control function and defaults.
+ * @uses get_page_of_comment() Used to loop up to top level comment.
+ *
+ * @param int $comment_ID Comment ID.
+ * @param array $args Optional args.
+ * @return int|null Comment page number or null on error.
+ */
+function get_page_of_comment( $comment_ID, $args = array() ) {
+       global $wpdb;
+
+       if ( !$comment = get_comment( $comment_ID ) )
+               return;
+
+       $defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
+       $args = wp_parse_args( $args, $defaults );
+
+       if ( '' === $args['per_page'] && get_option('page_comments') )
+               $args['per_page'] = get_query_var('comments_per_page');
+       if ( empty($args['per_page']) ) {
+               $args['per_page'] = 0;
+               $args['page'] = 0;
+       }
+       if ( $args['per_page'] < 1 )
+               return 1;
+
+       if ( '' === $args['max_depth'] ) {
+               if ( get_option('thread_comments') )
+                       $args['max_depth'] = get_option('thread_comments_depth');
+               else
+                       $args['max_depth'] = -1;
+       }
+
+       // Find this comment's top level parent if threading is enabled
+       if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent )
+               return get_page_of_comment( $comment->comment_parent, $args );
+
+       $allowedtypes = array(
+               'comment' => '',
+               'pingback' => 'pingback',
+               'trackback' => 'trackback',
+       );
+
+       $comtypewhere = ( 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : '';
+
+       // Count comments older than this one
+       $oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) );
+
+       // No older comments? Then it's page #1.
+       if ( 0 == $oldercoms )
+               return 1;
+
+       // Divide comments older than this one by comments per page to get this comment's page number
+       return ceil( ( $oldercoms + 1 ) / $args['per_page'] );
+}
+
+/**
+ * Does comment contain blacklisted characters or words.
  *
  * @since 1.5.0
  *
  * @since 1.5.0
- * @uses do_action() Calls 'wp_blacklist_check' hook for all parameters
+ * @uses do_action() Calls 'wp_blacklist_check' hook for all parameters.
  *
  * @param string $author The author of the comment
  * @param string $email The email of the comment
  *
  * @param string $author The author of the comment
  * @param string $email The email of the comment
@@ -469,18 +659,30 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
+ * Retrieve total comments for blog or single post.
  *
  *
- * {@internal Missing Long Description}}
+ * The properties of the returned object contain the 'moderated', 'approved',
+ * and spam comments for either the entire blog or single post. Those properties
+ * contain the amount of comments that match the status. The 'total_comments'
+ * property contains the integer of total comments.
  *
  *
- * @param unknown_type $post_id
- * @return unknown
+ * The comment stats are cached and then retrieved, if they already exist in the
+ * cache.
+ *
+ * @since 2.5.0
+ *
+ * @param int $post_id Optional. Post ID.
+ * @return object Comment stats.
  */
 function wp_count_comments( $post_id = 0 ) {
        global $wpdb;
 
        $post_id = (int) $post_id;
 
  */
 function wp_count_comments( $post_id = 0 ) {
        global $wpdb;
 
        $post_id = (int) $post_id;
 
+       $stats = apply_filters('wp_count_comments', array(), $post_id);
+       if ( !empty($stats) )
+               return $stats;
+
        $count = wp_cache_get("comments-{$post_id}", 'counts');
 
        if ( false !== $count )
        $count = wp_cache_get("comments-{$post_id}", 'counts');
 
        if ( false !== $count )
@@ -493,11 +695,12 @@ function wp_count_comments( $post_id = 0 ) {
        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
 
        $total = 0;
        $count = $wpdb->get_results( "SELECT comment_approved, COUNT( * ) AS num_comments FROM {$wpdb->comments} {$where} GROUP BY comment_approved", ARRAY_A );
 
        $total = 0;
-       $stats = array( );
        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
        $approved = array('0' => 'moderated', '1' => 'approved', 'spam' => 'spam');
+       $known_types = array_keys( $approved );
        foreach( (array) $count as $row_num => $row ) {
                $total += $row['num_comments'];
        foreach( (array) $count as $row_num => $row ) {
                $total += $row['num_comments'];
-               $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
+               if ( in_array( $row['comment_approved'], $known_types ) )
+                       $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
        }
 
        $stats['total_comments'] = $total;
        }
 
        $stats['total_comments'] = $total;
@@ -522,9 +725,10 @@ function wp_count_comments( $post_id = 0 ) {
  * @uses $wpdb
  * @uses do_action() Calls 'delete_comment' hook on comment ID
  * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter
  * @uses $wpdb
  * @uses do_action() Calls 'delete_comment' hook on comment ID
  * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter
+ * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
  *
  * @param int $comment_id Comment ID
  *
  * @param int $comment_id Comment ID
- * @return bool False if delete comment query failure, true on success
+ * @return bool False if delete comment query failure, true on success.
  */
 function wp_delete_comment($comment_id) {
        global $wpdb;
  */
 function wp_delete_comment($comment_id) {
        global $wpdb;
@@ -542,6 +746,7 @@ function wp_delete_comment($comment_id) {
        clean_comment_cache($comment_id);
 
        do_action('wp_set_comment_status', $comment_id, 'delete');
        clean_comment_cache($comment_id);
 
        do_action('wp_set_comment_status', $comment_id, 'delete');
+       wp_transition_comment_status('delete', $comment->comment_approved, $comment);
        return true;
 }
 
        return true;
 }
 
@@ -551,7 +756,7 @@ function wp_delete_comment($comment_id) {
  * @since 1.0.0
  *
  * @param int $comment_id Comment ID
  * @since 1.0.0
  *
  * @param int $comment_id Comment ID
- * @return string|bool Status might be 'deleted', 'approved', 'unapproved', 'spam'. False on failure
+ * @return string|bool Status might be 'deleted', 'approved', 'unapproved', 'spam'. False on failure.
  */
 function wp_get_comment_status($comment_id) {
        $comment = get_comment($comment_id);
  */
 function wp_get_comment_status($comment_id) {
        $comment = get_comment($comment_id);
@@ -572,17 +777,57 @@ function wp_get_comment_status($comment_id) {
                return false;
 }
 
                return false;
 }
 
+/**
+ * Call hooks for when a comment status transition occurs.
+ *
+ * Calls hooks for comment status transitions. If the new comment status is not the same
+ * as the previous comment status, then two hooks will be ran, the first is
+ * 'transition_comment_status' with new status, old status, and comment data. The
+ * next action called is 'comment_OLDSTATUS_to_NEWSTATUS' the NEWSTATUS is the
+ * $new_status parameter and the OLDSTATUS is $old_status parameter; it has the
+ * comment data.
+ *
+ * The final action will run whether or not the comment statuses are the same. The
+ * action is named 'comment_NEWSTATUS_COMMENTTYPE', NEWSTATUS is from the $new_status
+ * parameter and COMMENTTYPE is comment_type comment data.
+ *
+ * @since 2.7.0
+ *
+ * @param string $new_status New comment status.
+ * @param string $old_status Previous comment status.
+ * @param object $comment Comment data.
+ */
+function wp_transition_comment_status($new_status, $old_status, $comment) {
+       // Translate raw statuses to human readable formats for the hooks
+       // This is not a complete list of comment status, it's only the ones that need to be renamed
+       $comment_statuses = array(
+               0         => 'unapproved',
+               'hold'    => 'unapproved', // wp_set_comment_status() uses "hold"
+               1         => 'approved',
+               'approve' => 'approved', // wp_set_comment_status() uses "approve"
+       );
+       if ( isset($comment_statuses[$new_status]) ) $new_status = $comment_statuses[$new_status];
+       if ( isset($comment_statuses[$old_status]) ) $old_status = $comment_statuses[$old_status];
+
+       // Call the hooks
+       if ( $new_status != $old_status ) {
+               do_action('transition_comment_status', $new_status, $old_status, $comment);
+               do_action("comment_${old_status}_to_$new_status", $comment);
+       }
+       do_action("comment_${new_status}_$comment->comment_type", $comment->comment_ID, $comment);
+}
+
 /**
  * Get current commenter's name, email, and URL.
  *
 /**
  * Get current commenter's name, email, and URL.
  *
- * Expects cookies content to already be sanitized. User of this function
- * might wish to recheck the returned array for validity.
+ * Expects cookies content to already be sanitized. User of this function might
+ * wish to recheck the returned array for validity.
  *
  * @see sanitize_comment_cookies() Use to sanitize cookies
  *
  * @since 2.0.4
  *
  *
  * @see sanitize_comment_cookies() Use to sanitize cookies
  *
  * @since 2.0.4
  *
- * @return array Comment author, email, url respectively
+ * @return array Comment author, email, url respectively.
  */
 function wp_get_current_commenter() {
        // Cookies should already be sanitized.
  */
 function wp_get_current_commenter() {
        // Cookies should already be sanitized.
@@ -605,13 +850,14 @@ function wp_get_current_commenter() {
 /**
  * Inserts a comment to the database.
  *
 /**
  * Inserts a comment to the database.
  *
- * {@internal Missing Long Description}}
+ * The available comment data key names are 'comment_author_IP', 'comment_date',
+ * 'comment_date_gmt', 'comment_parent', 'comment_approved', and 'user_id'.
  *
  * @since 2.0.0
  * @uses $wpdb
  *
  *
  * @since 2.0.0
  * @uses $wpdb
  *
- * @param array $commentdata Contains information on the comment
- * @return int The new comment's id
+ * @param array $commentdata Contains information on the comment.
+ * @return int The new comment's ID.
  */
 function wp_insert_comment($commentdata) {
        global $wpdb;
  */
 function wp_insert_comment($commentdata) {
        global $wpdb;
@@ -629,6 +875,8 @@ function wp_insert_comment($commentdata) {
                $comment_approved = 1;
        if ( ! isset($user_id) )
                $user_id = 0;
                $comment_approved = 1;
        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)
 
        $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)
@@ -644,7 +892,7 @@ function wp_insert_comment($commentdata) {
 }
 
 /**
 }
 
 /**
- * Parses and returns comment information.
+ * Filters and sanitizes comment data.
  *
  * Sets the comment data 'filtered' field to true when finished. This can be
  * checked as to whether the comment should be filtered and to keep from
  *
  * Sets the comment data 'filtered' field to true when finished. This can be
  * checked as to whether the comment should be filtered and to keep from
@@ -659,8 +907,8 @@ function wp_insert_comment($commentdata) {
  * @uses apply_filters() Calls 'pre_comment_author_url' hook on comment author's URL
  * @uses apply_filters() Calls 'pre_comment_author_email' hook on comment author's email address
  *
  * @uses apply_filters() Calls 'pre_comment_author_url' hook on comment author's URL
  * @uses apply_filters() Calls 'pre_comment_author_email' hook on comment author's email address
  *
- * @param array $commentdata Contains information on the comment
- * @return array Parsed comment information
+ * @param array $commentdata Contains information on the comment.
+ * @return array Parsed comment information.
  */
 function wp_filter_comment($commentdata) {
        $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
  */
 function wp_filter_comment($commentdata) {
        $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
@@ -675,16 +923,14 @@ function wp_filter_comment($commentdata) {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Whether comment should be blocked because of comment flood.
  *
  * @since 2.1.0
  *
  *
  * @since 2.1.0
  *
- * @param unknown_type $block {@internal Missing Description}}
- * @param unknown_type $time_lastcomment {@internal Missing Description}}
- * @param unknown_type $time_newcomment {@internal Missing Description}}
- * @return unknown {@internal Missing Description}}
+ * @param bool $block Whether plugin has already blocked comment.
+ * @param int $time_lastcomment Timestamp for last comment.
+ * @param int $time_newcomment Timestamp for new comment.
+ * @return bool Whether comment should be blocked.
  */
 function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
        if ( $block ) // a plugin has already blocked... we'll let that decision stand
  */
 function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
        if ( $block ) // a plugin has already blocked... we'll let that decision stand
@@ -695,18 +941,21 @@ function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment)
 }
 
 /**
 }
 
 /**
- * Parses and adds a new comment to the database.
+ * Adds a new comment to the database.
  *
  *
- * {@internal Missing Long Description}}
+ * Filters new comment to ensure that the fields are sanitized and valid before
+ * inserting comment into database. Calls 'comment_post' action with comment ID
+ * and whether comment is approved by WordPress. Also has 'preprocess_comment'
+ * filter for processing the comment data before the function handles it.
  *
  * @since 1.5.0
  * @uses apply_filters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing
  * @uses do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved.
  *
  * @since 1.5.0
  * @uses apply_filters() Calls 'preprocess_comment' hook on $commentdata parameter array before processing
  * @uses do_action() Calls 'comment_post' hook on $comment_ID returned from adding the comment and if the comment was approved.
- * @uses wp_filter_comment() Used to filter comment before adding comment
+ * @uses wp_filter_comment() Used to filter comment before adding comment.
  * @uses wp_allow_comment() checks to see if comment is approved.
  * @uses wp_allow_comment() checks to see if comment is approved.
- * @uses wp_insert_comment() Does the actual comment insertion to the database
+ * @uses wp_insert_comment() Does the actual comment insertion to the database.
  *
  *
- * @param array $commentdata Contains information on the comment
+ * @param array $commentdata Contains information on the comment.
  * @return int The ID of the comment after adding.
  */
 function wp_new_comment( $commentdata ) {
  * @return int The ID of the comment after adding.
  */
 function wp_new_comment( $commentdata ) {
@@ -715,6 +964,10 @@ function wp_new_comment( $commentdata ) {
        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
        $commentdata['user_ID']         = (int) $commentdata['user_ID'];
 
        $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
        $commentdata['user_ID']         = (int) $commentdata['user_ID'];
 
+       $commentdata['comment_parent'] = absint($commentdata['comment_parent']);
+       $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
+       $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
+
        $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
        $commentdata['comment_agent']     = $_SERVER['HTTP_USER_AGENT'];
 
        $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
        $commentdata['comment_agent']     = $_SERVER['HTTP_USER_AGENT'];
 
@@ -743,14 +996,19 @@ function wp_new_comment( $commentdata ) {
 }
 
 /**
 }
 
 /**
- * Sets the status of comment ID.
+ * Sets the status of a comment.
  *
  *
- * {@internal Missing Long Description}}
+ * The 'wp_set_comment_status' action is called after the comment is handled and
+ * will only be called, if the comment status is either 'hold', 'approve', or
+ * 'spam'. If the comment status is not in the list, then false is returned and
+ * if the status is 'delete', then the comment is deleted without calling the
+ * action.
  *
  * @since 1.0.0
  *
  * @since 1.0.0
+ * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
  *
  *
- * @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'.
  * @return bool False on failure or deletion and true on success.
  */
 function wp_set_comment_status($comment_id, $comment_status) {
  * @return bool False on failure or deletion and true on success.
  */
 function wp_set_comment_status($comment_id, $comment_status) {
@@ -782,22 +1040,26 @@ function wp_set_comment_status($comment_id, $comment_status) {
 
        clean_comment_cache($comment_id);
 
 
        clean_comment_cache($comment_id);
 
-       do_action('wp_set_comment_status', $comment_id, $comment_status);
        $comment = get_comment($comment_id);
        $comment = get_comment($comment_id);
+
+       do_action('wp_set_comment_status', $comment_id, $comment_status);
+       wp_transition_comment_status($comment_status, $comment->comment_approved, $comment);
+
        wp_update_comment_count($comment->comment_post_ID);
 
        return true;
 }
 
 /**
        wp_update_comment_count($comment->comment_post_ID);
 
        return true;
 }
 
 /**
- * Parses and updates an existing comment in the database.
+ * Updates an existing comment in the database.
  *
  *
- * {@internal Missing Long Description}}
+ * Filters the comment and makes sure certain fields are valid before updating.
  *
  * @since 2.0.0
  * @uses $wpdb
  *
  * @since 2.0.0
  * @uses $wpdb
+ * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
  *
  *
- * @param array $commentarr Contains information on the comment
+ * @param array $commentarr Contains information on the comment.
  * @return int Comment was updated if value is 1, or was not updated if value is 0.
  */
 function wp_update_comment($commentarr) {
  * @return int Comment was updated if value is 1, or was not updated if value is 0.
  */
 function wp_update_comment($commentarr) {
@@ -822,6 +1084,13 @@ function wp_update_comment($commentarr) {
 
        $comment_date_gmt = get_gmt_from_date($comment_date);
 
 
        $comment_date_gmt = get_gmt_from_date($comment_date);
 
+       if ( !isset($comment_approved) )
+               $comment_approved = 1;
+       else if ( 'hold' == $comment_approved )
+               $comment_approved = 0;
+       else if ( 'approve' == $comment_approved )
+               $comment_approved = 1;
+
        $wpdb->query( $wpdb->prepare("UPDATE $wpdb->comments SET
                        comment_content      = %s,
                        comment_author       = %s,
        $wpdb->query( $wpdb->prepare("UPDATE $wpdb->comments SET
                        comment_content      = %s,
                        comment_author       = %s,
@@ -845,6 +1114,8 @@ function wp_update_comment($commentarr) {
        clean_comment_cache($comment_ID);
        wp_update_comment_count($comment_post_ID);
        do_action('edit_comment', $comment_ID);
        clean_comment_cache($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);
        return $rval;
 }
 
        return $rval;
 }
 
@@ -856,7 +1127,7 @@ function wp_update_comment($commentarr) {
  * previously deferred updated post comment counts will then be automatically
  * updated without having to call wp_update_comment_count() after.
  *
  * previously deferred updated post comment counts will then be automatically
  * updated without having to call wp_update_comment_count() after.
  *
- * @since 2.5
+ * @since 2.5.0
  * @staticvar bool $_defer
  *
  * @param bool $defer
  * @staticvar bool $_defer
  *
  * @param bool $defer
@@ -917,7 +1188,7 @@ function wp_update_comment_count($post_id, $do_deferred=false) {
 /**
  * Updates the comment count for the post.
  *
 /**
  * Updates the comment count for the post.
  *
- * @since 2.5
+ * @since 2.5.0
  * @uses $wpdb
  * @uses do_action() Calls 'wp_update_comment_count' hook on $post_id, $new, and $old
  * @uses do_action() Calls 'edit_posts' hook on $post_id and $post
  * @uses $wpdb
  * @uses do_action() Calls 'wp_update_comment_count' hook on $post_id, $new, and $old
  * @uses do_action() Calls 'edit_posts' hook on $post_id and $post
@@ -955,103 +1226,63 @@ function wp_update_comment_count_now($post_id) {
 /**
  * Finds a pingback server URI based on the given URL.
  *
 /**
  * Finds a pingback server URI based on the given URL.
  *
- * {@internal Missing Long Description}}
+ * Checks the HTML for the rel="pingback" link and x-pingback headers. It does
+ * a check for the x-pingback headers first and returns that, if available. The
+ * check for the rel="pingback" has more overhead than just the header.
  *
  * @since 1.5.0
  *
  * @since 1.5.0
- * @uses $wp_version
  *
  *
- * @param string $url URL to ping
- * @param int $timeout_bytes Number of bytes to timeout at. Prevents big file downloads, default is 2048.
+ * @param string $url URL to ping.
+ * @param int $deprecated Not Used.
  * @return bool|string False on failure, string containing URI on success.
  */
  * @return bool|string False on failure, string containing URI on success.
  */
-function discover_pingback_server_uri($url, $timeout_bytes = 2048) {
-       global $wp_version;
+function discover_pingback_server_uri($url, $deprecated = 2048) {
 
 
-       $byte_count = 0;
-       $contents = '';
-       $headers = '';
        $pingback_str_dquote = 'rel="pingback"';
        $pingback_str_squote = 'rel=\'pingback\'';
        $pingback_str_dquote = 'rel="pingback"';
        $pingback_str_squote = 'rel=\'pingback\'';
-       $x_pingback_str = 'x-pingback: ';
 
 
-       extract(parse_url($url), EXTR_SKIP);
+       /** @todo Should use Filter Extension or custom preg_match instead. */
+       $parsed_url = parse_url($url);
 
 
-       if ( !isset($host) ) // Not an URL. This should never happen.
+       if ( ! isset( $parsed_url['host'] ) ) // Not an URL. This should never happen.
                return false;
 
                return false;
 
-       $path  = ( !isset($path) ) ? '/'          : $path;
-       $path .= ( isset($query) ) ? '?' . $query : '';
-       $port  = ( isset($port)  ) ? $port        : 80;
+       $response = wp_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.1' ) );
 
 
-       // Try to connect to the server at $host
-       $fp = @fsockopen($host, $port, $errno, $errstr, 2);
-       if ( !$fp ) // Couldn't open a connection to $host
+       if ( is_wp_error( $response ) )
                return false;
 
                return false;
 
-       // Send the GET request
-       $request = "GET $path HTTP/1.1\r\nHost: $host\r\nUser-Agent: WordPress/$wp_version \r\n\r\n";
-       // ob_end_flush();
-       fputs($fp, $request);
-
-       // Let's check for an X-Pingback header first
-       while ( !feof($fp) ) {
-               $line = fgets($fp, 512);
-               if ( trim($line) == '' )
-                       break;
-               $headers .= trim($line)."\n";
-               $x_pingback_header_offset = strpos(strtolower($headers), $x_pingback_str);
-               if ( $x_pingback_header_offset ) {
-                       // We got it!
-                       preg_match('#x-pingback: (.+)#is', $headers, $matches);
-                       $pingback_server_url = trim($matches[1]);
-                       return $pingback_server_url;
-               }
-               if ( strpos(strtolower($headers), 'content-type: ') ) {
-                       preg_match('#content-type: (.+)#is', $headers, $matches);
-                       $content_type = trim($matches[1]);
-               }
-       }
+       if ( isset( $response['headers']['x-pingback'] ) )
+               return $response['headers']['x-pingback'];
 
 
-       if ( preg_match('#(image|audio|video|model)/#is', $content_type) ) // Not an (x)html, sgml, or xml page, no use going further
+       // Not an (x)html, sgml, or xml page, no use going further.
+       if ( isset( $response['headers']['content-type'] ) && preg_match('#(image|audio|video|model)/#is', $response['headers']['content-type']) )
                return false;
 
                return false;
 
-       while ( !feof($fp) ) {
-               $line = fgets($fp, 1024);
-               $contents .= trim($line);
-               $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
-               $pingback_link_offset_squote = strpos($contents, $pingback_str_squote);
-               if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
-                       $quote = ($pingback_link_offset_dquote) ? '"' : '\'';
-                       $pingback_link_offset = ($quote=='"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
-                       $pingback_href_pos = @strpos($contents, 'href=', $pingback_link_offset);
-                       $pingback_href_start = $pingback_href_pos+6;
-                       $pingback_href_end = @strpos($contents, $quote, $pingback_href_start);
-                       $pingback_server_url_len = $pingback_href_end - $pingback_href_start;
-                       $pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len);
-                       // We may find rel="pingback" but an incomplete pingback URL
-                       if ( $pingback_server_url_len > 0 ) { // We got it!
-                               fclose($fp);
-                               return $pingback_server_url;
-                       }
-               }
-               $byte_count += strlen($line);
-               if ( $byte_count > $timeout_bytes ) {
-                       // It's no use going further, there probably isn't any pingback
-                       // server to find in this file. (Prevents loading large files.)
-                       fclose($fp);
-                       return false;
+       $contents = $response['body'];
+
+       $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
+       $pingback_link_offset_squote = strpos($contents, $pingback_str_squote);
+       if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
+               $quote = ($pingback_link_offset_dquote) ? '"' : '\'';
+               $pingback_link_offset = ($quote=='"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
+               $pingback_href_pos = @strpos($contents, 'href=', $pingback_link_offset);
+               $pingback_href_start = $pingback_href_pos+6;
+               $pingback_href_end = @strpos($contents, $quote, $pingback_href_start);
+               $pingback_server_url_len = $pingback_href_end - $pingback_href_start;
+               $pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len);
+
+               // We may find rel="pingback" but an incomplete pingback URL
+               if ( $pingback_server_url_len > 0 ) { // We got it!
+                       return $pingback_server_url;
                }
        }
 
                }
        }
 
-       // We didn't find anything.
-       fclose($fp);
        return false;
 }
 
 /**
        return false;
 }
 
 /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Perform all pingbacks, enclosures, trackbacks, and send to pingback services.
  *
  * @since 2.1.0
  * @uses $wpdb
  *
  * @since 2.1.0
  * @uses $wpdb
@@ -1082,14 +1313,12 @@ function do_all_pings() {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Perform trackbacks.
  *
  * @since 1.5.0
  * @uses $wpdb
  *
  *
  * @since 1.5.0
  * @uses $wpdb
  *
- * @param int $post_id Post ID to do trackbacks on
+ * @param int $post_id Post ID to do trackbacks on.
  */
 function do_trackbacks($post_id) {
        global $wpdb;
  */
 function do_trackbacks($post_id) {
        global $wpdb;
@@ -1126,9 +1355,7 @@ function do_trackbacks($post_id) {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Sends pings to all of the ping site services.
  *
  * @since 1.2.0
  *
  *
  * @since 1.2.0
  *
@@ -1151,14 +1378,12 @@ function generic_ping($post_id = 0) {
 /**
  * Pings back the links found in a post.
  *
 /**
  * Pings back the links found in a post.
  *
- * {@internal Missing Long Description}}
- *
  * @since 0.71
  * @uses $wp_version
  * @uses IXR_Client
  *
  * @since 0.71
  * @uses $wp_version
  * @uses IXR_Client
  *
- * @param string $content {@internal Missing Description}}
- * @param int $post_ID {@internal Missing Description}}
+ * @param string $content Post content to check for links.
+ * @param int $post_ID Post ID.
  */
 function pingback($content, $post_ID) {
        global $wp_version;
  */
 function pingback($content, $post_ID) {
        global $wp_version;
@@ -1190,14 +1415,15 @@ function pingback($content, $post_ID) {
        // http://dummy-weblog.org/post.php
        // We don't wanna ping first and second types, even if they have a valid <link/>
 
        // http://dummy-weblog.org/post.php
        // We don't wanna ping first and second types, even if they have a valid <link/>
 
-       foreach ( $post_links_temp[0] as $link_test ) :
+       foreach ( (array) $post_links_temp[0] as $link_test ) :
                if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
                                && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
                if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
                                && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
-                       $test = parse_url($link_test);
-                       if ( isset($test['query']) )
-                               $post_links[] = $link_test;
-                       elseif ( ($test['path'] != '/') && ($test['path'] != '') )
-                               $post_links[] = $link_test;
+                       if ( $test = @parse_url($link_test) ) {
+                               if ( isset($test['query']) )
+                                       $post_links[] = $link_test;
+                               elseif ( ($test['path'] != '/') && ($test['path'] != '') )
+                                       $post_links[] = $link_test;
+                       }
                endif;
        endforeach;
 
                endif;
        endforeach;
 
@@ -1226,14 +1452,12 @@ function pingback($content, $post_ID) {
 }
 
 /**
 }
 
 /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Check whether blog is public before returning sites.
  *
  * @since 2.1.0
  *
  *
  * @since 2.1.0
  *
- * @param unknown_type $sites {@internal Missing Description}}
- * @return unknown {@internal Missing Description}}
+ * @param mixed $sites Will return if blog is public, will not return if not public.
+ * @return mixed Empty string if blog is not public, returns $sites, if site is public.
  */
 function privacy_ping_filter($sites) {
        if ( '0' != get_option('blog_public') )
  */
 function privacy_ping_filter($sites) {
        if ( '0' != get_option('blog_public') )
@@ -1249,41 +1473,34 @@ function privacy_ping_filter($sites) {
  *
  * @since 0.71
  * @uses $wpdb
  *
  * @since 0.71
  * @uses $wpdb
- * @uses $wp_version WordPress version
  *
  * @param string $trackback_url URL to send trackbacks.
  *
  * @param string $trackback_url URL to send trackbacks.
- * @param string $title Title of post
- * @param string $excerpt Excerpt of post
- * @param int $ID Post ID
- * @return mixed Database query from update
+ * @param string $title Title of post.
+ * @param string $excerpt Excerpt of post.
+ * @param int $ID Post ID.
+ * @return mixed Database query from update.
  */
 function trackback($trackback_url, $title, $excerpt, $ID) {
  */
 function trackback($trackback_url, $title, $excerpt, $ID) {
-       global $wpdb, $wp_version;
+       global $wpdb;
 
        if ( empty($trackback_url) )
                return;
 
 
        if ( empty($trackback_url) )
                return;
 
-       $title = urlencode($title);
-       $excerpt = urlencode($excerpt);
-       $blog_name = urlencode(get_option('blogname'));
-       $tb_url = $trackback_url;
-       $url = urlencode(get_permalink($ID));
-       $query_string = "title=$title&url=$url&blog_name=$blog_name&excerpt=$excerpt";
-       $trackback_url = parse_url($trackback_url);
-       $http_request = 'POST ' . $trackback_url['path'] . ($trackback_url['query'] ? '?'.$trackback_url['query'] : '') . " HTTP/1.0\r\n";
-       $http_request .= 'Host: '.$trackback_url['host']."\r\n";
-       $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset='.get_option('blog_charset')."\r\n";
-       $http_request .= 'Content-Length: '.strlen($query_string)."\r\n";
-       $http_request .= "User-Agent: WordPress/" . $wp_version;
-       $http_request .= "\r\n\r\n";
-       $http_request .= $query_string;
-       if ( '' == $trackback_url['port'] )
-               $trackback_url['port'] = 80;
-       $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4);
-       @fputs($fs, $http_request);
-       @fclose($fs);
-
-       $tb_url = addslashes( $tb_url );
+       $options = array();
+       $options['timeout'] = 4;
+       $options['body'] = array(
+               'title' => $title,
+               'url' => get_permalink($ID),
+               'blog_name' => get_option('blogname'),
+               'excerpt' => $excerpt
+       );
+
+       $response = wp_remote_post($trackback_url, $options);
+
+       if ( is_wp_error( $response ) )
+               return;
+
+       $tb_url = addslashes( $trackback_url );
        $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = %d", $ID) );
        return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = %d", $ID) );
 }
        $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', '$tb_url') WHERE ID = %d", $ID) );
        return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_url', '')) WHERE ID = %d", $ID) );
 }
@@ -1334,13 +1551,13 @@ function clean_comment_cache($id) {
 /**
  * Updates the comment cache of given comments.
  *
 /**
  * Updates the comment cache of given comments.
  *
- * Will add the comments in $comments to the cache. If comment ID already
- * exists in the comment cache then it will not be updated.
- *
- * The comment is added to the cache using the comment group with the key
- * using the ID of the comments.
+ * Will add the comments in $comments to the cache. If comment ID already exists
+ * in the comment cache then it will not be updated. The comment is added to the
+ * cache using the comment group with the key using the ID of the comments.
  *
  * @since 2.3.0
  *
  * @since 2.3.0
+ * @package WordPress
+ * @subpackage Cache
  *
  * @param array $comments Array of comment row objects
  */
  *
  * @param array $comments Array of comment row objects
  */
@@ -1349,4 +1566,62 @@ function update_comment_cache($comments) {
                wp_cache_add($comment->comment_ID, $comment, 'comment');
 }
 
                wp_cache_add($comment->comment_ID, $comment, 'comment');
 }
 
+//
+// Internal
+//
+
+/**
+ * Close comments on old posts on the fly, without any extra DB queries.  Hooked to the_posts.
+ *
+ * @access private
+ * @since 2.7.0
+ *
+ * @param object $posts Post data object.
+ * @return object
+ */
+function _close_comments_for_old_posts( $posts ) {
+       if ( empty($posts) || !is_singular() || !get_option('close_comments_for_old_posts') )
+               return $posts;
+
+       $days_old = (int) get_option('close_comments_days_old');
+       if ( !$days_old )
+               return $posts;
+
+       if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) ) {
+               $posts[0]->comment_status = 'closed';
+               $posts[0]->ping_status = 'closed';
+       }
+
+       return $posts;
+}
+
+/**
+ * Close comments on an old post.  Hooked to comments_open and pings_open.
+ *
+ * @access private
+ * @since 2.7.0
+ *
+ * @param bool $open Comments open or closed
+ * @param int $post_id Post ID
+ * @return bool $open
+ */
+function _close_comments_for_old_post( $open, $post_id ) {
+       if ( ! $open )
+               return $open;
+
+       if ( !get_option('close_comments_for_old_posts') )
+               return $open;
+
+       $days_old = (int) get_option('close_comments_days_old');
+       if ( !$days_old )
+               return $open;
+
+       $post = get_post($post_id);
+
+       if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * 24 * 60 * 60 ) )
+               return false;
+
+       return $open;
+}
+
 ?>
 ?>
index 9eb18d4db955dad57fb54076816b1b7b152f7f9e..47e6c8ba7cc57d93fe3fa6ecfed4707b0c7dcebf 100644 (file)
@@ -96,4 +96,23 @@ function _mb_strcut( $str, $start, $length=null, $encoding=null ) {
        return implode( '', $chars );
 }
 
        return implode( '', $chars );
 }
 
+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 )
+       {
+               if ( !is_scalar( $string ) ) {
+                       trigger_error( 'htmlspecialchars_decode() expects parameter 1 to be string, ' . gettype( $string ) . ' given', E_USER_WARNING );
+                       return;
+               }
+
+               if ( !is_int( $quote_style ) && $quote_style !== null ) {
+                       trigger_error( 'htmlspecialchars_decode() expects parameter 2 to be integer, ' . gettype( $quote_style ) . ' given', E_USER_WARNING );
+                       return;
+               }
+
+               return wp_specialchars_decode( $str, $quote_style );
+       }
+}
+
 ?>
 ?>
index 6eff54a3137e101590e06174e4f8e206703f8bcd..c609ef8a18b39c376df10c1bccf816ef3fcd58b6 100644 (file)
@@ -1,6 +1,30 @@
 <?php
 <?php
-
+/**
+ * WordPress CRON API
+ *
+ * @package WordPress
+ */
+
+/**
+ * Schedules a hook to run only once.
+ *
+ * Schedules a hook which will be executed once by the Wordpress actions core at
+ * a time which you specify. The action will fire off when someone visits your
+ * WordPress site, if the schedule time has passed.
+ *
+ * @since 2.1.0
+ * @link http://codex.wordpress.org/Function_Reference/wp_schedule_single_event
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ */
 function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
 function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
+       // don't schedule a duplicate if there's already an identical event due in the next 10 minutes
+       $next = wp_next_scheduled($hook, $args);
+       if ( $next && $next <= $timestamp + 600 )
+               return;
+
        $crons = _get_cron_array();
        $key = md5(serialize($args));
        $crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
        $crons = _get_cron_array();
        $key = md5(serialize($args));
        $crons[$timestamp][$hook][$key] = array( 'schedule' => false, 'args' => $args );
@@ -8,6 +32,21 @@ function wp_schedule_single_event( $timestamp, $hook, $args = array()) {
        _set_cron_array( $crons );
 }
 
        _set_cron_array( $crons );
 }
 
+/**
+ * Schedule a periodic event.
+ *
+ * Schedules a hook which will be executed by the WordPress actions core on a
+ * specific interval, specified by you. The action will trigger when someone
+ * visits your WordPress site, if the scheduled time has passed.
+ *
+ * @since 2.1.0
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $recurrence How often the event should recur.
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return bool|null False on failure, null when complete with scheduling event.
+ */
 function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
        $crons = _get_cron_array();
        $schedules = wp_get_schedules();
 function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
        $crons = _get_cron_array();
        $schedules = wp_get_schedules();
@@ -19,6 +58,17 @@ function wp_schedule_event( $timestamp, $recurrence, $hook, $args = array()) {
        _set_cron_array( $crons );
 }
 
        _set_cron_array( $crons );
 }
 
+/**
+ * Reschedule a recurring event.
+ *
+ * @since 2.1.0
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $recurrence How often the event should recur.
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return bool|null False on failure. Null when event is rescheduled.
+ */
 function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
        $crons = _get_cron_array();
        $schedules = wp_get_schedules();
 function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
        $crons = _get_cron_array();
        $schedules = wp_get_schedules();
@@ -41,6 +91,21 @@ function wp_reschedule_event( $timestamp, $recurrence, $hook, $args = array()) {
        wp_schedule_event( $timestamp, $recurrence, $hook, $args );
 }
 
        wp_schedule_event( $timestamp, $recurrence, $hook, $args );
 }
 
+/**
+ * Unschedule a previously scheduled cron job.
+ *
+ * The $timestamp and $hook parameters are required, so that the event can be
+ * identified.
+ *
+ * @since 2.1.0
+ *
+ * @param int $timestamp Timestamp for when to run the event.
+ * @param string $hook Action hook, the execution of which will be unscheduled.
+ * @param array $args Arguments to pass to the hook's callback function.
+ * Although not passed to a callback function, these arguments are used
+ * to uniquely identify the scheduled event, so they should be the same
+ * as those used when originally scheduling the event.
+ */
 function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
        $crons = _get_cron_array();
        $key = md5(serialize($args));
 function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
        $crons = _get_cron_array();
        $key = md5(serialize($args));
@@ -52,6 +117,14 @@ function wp_unschedule_event( $timestamp, $hook, $args = array() ) {
        _set_cron_array( $crons );
 }
 
        _set_cron_array( $crons );
 }
 
+/**
+ * Unschedule all cron jobs attached to a specific hook.
+ *
+ * @since 2.1.0
+ *
+ * @param string $hook Action hook, the execution of which will be unscheduled.
+ * @param mixed $args,... Optional. Event arguments.
+ */
 function wp_clear_scheduled_hook( $hook ) {
        $args = array_slice( func_get_args(), 1 );
 
 function wp_clear_scheduled_hook( $hook ) {
        $args = array_slice( func_get_args(), 1 );
 
@@ -59,6 +132,15 @@ function wp_clear_scheduled_hook( $hook ) {
                wp_unschedule_event( $timestamp, $hook, $args );
 }
 
                wp_unschedule_event( $timestamp, $hook, $args );
 }
 
+/**
+ * Retrieve the next timestamp for a cron event.
+ *
+ * @since 2.1.0
+ *
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return bool|int The UNIX timestamp of the next time the scheduled event will occur.
+ */
 function wp_next_scheduled( $hook, $args = array() ) {
        $crons = _get_cron_array();
        $key = md5(serialize($args));
 function wp_next_scheduled( $hook, $args = array() ) {
        $crons = _get_cron_array();
        $key = md5(serialize($args));
@@ -71,40 +153,66 @@ function wp_next_scheduled( $hook, $args = array() ) {
        return false;
 }
 
        return false;
 }
 
-function spawn_cron() {
-       $crons = _get_cron_array();
+/**
+ * Send request to run cron through HTTP request that doesn't halt page loading.
+ *
+ * @since 2.1.0
+ *
+ * @return null Cron could not be spawned, because it is not needed to run.
+ */
+function spawn_cron( $local_time ) {
+
+       /*
+        * do not even start the cron if local server timer has drifted
+        * such as due to power failure, or misconfiguration
+        */
+       $timer_accurate = check_server_timer( $local_time );
+       if ( !$timer_accurate )
+               return;
 
 
+       //sanity check
+       $crons = _get_cron_array();
        if ( !is_array($crons) )
                return;
 
        $keys = array_keys( $crons );
        if ( !is_array($crons) )
                return;
 
        $keys = array_keys( $crons );
-       if ( array_shift( $keys ) > time() )
+       $timestamp =  $keys[0];
+       if ( $timestamp > $local_time )
                return;
 
                return;
 
-       $cron_url = get_option( 'siteurl' ) . '/wp-cron.php';
-       $parts = parse_url( $cron_url );
-
-       if ($parts['scheme'] == 'https') {
-               // support for SSL was added in 4.3.0
-               if (version_compare(phpversion(), '4.3.0', '>=') && function_exists('openssl_open')) {
-                       $port = isset($parts['port']) ? $parts['port'] : 443;
-                       $argyle = @fsockopen('ssl://' . $parts['host'], $port, $errno, $errstr, 0.01);
-               } else {
-                       return false;
+       $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');
+
+       // 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;
                }
                }
-       } else {
-               $port = isset($parts['port']) ? $parts['port'] : 80;
-               $argyle = @ fsockopen( $parts['host'], $port, $errno, $errstr, 0.01 );
        }
 
        }
 
-       if ( $argyle )
-               fputs( $argyle,
-                         "GET {$parts['path']}?check=" . wp_hash('187425') . " HTTP/1.0\r\n"
-                       . "Host: {$_SERVER['HTTP_HOST']}\r\n\r\n"
-               );
+       //don't run if another process is currently running it
+       if ( $flag > $local_time )
+               return;
+
+       update_option( 'doing_cron', $local_time + 30 );
+
+       wp_remote_post($cron_url, array('timeout' => 0.01, 'blocking' => false));
 }
 
 }
 
+/**
+ * Run scheduled callbacks or spawn cron for all scheduled events.
+ *
+ * @since 2.1.0
+ *
+ * @return null When doesn't need to run Cron.
+ */
 function wp_cron() {
 function wp_cron() {
+
        // Prevent infinite loops caused by lack of wp-cron.php
        if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false )
                return;
        // Prevent infinite loops caused by lack of wp-cron.php
        if ( strpos($_SERVER['REQUEST_URI'], '/wp-cron.php') !== false )
                return;
@@ -118,18 +226,49 @@ function wp_cron() {
        if ( isset($keys[0]) && $keys[0] > time() )
                return;
 
        if ( isset($keys[0]) && $keys[0] > time() )
                return;
 
+       $local_time = time();
        $schedules = wp_get_schedules();
        foreach ( $crons as $timestamp => $cronhooks ) {
        $schedules = wp_get_schedules();
        foreach ( $crons as $timestamp => $cronhooks ) {
-               if ( $timestamp > time() ) break;
-               foreach ( $cronhooks as $hook => $args ) {
+               if ( $timestamp > $local_time ) break;
+               foreach ( (array) $cronhooks as $hook => $args ) {
                        if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) )
                                continue;
                        if ( isset($schedules[$hook]['callback']) && !call_user_func( $schedules[$hook]['callback'] ) )
                                continue;
-                       spawn_cron();
+                       spawn_cron( $local_time );
                        break 2;
                }
        }
 }
 
                        break 2;
                }
        }
 }
 
+/**
+ * Retrieve supported and filtered Cron recurrences.
+ *
+ * The supported recurrences are 'hourly' and 'daily'. A plugin may add more by
+ * hooking into the 'cron_schedules' filter. The filter accepts an array of
+ * arrays. The outer array has a key that is the name of the schedule or for
+ * example 'weekly'. The value is an array with two keys, one is 'interval' and
+ * the other is 'display'.
+ *
+ * The 'interval' is a number in seconds of when the cron job should run. So for
+ * 'hourly', the time is 3600 or 60*60. For weekly, the value would be
+ * 60*60*24*7 or 604800. The value of 'interval' would then be 604800.
+ *
+ * The 'display' is the description. For the 'weekly' key, the 'display' would
+ * be <code>__('Once Weekly')</code>.
+ *
+ * For your plugin, you will be passed an array. you can easily add your
+ * schedule by doing the following.
+ * <code>
+ * // filter parameter variable name is 'array'
+ *     $array['weekly'] = array(
+ *             'interval' => 604800,
+ *             'display' => __('Once Weekly')
+ *     );
+ * </code>
+ *
+ * @since 2.1.0
+ *
+ * @return array
+ */
 function wp_get_schedules() {
        $schedules = array(
                'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ),
 function wp_get_schedules() {
        $schedules = array(
                'hourly' => array( 'interval' => 3600, 'display' => __('Once Hourly') ),
@@ -139,6 +278,15 @@ function wp_get_schedules() {
        return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
 }
 
        return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
 }
 
+/**
+ * Retrieve Cron schedule for hook with arguments.
+ *
+ * @since 2.1.0
+ *
+ * @param string $hook Action hook to execute when cron is run.
+ * @param array $args Optional. Arguments to pass to the hook's callback function.
+ * @return string|bool False, if no schedule. Schedule on success.
+ */
 function wp_get_schedule($hook, $args = array()) {
        $crons = _get_cron_array();
        $key = md5(serialize($args));
 function wp_get_schedule($hook, $args = array()) {
        $crons = _get_cron_array();
        $key = md5(serialize($args));
@@ -155,6 +303,14 @@ function wp_get_schedule($hook, $args = array()) {
 // Private functions
 //
 
 // Private functions
 //
 
+/**
+ * Retrieve cron info array option.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @return array CRON info array.
+ */
 function _get_cron_array()  {
        $cron = get_option('cron');
        if ( ! is_array($cron) )
 function _get_cron_array()  {
        $cron = get_option('cron');
        if ( ! is_array($cron) )
@@ -168,19 +324,38 @@ function _get_cron_array()  {
        return $cron;
 }
 
        return $cron;
 }
 
+/**
+ * Updates the CRON option with the new CRON array.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param array $cron Cron info array from {@link _get_cron_array()}.
+ */
 function _set_cron_array($cron) {
        $cron['version'] = 2;
        update_option( 'cron', $cron );
 }
 
 function _set_cron_array($cron) {
        $cron['version'] = 2;
        update_option( 'cron', $cron );
 }
 
+/**
+ * Upgrade a Cron info array.
+ *
+ * This function upgrades the Cron info array to version 2.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param array $cron Cron info array from {@link _get_cron_array()}.
+ * @return array An upgraded Cron info array.
+ */
 function _upgrade_cron_array($cron) {
        if ( isset($cron['version']) && 2 == $cron['version'])
                return $cron;
 
        $new_cron = array();
 
 function _upgrade_cron_array($cron) {
        if ( isset($cron['version']) && 2 == $cron['version'])
                return $cron;
 
        $new_cron = array();
 
-       foreach ($cron as $timestamp => $hooks) {
-               foreach ( $hooks as $hook => $args ) {
+       foreach ( (array) $cron as $timestamp => $hooks) {
+               foreach ( (array) $hooks as $hook => $args ) {
                        $key = md5(serialize($args['args']));
                        $new_cron[$timestamp][$hook][$key] = $args;
                }
                        $key = md5(serialize($args['args']));
                        $new_cron[$timestamp][$hook][$key] = $args;
                }
@@ -191,4 +366,9 @@ function _upgrade_cron_array($cron) {
        return $new_cron;
 }
 
        return $new_cron;
 }
 
+// stub for checking server timer accuracy, using outside standard time sources
+function check_server_timer( $local_time ) {
+       return true;
+}
+
 ?>
 ?>
index 011a1ed4be8fe1e141140c875ed982818d3171fc..594937aa04bf677644647b745fd400e7685a9b97 100644 (file)
@@ -155,8 +155,12 @@ add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
 add_filter('comment_email', 'antispambot');
 add_filter('option_tag_base', '_wp_filter_taxonomy_base');
 add_filter('option_category_base', '_wp_filter_taxonomy_base');
 add_filter('comment_email', 'antispambot');
 add_filter('option_tag_base', '_wp_filter_taxonomy_base');
 add_filter('option_category_base', '_wp_filter_taxonomy_base');
+add_filter( 'the_posts', '_close_comments_for_old_posts' );
+add_filter( 'comments_open', '_close_comments_for_old_post', 10, 2 );
+add_filter( 'pings_open', '_close_comments_for_old_post', 10, 2 );
+add_filter( 'editable_slug', 'urldecode' );
 
 
-//Atom SSL support
+// Atom SSL support
 add_filter('atom_service_url','atom_service_url_filter');
 
 // Actions
 add_filter('atom_service_url','atom_service_url_filter');
 
 // Actions
@@ -165,6 +169,7 @@ add_action('wp_head', 'wlwmanifest_link');
 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_generator');
 if(!defined('DOING_CRON'))
 add_action('wp_head', 'wp_print_scripts');
 add_action('wp_head', 'wp_generator');
 if(!defined('DOING_CRON'))
@@ -192,5 +197,6 @@ add_action('comment_form', 'wp_comment_form_unfiltered_html_nonce');
 add_action('template_redirect', 'wp_old_slug_redirect');
 add_action('edit_post', 'wp_check_for_changed_slugs');
 add_action('edit_form_advanced', 'wp_remember_old_slug');
 add_action('template_redirect', 'wp_old_slug_redirect');
 add_action('edit_post', 'wp_check_for_changed_slugs');
 add_action('edit_form_advanced', 'wp_remember_old_slug');
+add_action('init', '_show_post_preview');
 
 ?>
 
 ?>
index 066e62c883aab9cee9b10adf5ba8e72a16aaef64..bcbec3bb8692fe439e011a8636c18bbd92c13d8d 100644 (file)
@@ -1,6 +1,9 @@
 <?php
 /**
 <?php
 /**
- * Deprecated functions from past WordPress versions
+ * Deprecated functions from past WordPress versions. You shouldn't use these
+ * globals and functions and look for the alternatives instead. The functions
+ * and globals will be removed in a later version.
+ *
  * @package WordPress
  * @subpackage Deprecated
  */
  * @package WordPress
  * @subpackage Deprecated
  */
@@ -76,7 +79,7 @@ $tablepostmeta = $wpdb->postmeta;
  */
 
 /**
  */
 
 /**
- * get_postdata() - Entire Post data
+ * Entire Post data.
  *
  * @since 0.71
  * @deprecated Use get_post()
  *
  * @since 0.71
  * @deprecated Use get_post()
@@ -112,7 +115,7 @@ function get_postdata($postid) {
 }
 
 /**
 }
 
 /**
- * start_wp() - Sets up the WordPress Loop
+ * Sets up the WordPress Loop.
  *
  * @since 1.0.1
  * @deprecated Since 1.5 - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
  *
  * @since 1.0.1
  * @deprecated Since 1.5 - {@link http://codex.wordpress.org/The_Loop Use new WordPress Loop}
@@ -129,7 +132,7 @@ function start_wp() {
 }
 
 /**
 }
 
 /**
- * the_category_ID() - Return or Print Category ID
+ * Return or Print Category ID.
  *
  * @since 0.71
  * @deprecated use get_the_category()
  *
  * @since 0.71
  * @deprecated use get_the_category()
@@ -152,7 +155,7 @@ function the_category_ID($echo = true) {
 }
 
 /**
 }
 
 /**
- * the_category_head() - Print category with optional text before and after
+ * Print category with optional text before and after.
  *
  * @since 0.71
  * @deprecated use get_the_category_by_ID()
  *
  * @since 0.71
  * @deprecated use get_the_category_by_ID()
@@ -178,7 +181,7 @@ function the_category_head($before='', $after='') {
 }
 
 /**
 }
 
 /**
- * previous_post() - Prints link to the previous post
+ * Prints link to the previous post.
  *
  * @since 1.5
  * @deprecated Use previous_post_link()
  *
  * @since 1.5
  * @deprecated Use previous_post_link()
@@ -214,7 +217,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
 }
 
 /**
 }
 
 /**
- * next_post() - Prints link to the next post
+ * Prints link to the next post.
  *
  * @since 0.71
  * @deprecated Use next_post_link()
  *
  * @since 0.71
  * @deprecated Use next_post_link()
@@ -249,7 +252,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
 }
 
 /**
 }
 
 /**
- * user_can_create_post() - Whether user can create a post
+ * Whether user can create a post.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -268,7 +271,7 @@ function user_can_create_post($user_id, $blog_id = 1, $category_id = 'None') {
 }
 
 /**
 }
 
 /**
- * user_can_create_draft() - Whether user can create a post
+ * Whether user can create a post.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -287,7 +290,7 @@ function user_can_create_draft($user_id, $blog_id = 1, $category_id = 'None') {
 }
 
 /**
 }
 
 /**
- * user_can_edit_post() - Whether user can edit a post
+ * Whether user can edit a post.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -315,7 +318,7 @@ function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
 }
 
 /**
 }
 
 /**
- * user_can_delete_post() - Whether user can delete a post
+ * Whether user can delete a post.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -334,7 +337,7 @@ function user_can_delete_post($user_id, $post_id, $blog_id = 1) {
 }
 
 /**
 }
 
 /**
- * user_can_set_post_date() - Whether user can set new posts' dates
+ * Whether user can set new posts' dates.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -352,9 +355,8 @@ function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
        return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
 }
 
        return (($author_data->user_level > 4) && user_can_create_post($user_id, $blog_id, $category_id));
 }
 
-/* returns true if $user_id can edit $post_id's date */
 /**
 /**
- * user_can_edit_post_date() - Whether user can delete a post
+ * Whether user can delete a post.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -363,7 +365,7 @@ function user_can_set_post_date($user_id, $blog_id = 1, $category_id = 'None') {
  * @param int $user_id
  * @param int $post_id
  * @param int $blog_id Not Used
  * @param int $user_id
  * @param int $post_id
  * @param int $blog_id Not Used
- * @return bool
+ * @return bool returns true if $user_id can edit $post_id's date
  */
 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
        _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  */
 function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
        _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
@@ -372,9 +374,8 @@ function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
        return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
 }
 
        return (($author_data->user_level > 4) && user_can_edit_post($user_id, $post_id, $blog_id));
 }
 
-/* returns true if $user_id can edit $post_id's comments */
 /**
 /**
- * user_can_edit_post_comments() - Whether user can delete a post
+ * Whether user can delete a post.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -383,7 +384,7 @@ function user_can_edit_post_date($user_id, $post_id, $blog_id = 1) {
  * @param int $user_id
  * @param int $post_id
  * @param int $blog_id Not Used
  * @param int $user_id
  * @param int $post_id
  * @param int $blog_id Not Used
- * @return bool
+ * @return bool returns true if $user_id can edit $post_id's comments
  */
 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
        _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  */
 function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
        _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
@@ -392,9 +393,8 @@ function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
        return user_can_edit_post($user_id, $post_id, $blog_id);
 }
 
        return user_can_edit_post($user_id, $post_id, $blog_id);
 }
 
-/* returns true if $user_id can delete $post_id's comments */
 /**
 /**
- * user_can_delete_post_comments() - Whether user can delete a post
+ * Whether user can delete a post.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -403,7 +403,7 @@ function user_can_edit_post_comments($user_id, $post_id, $blog_id = 1) {
  * @param int $user_id
  * @param int $post_id
  * @param int $blog_id Not Used
  * @param int $user_id
  * @param int $post_id
  * @param int $blog_id Not Used
- * @return bool
+ * @return bool returns true if $user_id can delete $post_id's comments
  */
 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
        _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
  */
 function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
        _deprecated_function(__FUNCTION__, '0.0', 'current_user_can()');
@@ -413,7 +413,7 @@ function user_can_delete_post_comments($user_id, $post_id, $blog_id = 1) {
 }
 
 /**
 }
 
 /**
- * user_can_edit_user() - Can user can edit other user
+ * Can user can edit other user.
  *
  * @since 1.5
  * @deprecated Use current_user_can()
  *
  * @since 1.5
  * @deprecated Use current_user_can()
@@ -435,24 +435,24 @@ function user_can_edit_user($user_id, $other_user) {
 }
 
 /**
 }
 
 /**
- * get_linksbyname() - Gets the links associated with category $cat_name.
+ * Gets the links associated with category $cat_name.
  *
  * @since 0.71
  * @deprecated Use get_links()
  * @see get_links()
  *
  *
  * @since 0.71
  * @deprecated Use get_links()
  * @see get_links()
  *
- * @param string       $cat_name       Optional. The category name to use. If no match is found uses all.
- * @param string       $before         Optional. The html to output before the link.
- * @param string       $after          Optional. The html to output after the link.
- * @param string       $between        Optional. The html to output between the link/image and it's description. Not used if no image or $show_images is true.
- * @param bool                 $show_images Optional. Whether to show images (if defined).
- * @param string       $orderby        Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
+ * @param string $cat_name Optional. The category name to use. If no match is found uses all.
+ * @param string $before Optional. The html to output before the link.
+ * @param string $after Optional. The html to output after the link.
+ * @param string $between Optional. The html to output between the link/image and it's description. Not used if no image or $show_images is true.
+ * @param bool $show_images Optional. Whether to show images (if defined).
+ * @param string $orderby Optional. The order to output the links. E.g. 'id', 'name', 'url', 'description' or 'rating'. Or maybe owner.
  *             If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a
  *             random order.
  *             If you start the name with an underscore the order will be reversed. You can also specify 'rand' as the order which will return links in a
  *             random order.
- * @param bool                 $show_description Optional. Whether to show the description if show_images=false/not defined.
- * @param bool                 $show_rating Optional. Show rating stars/chars.
- * @param int          $limit          Optional. Limit to X entries. If not specified, all entries are shown.
- * @param int          $show_updated Optional. Whether to show last updated timestamp
+ * @param bool $show_description Optional. Whether to show the description if show_images=false/not defined.
+ * @param bool $show_rating Optional. Show rating stars/chars.
+ * @param int $limit           Optional. Limit to X entries. If not specified, all entries are shown.
+ * @param int $show_updated Optional. Whether to show last updated timestamp
  */
 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
                                                 $show_description = true, $show_rating = false,
  */
 function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />', $between = " ", $show_images = true, $orderby = 'id',
                                                 $show_description = true, $show_rating = false,
@@ -468,7 +468,7 @@ function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
 }
 
 /**
 }
 
 /**
- * wp_get_linksbyname() - Gets the links associated with the named category.
+ * Gets the links associated with the named category.
  *
  * @since 1.0.1
  * @deprecated Use wp_get_links()
  *
  * @since 1.0.1
  * @deprecated Use wp_get_links()
@@ -491,7 +491,7 @@ function wp_get_linksbyname($category, $args = '') {
 }
 
 /**
 }
 
 /**
- * get_linkobjectsbyname() - Gets an array of link objects associated with category $cat_name.
+ * Gets an array of link objects associated with category $cat_name.
  *
  * <code>
  *     $links = get_linkobjectsbyname('fred');
  *
  * <code>
  *     $links = get_linkobjectsbyname('fred');
@@ -523,7 +523,7 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
 }
 
 /**
 }
 
 /**
- * get_linkobjects() - Gets an array of link objects associated with category n.
+ * Gets an array of link objects associated with category n.
  *
  * Usage:
  * <code>
  *
  * Usage:
  * <code>
@@ -577,7 +577,7 @@ function get_linkobjects($category = 0, $orderby = 'name', $limit = 0) {
 }
 
 /**
 }
 
 /**
- * get_linksbyname_withrating() - Gets the links associated with category 'cat_name' and display rating stars/chars.
+ * Gets the links associated with category 'cat_name' and display rating stars/chars.
  *
  * @since 0.71
  * @deprecated Use get_bookmarks()
  *
  * @since 0.71
  * @deprecated Use get_bookmarks()
@@ -604,7 +604,7 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '', $after =
 }
 
 /**
 }
 
 /**
- * get_links_withrating() - Gets the links associated with category n and display rating stars/chars.
+ * Gets the links associated with category n and display rating stars/chars.
  *
  * @since 0.71
  * @deprecated Use get_bookmarks()
  *
  * @since 0.71
  * @deprecated Use get_bookmarks()
@@ -631,7 +631,7 @@ function get_links_withrating($category = -1, $before = '', $after = '<br />', $
 }
 
 /**
 }
 
 /**
- * get_autotoggle() - Gets the auto_toggle setting
+ * Gets the auto_toggle setting.
  *
  * @since 0.71
  * @deprecated No alternative function available
  *
  * @since 0.71
  * @deprecated No alternative function available
@@ -793,7 +793,7 @@ function wp_get_post_cats($blogid = '1', $post_ID = 0) {
 }
 
 /**
 }
 
 /**
- * wp_set_post_cats() - Sets the categories that the post id belongs to.
+ * Sets the categories that the post id belongs to.
  *
  * @since 1.0.1
  * @deprecated Use wp_set_post_categories()
  *
  * @since 1.0.1
  * @deprecated Use wp_set_post_categories()
@@ -829,7 +829,7 @@ function get_archives($type='', $limit='', $format='html', $before = '', $after
 }
 
 /**
 }
 
 /**
- * get_author_link() - Returns or Prints link to the author's posts
+ * Returns or Prints link to the author's posts.
  *
  * @since 1.2
  * @deprecated Use get_author_posts_url()
  *
  * @since 1.2
  * @deprecated Use get_author_posts_url()
@@ -851,7 +851,7 @@ function get_author_link($echo = false, $author_id, $author_nicename = '') {
 }
 
 /**
 }
 
 /**
- * link_pages() - Print list of pages based on arguments
+ * Print list of pages based on arguments.
  *
  * @since 0.71
  * @deprecated Use wp_link_pages()
  *
  * @since 0.71
  * @deprecated Use wp_link_pages()
@@ -875,7 +875,7 @@ function link_pages($before='<br />', $after='<br />', $next_or_number='number',
 }
 
 /**
 }
 
 /**
- * get_settings() - Get value based on option
+ * Get value based on option.
  *
  * @since 0.71
  * @deprecated Use get_option()
  *
  * @since 0.71
  * @deprecated Use get_option()
@@ -891,7 +891,7 @@ function get_settings($option) {
 }
 
 /**
 }
 
 /**
- * permalink_link() - Print the permalink of the current post in the loop
+ * Print the permalink of the current post in the loop.
  *
  * @since 0.71
  * @deprecated Use the_permalink()
  *
  * @since 0.71
  * @deprecated Use the_permalink()
@@ -903,7 +903,7 @@ function permalink_link() {
 }
 
 /**
 }
 
 /**
- * permalink_single_rss() - Print the permalink to the RSS feed
+ * Print the permalink to the RSS feed.
  *
  * @since 0.71
  * @deprecated Use the_permalink_rss()
  *
  * @since 0.71
  * @deprecated Use the_permalink_rss()
@@ -917,7 +917,7 @@ function permalink_single_rss($deprecated = '') {
 }
 
 /**
 }
 
 /**
- * wp_get_links() - Gets the links associated with category.
+ * Gets the links associated with category.
  *
  * @see get_links() for argument information that can be used in $args
  * @since 1.0.1
  *
  * @see get_links() for argument information that can be used in $args
  * @since 1.0.1
@@ -951,7 +951,7 @@ function wp_get_links($args = '') {
 }
 
 /**
 }
 
 /**
- * get_links() - Gets the links associated with category by id.
+ * Gets the links associated with category by id.
  *
  * @since 0.71
  * @deprecated Use get_bookmarks()
  *
  * @since 0.71
  * @deprecated Use get_bookmarks()
@@ -1056,11 +1056,10 @@ function get_links($category = -1, $before = '', $after = '<br />', $between = '
 }
 
 /**
 }
 
 /**
- * get_links_list() - Output entire list of links by category
+ * Output entire list of links by category.
  *
  *
- * Output a list of all links, listed by category, using the
- * settings in $wpdb->linkcategories and output it as a nested
- * HTML unordered list.
+ * Output a list of all links, listed by category, using the settings in
+ * $wpdb->linkcategories and output it as a nested HTML unordered list.
  *
  * @author Dougal
  * @since 1.0.1
  *
  * @author Dougal
  * @since 1.0.1
@@ -1104,7 +1103,7 @@ function get_links_list($order = 'name', $deprecated = '') {
 }
 
 /**
 }
 
 /**
- * links_popup_script() - Show the link to the links popup and the number of links
+ * Show the link to the links popup and the number of links.
  *
  * @author Fullo
  * @link http://sprite.csr.unibo.it/fullo/
  *
  * @author Fullo
  * @link http://sprite.csr.unibo.it/fullo/
@@ -1148,7 +1147,7 @@ function get_linkrating($link) {
 }
 
 /**
 }
 
 /**
- * get_linkcatname() - Gets the name of category by id.
+ * Gets the name of category by id.
  *
  * @since 0.71
  * @deprecated Use get_category()
  *
  * @since 0.71
  * @deprecated Use get_category()
@@ -1177,7 +1176,7 @@ function get_linkcatname($id = 0) {
 }
 
 /**
 }
 
 /**
- * comment_rss_link() - Print RSS comment feed link
+ * Print RSS comment feed link.
  *
  * @since 1.0.1
  * @deprecated Use post_comments_feed_link()
  *
  * @since 1.0.1
  * @deprecated Use post_comments_feed_link()
@@ -1192,7 +1191,7 @@ function comments_rss_link($link_text = 'Comments RSS', $deprecated = '') {
 }
 
 /**
 }
 
 /**
- * get_category_rss_link() - Print/Return link to category RSS2 feed
+ * Print/Return link to category RSS2 feed.
  *
  * @since 1.2
  * @deprecated Use get_category_feed_link()
  *
  * @since 1.2
  * @deprecated Use get_category_feed_link()
@@ -1214,7 +1213,7 @@ function get_category_rss_link($echo = false, $cat_ID = 1, $deprecated = '') {
 }
 
 /**
 }
 
 /**
- * get_author_rss_link() - Print/Return link to author RSS feed
+ * Print/Return link to author RSS feed.
  *
  * @since 1.2
  * @deprecated Use get_author_feed_link()
  *
  * @since 1.2
  * @deprecated Use get_author_feed_link()
@@ -1235,7 +1234,7 @@ function get_author_rss_link($echo = false, $author_id = 1, $deprecated = '') {
 }
 
 /**
 }
 
 /**
- * comments_rss() - Return link to the post RSS feed
+ * Return link to the post RSS feed.
  *
  * @since 1.5
  * @deprecated Use get_post_comments_feed_link()
  *
  * @since 1.5
  * @deprecated Use get_post_comments_feed_link()
@@ -1250,7 +1249,8 @@ function comments_rss($deprecated = '') {
 }
 
 /**
 }
 
 /**
- * create_user() - An alias of wp_create_user().
+ * An alias of wp_create_user().
+ *
  * @param string $username The user's username.
  * @param string $password The user's password.
  * @param string $email The user's email (optional).
  * @param string $username The user's username.
  * @param string $password The user's password.
  * @param string $email The user's email (optional).
@@ -1264,7 +1264,8 @@ function create_user($username, $password, $email) {
 }
 
 /**
 }
 
 /**
- * documentation_link() - Unused Admin function
+ * Unused Admin function.
+ *
  * @since 2.0
  * @param string $deprecated Unknown
  * @deprecated 2.5
  * @since 2.0
  * @param string $deprecated Unknown
  * @deprecated 2.5
@@ -1275,12 +1276,32 @@ function documentation_link( $deprecated = '' ) {
 }
 
 /**
 }
 
 /**
- * gzip_compression() - Unused function
+ * Unused function.
  *
  * @deprecated 2.5
 */
  *
  * @deprecated 2.5
 */
-
 function gzip_compression() {
        return false;
 }
 function gzip_compression() {
        return false;
 }
+
+/**
+ * Retrieve an array of comment data about comment $comment_ID.
+ *
+ * @deprecated Use get_comment()
+ * @see get_comment()
+ * @since 0.71
+ *
+ * @uses $id
+ * @uses $wpdb Database Object
+ *
+ * @param int $comment_ID The ID of the comment
+ * @param int $no_cache Whether to use the cache or not (casted to bool)
+ * @param bool $include_unapproved Whether to include unapproved comments or not
+ * @return array The comment data
+ */
+function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) {
+       _deprecated_function( __FUNCTION__, '2.7', 'get_comment()' );
+       return get_comment($comment_ID, ARRAY_A);
+}
+
 ?>
\ No newline at end of file
 ?>
\ No newline at end of file
index e7c3c7cba6abb47242be0ee6cdbaea4be3c6230e..e51b8da1b05e89f379e4443f0f9b3f6657b16f3f 100644 (file)
@@ -11,15 +11,16 @@ 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'); ?>"
 <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'); ?>
 >
        <title type="text"><?php
                if ( is_singular() )
        <?php do_action('atom_ns'); ?>
 >
        <title type="text"><?php
                if ( is_singular() )
-                       printf(__('Comments on: %s'), get_the_title_rss());
+                       printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
                elseif ( is_search() )
                elseif ( is_search() )
-                       printf(__('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' ), attribute_escape(get_search_query()));
                else
                else
-                       printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
+                       printf(ent2ncr(__('Comments for %s')), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
        ?></title>
        <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
 
        ?></title>
        <subtitle type="text"><?php bloginfo_rss('description'); ?></subtitle>
 
@@ -50,9 +51,9 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
                        if ( !is_singular() ) {
                                $title = get_the_title($comment_post->ID);
                                $title = apply_filters('the_title_rss', $title);
                        if ( !is_singular() ) {
                                $title = get_the_title($comment_post->ID);
                                $title = apply_filters('the_title_rss', $title);
-                               printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
+                               printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
                        } else {
                        } else {
-                               printf(__('By: %s'), get_comment_author_rss());
+                               printf(ent2ncr(__('By: %s')), get_comment_author_rss());
                        }
                ?></title>
                <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" />
                        }
                ?></title>
                <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" />
@@ -63,14 +64,23 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
 
                </author>
 
 
                </author>
 
-               <id><?php comment_link(); ?></id>
+               <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); ?></updated>
                <published><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_comment_time('Y-m-d H:i:s', true), false); ?></published>
-<?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?>
+<?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 ?>
                <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
 <?php endif; // post pass
                <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php echo get_the_password_form(); ?>]]></content>
 <?php else : // post pass ?>
                <content type="html" xml:base="<?php comment_link(); ?>"><![CDATA[<?php comment_text(); ?>]]></content>
 <?php endif; // post pass
+       // Return comment threading information (http://www.ietf.org/rfc/rfc4685.txt)
+       if ( $comment->comment_parent == 0 ) : // This comment is top level ?>
+               <thr:in-reply-to ref="<?php the_guid() ?>" href="<?php the_permalink_rss() ?>" type="<?php bloginfo_rss('html_type'); ?>" />
+<?php else : // This comment is in reply to another comment
+       $parent_comment = get_comment($comment->comment_parent);
+       // The rel attribute below and the id tag above should be GUIDs, but WP doesn't create them for comments (unlike posts). Either way, its more important that they both use the same system
+?>
+               <thr:in-reply-to ref="<?php comment_guid($parent_comment) ?>" href="<?php echo get_comment_link($parent_comment) ?>" type="<?php bloginfo_rss('html_type'); ?>" />
+<?php endif;
        do_action('comment_atom_entry', $comment->comment_ID, $comment_post->ID);
 ?>
        </entry>
        do_action('comment_atom_entry', $comment->comment_ID, $comment_post->ID);
 ?>
        </entry>
index f75a792c10a55983ee0fe906bf1822b38aeb81b6..871c5c16e068d0f5d2df4c75e6fb70bc4d169cd1 100644 (file)
@@ -13,21 +13,24 @@ echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>';
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:content="http://purl.org/rss/1.0/modules/content/"
        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/"
        >
 <channel>
        <title><?php
                if ( is_singular() )
        >
 <channel>
        <title><?php
                if ( is_singular() )
-                       printf(__('Comments on: %s'), get_the_title_rss());
+                       printf(ent2ncr(__('Comments on: %s')), get_the_title_rss());
                elseif ( is_search() )
                elseif ( is_search() )
-                       printf(__('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' ), attribute_escape($wp_query->query_vars['s']));
                else
                else
-                       printf(__('Comments for %s'), get_bloginfo_rss( 'name' ) . get_wp_title_rss());
+                       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>
        <?php the_generator( 'rss2' ); ?>
        ?></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>
        <?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 do_action('commentsrss2_head'); ?>
 <?php
 if ( have_comments() ) : while ( have_comments() ) : the_comment();
        <?php do_action('commentsrss2_head'); ?>
 <?php
 if ( have_comments() ) : while ( have_comments() ) : the_comment();
@@ -39,17 +42,17 @@ if ( have_comments() ) : while ( have_comments() ) : the_comment();
                        if ( !is_singular() ) {
                                $title = get_the_title($comment_post->ID);
                                $title = apply_filters('the_title_rss', $title);
                        if ( !is_singular() ) {
                                $title = get_the_title($comment_post->ID);
                                $title = apply_filters('the_title_rss', $title);
-                               printf(__('Comment on %1$s by %2$s'), $title, get_comment_author_rss());
+                               printf(ent2ncr(__('Comment on %1$s by %2$s')), $title, get_comment_author_rss());
                        } else {
                        } else {
-                               printf(__('By: %s'), get_comment_author_rss());
+                               printf(ent2ncr(__('By: %s')), get_comment_author_rss());
                        }
                ?></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>
                <guid isPermaLink="false"><?php comment_guid() ?></guid>
                        }
                ?></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>
                <guid isPermaLink="false"><?php comment_guid() ?></guid>
-<?php if (!empty($comment_post->post_password) && $_COOKIE['wp-postpass'] != $comment_post->post_password) : ?>
-               <description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
+<?php if ( post_password_required($comment_post) ) : ?>
+               <description><?php echo ent2ncr(__('Protected Comments: Please enter your password to view comments.')); ?></description>
                <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
 <?php else : // post pass ?>
                <description><?php comment_text_rss() ?></description>
                <content:encoded><![CDATA[<?php echo get_the_password_form() ?>]]></content:encoded>
 <?php else : // post pass ?>
                <description><?php comment_text_rss() ?></description>
index 3274583d320582f52bc4608708e56e3f25796aa7..77e17d546ff79b36e77f84142ba1d598a8362a6d 100644 (file)
@@ -16,6 +16,7 @@ $more = 1;
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:atom="http://www.w3.org/2005/Atom"
        xmlns:wfw="http://wellformedweb.org/CommentAPI/"
        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'); ?>
 >
 
        <?php do_action('rss2_ns'); ?>
 >
 
@@ -27,6 +28,8 @@ $more = 1;
        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
        <?php the_generator( 'rss2' ); ?>
        <language><?php echo get_option('rss_language'); ?></language>
        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
        <?php the_generator( 'rss2' ); ?>
        <language><?php echo get_option('rss_language'); ?></language>
+       <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 do_action('rss2_head'); ?>
        <?php while( have_posts()) : the_post(); ?>
        <item>
        <?php do_action('rss2_head'); ?>
        <?php while( have_posts()) : the_post(); ?>
        <item>
index 11ff42bc234037f653ebdcc46c998f57e6308166..ad730f3817c84ce9576479f5fc937c03caf8177f 100644 (file)
@@ -223,9 +223,11 @@ function the_permalink_rss() {
  * @package WordPress
  * @subpackage Feed
  * @since unknown
  * @package WordPress
  * @subpackage Feed
  * @since unknown
+ *
+ * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
  */
  */
-function comment_guid() {
-       echo get_comment_guid();
+function comment_guid($comment_id = null) {
+       echo get_comment_guid($comment_id);
 }
 
 /**
 }
 
 /**
@@ -235,10 +237,11 @@ function comment_guid() {
  * @subpackage Feed
  * @since unknown
  *
  * @subpackage Feed
  * @since unknown
  *
+ * @param int|object $comment_id Optional comment object or id. Defaults to global comment object.
  * @return bool|string false on failure or guid for comment on success.
  */
  * @return bool|string false on failure or guid for comment on success.
  */
-function get_comment_guid() {
-       global $comment;
+function get_comment_guid($comment_id = null) {
+       $comment = get_comment($comment_id);
 
        if ( !is_object($comment) )
                return false;
 
        if ( !is_object($comment) )
                return false;
@@ -252,7 +255,7 @@ function get_comment_guid() {
  * @since 1.5.0
  */
 function comment_link() {
  * @since 1.5.0
  */
 function comment_link() {
-       echo get_comment_link();
+       echo clean_url( get_comment_link() );
 }
 
 /**
 }
 
 /**
@@ -306,7 +309,7 @@ function comment_text_rss() {
  * @package WordPress
  * @subpackage Feed
  * @since 2.1.0
  * @package WordPress
  * @subpackage Feed
  * @since 2.1.0
- * @uses apply_filters() 
+ * @uses apply_filters()
  *
  * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
  * @return string All of the post categories for displaying in the feed.
  *
  * @param string $type Optional, default is 'rss'. Either 'rss', 'atom', or 'rdf'.
  * @return string All of the post categories for displaying in the feed.
@@ -337,7 +340,7 @@ function get_the_category_rss($type = 'rss') {
                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 ) );
                else
                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 ) );
                else
-                       $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
+                       $the_list .= "\n\t\t<category><![CDATA[" . html_entity_decode( $cat_name ) . "]]></category>\n";
        }
 
        return apply_filters('the_category_rss', $the_list, $type);
        }
 
        return apply_filters('the_category_rss', $the_list, $type);
@@ -394,15 +397,19 @@ function html_type_rss() {
  * @uses get_post_custom() To get the current post enclosure metadata.
  */
 function rss_enclosure() {
  * @uses get_post_custom() To get the current post enclosure metadata.
  */
 function rss_enclosure() {
-       global $post;
-       if ( !empty($post->post_password) && (!isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
+       if ( post_password_required() )
                return;
 
                return;
 
-       foreach (get_post_custom() as $key => $val) {
+       foreach ( (array) get_post_custom() as $key => $val) {
                if ($key == 'enclosure') {
                if ($key == 'enclosure') {
-                       foreach ((array)$val as $enc) {
+                       foreach ( (array) $val as $enc ) {
                                $enclosure = split("\n", $enc);
                                $enclosure = split("\n", $enc);
-                               echo apply_filters('rss_enclosure', '<enclosure url="' . trim(htmlspecialchars($enclosure[0])) . '" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n");
+
+                               //only get the the first element eg, audio/mpeg from 'audio/mpeg mpga mp2 mp3'
+                               $t = 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");
                        }
                }
        }
                        }
                }
        }
@@ -426,13 +433,12 @@ function rss_enclosure() {
  * @uses get_post_custom() To get the current post enclosure metadata.
  */
 function atom_enclosure() {
  * @uses get_post_custom() To get the current post enclosure metadata.
  */
 function atom_enclosure() {
-       global $post;
-       if ( !empty($post->post_password) && ($_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password) )
+       if ( post_password_required() )
                return;
 
                return;
 
-       foreach (get_post_custom() as $key => $val) {
+       foreach ( (array) get_post_custom() as $key => $val ) {
                if ($key == 'enclosure') {
                if ($key == 'enclosure') {
-                       foreach ((array)$val as $enc) {
+                       foreach ( (array) $val as $enc ) {
                                $enclosure = split("\n", $enc);
                                echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n");
                        }
                                $enclosure = split("\n", $enc);
                                echo apply_filters('atom_enclosure', '<link href="' . trim(htmlspecialchars($enclosure[0])) . '" rel="enclosure" length="' . trim($enclosure[1]) . '" type="' . trim($enclosure[2]) . '" />' . "\n");
                        }
@@ -495,10 +501,14 @@ function prep_atom_text_construct($data) {
  * @since 2.5
  */
 function self_link() {
  * @since 2.5
  */
 function self_link() {
-       echo 'http'
-               . ( $_SERVER['https'] == 'on' ? 's' : '' ) . '://'
-               . $_SERVER['HTTP_HOST']
-               . wp_specialchars(stripslashes($_SERVER['REQUEST_URI']), 1);
+       $host = @parse_url(get_option('home'));
+       $host = $host['host'];
+       echo clean_url(
+               'http'
+               . ( (isset($_SERVER['https']) && $_SERVER['https'] == 'on') ? 's' : '' ) . '://'
+               . $host
+               . stripslashes($_SERVER['REQUEST_URI'])
+               );
 }
 
 }
 
-?>
\ No newline at end of file
+?>
index eeafe0b499d9039d7f6da4331f5a48038a8033e0..53df8084b23f8d48ed8ce53a583b2212e39aed7d 100644 (file)
@@ -1,5 +1,31 @@
 <?php
 <?php
+/**
+ * Main Wordpress Formatting API.
+ *
+ * Handles many functions for formatting output.
+ *
+ * @package WordPress
+ **/
 
 
+/**
+ * Replaces common plain text characters into formatted entities
+ *
+ * As an example,
+ * <code>
+ * 'cause today's effort makes it worth tomorrow's "holiday"...
+ * </code>
+ * Becomes:
+ * <code>
+ * &#8217;cause today&#8217;s effort makes it worth tomorrow&#8217;s &#8220;holiday&#8221;&#8230;
+ * </code>
+ * Code within certain html blocks are skipped.
+ *
+ * @since 0.71
+ * @uses $wp_cockneyreplace Array of formatted entities for certain common phrases
+ *
+ * @param string $text The text to be formatted
+ * @return string The string replaced with html entities
+ */
 function wptexturize($text) {
        global $wp_cockneyreplace;
        $next = true;
 function wptexturize($text) {
        global $wp_cockneyreplace;
        $next = true;
@@ -25,9 +51,9 @@ function wptexturize($text) {
        $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2');
 
        for ( $i = 0; $i < $stop; $i++ ) {
        $dynamic_replacements = array('&#8217;$1','$1&#8216;', '$1&#8243;', '$1&#8242;', '$1&#8217;$2', '$1&#8220;$2', '&#8221;$1', '&#8217;$1', '$1&#215;$2');
 
        for ( $i = 0; $i < $stop; $i++ ) {
-               $curl = $textarr[$i];
+               $curl = $textarr[$i];
 
 
-               if (isset($curl{0}) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag
+               if ( !empty($curl) && '<' != $curl{0} && '[' != $curl{0} && $next && !$has_pre_parent) { // If it's not a tag
                        // static strings
                        $curl = str_replace($static_characters, $static_replacements, $curl);
                        // regular expressions
                        // static strings
                        $curl = str_replace($static_characters, $static_replacements, $curl);
                        // regular expressions
@@ -46,11 +72,20 @@ function wptexturize($text) {
                $output .= $curl;
        }
 
                $output .= $curl;
        }
 
-       return $output;
+       return $output;
 }
 
 }
 
-// Accepts matches array from preg_replace_callback in wpautop()
-// or a string
+/**
+ * Accepts matches array from preg_replace_callback in wpautop() or a string.
+ *
+ * Ensures that the contents of a <<pre>>...<</pre>> HTML block are not
+ * converted into paragraphs or line-breaks.
+ *
+ * @since 1.2.0
+ *
+ * @param array|string $matches The array or string
+ * @return string The pre block without paragraph/line-break conversion.
+ */
 function clean_pre($matches) {
        if ( is_array($matches) )
                $text = $matches[1] . $matches[2] . "</pre>";
 function clean_pre($matches) {
        if ( is_array($matches) )
                $text = $matches[1] . $matches[2] . "</pre>";
@@ -64,6 +99,20 @@ function clean_pre($matches) {
        return $text;
 }
 
        return $text;
 }
 
+/**
+ * Replaces double line-breaks with paragraph elements.
+ *
+ * A group of regex replaces used to identify text formatted with newlines and
+ * replace double line-breaks with HTML paragraph tags. The remaining
+ * line-breaks after conversion become <<br />> tags, unless $br is set to '0'
+ * or 'false'.
+ *
+ * @since 0.71
+ *
+ * @param string $pee The text which has to be formatted.
+ * @param int|bool $br Optional. If set, this will convert all remaining line-breaks after paragraphing. Default true.
+ * @return string Text which has been converted into correct paragraph tags.
+ */
 function wpautop($pee, $br = 1) {
        $pee = $pee . "\n"; // just to make things a little easier, pad the end
        $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
 function wpautop($pee, $br = 1) {
        $pee = $pee . "\n"; // just to make things a little easier, pad the end
        $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
@@ -77,7 +126,11 @@ function wpautop($pee, $br = 1) {
                $pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);
        }
        $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
                $pee = preg_replace('|\s*</embed>\s*|', '</embed>', $pee);
        }
        $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
-       $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
+       // make paragraphs, including one at the end
+       $pees = preg_split('/\n\s*\n/', $pee, -1, PREG_SPLIT_NO_EMPTY);
+       $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>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
        $pee = preg_replace( '|<p>|', "$1<p>", $pee );
@@ -102,7 +155,16 @@ function wpautop($pee, $br = 1) {
        return $pee;
 }
 
        return $pee;
 }
 
-
+/**
+ * Checks to see if a string is utf8 encoded.
+ *
+ * @author bmorel at ssi dot fr
+ *
+ * @since 1.2.1
+ *
+ * @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);
        for ($i=0; $i < $length; $i++) {
 function seems_utf8($Str) { # by bmorel at ssi dot fr
        $length = strlen($Str);
        for ($i=0; $i < $length; $i++) {
@@ -121,24 +183,206 @@ function seems_utf8($Str) { # by bmorel at ssi dot fr
        return true;
 }
 
        return true;
 }
 
-function wp_specialchars( $text, $quotes = 0 ) {
-       // Like htmlspecialchars except don't double-encode HTML entities
-       $text = str_replace('&&', '&#038;&', $text);
-       $text = str_replace('&&', '&#038;&', $text);
-       $text = preg_replace('/&(?:$|([^#])(?![a-z1-4]{1,8};))/', '&#038;$1', $text);
-       $text = str_replace('<', '&lt;', $text);
-       $text = str_replace('>', '&gt;', $text);
-       if ( 'double' === $quotes ) {
-               $text = str_replace('"', '&quot;', $text);
-       } elseif ( 'single' === $quotes ) {
-               $text = str_replace("'", '&#039;', $text);
-       } elseif ( $quotes ) {
-               $text = str_replace('"', '&quot;', $text);
-               $text = str_replace("'", '&#039;', $text);
+/**
+ * Converts a number of special characters into their HTML entities.
+ *
+ * Specifically deals with: &, <, >, ", and '.
+ *
+ * $quote_style can be set to ENT_COMPAT to encode " to
+ * &quot;, or ENT_QUOTES to do both. Default is ENT_NOQUOTES where no quotes are encoded.
+ *
+ * @since 1.2.2
+ *
+ * @param string $string The text which is to be encoded.
+ * @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 values; converting single quotes if set to 'single', double if set to 'double' or both if otherwise set. Default is ENT_NOQUOTES.
+ * @param string $charset Optional. The character encoding of the string. Default is false.
+ * @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 )
+{
+       $string = (string) $string;
+
+       if ( 0 === strlen( $string ) ) {
+               return '';
        }
        }
-       return $text;
+
+       // Don't bother if there are no specialchars - saves some processing
+       if ( !preg_match( '/[&<>"\']/', $string ) ) {
+               return $string;
+       }
+
+       // Account for the previous behaviour of the function 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 ) ) {
+               $quote_style = ENT_QUOTES;
+       }
+
+       // Store the site charset as a static to avoid multiple calls to wp_load_alloptions()
+       if ( !$charset ) {
+               static $_charset;
+               if ( !isset( $_charset ) ) {
+                       $alloptions = wp_load_alloptions();
+                       $_charset = isset( $alloptions['blog_charset'] ) ? $alloptions['blog_charset'] : '';
+               }
+               $charset = $_charset;
+       }
+       if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) {
+               $charset = 'UTF-8';
+       }
+
+       $_quote_style = $quote_style;
+
+       if ( $quote_style === 'double' ) {
+               $quote_style = ENT_COMPAT;
+               $_quote_style = ENT_COMPAT;
+       } elseif ( $quote_style === 'single' ) {
+               $quote_style = ENT_NOQUOTES;
+       }
+
+       // 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 = @htmlspecialchars( $string, $quote_style, $charset );
+
+       // Handle double encoding ourselves
+       if ( !$double_encode ) {
+               $string = str_replace( array( '|wp_entity|', '|/wp_entity|' ), array( '&', ';' ), $string );
+       }
+
+       // Backwards compatibility
+       if ( 'single' === $_quote_style ) {
+               $string = str_replace( "'", '&#039;', $string );
+       }
+
+       return $string;
+}
+
+/**
+ * Converts a number of HTML entities into their special characters.
+ *
+ * Specifically deals with: &, <, >, ", and '.
+ *
+ * $quote_style can be set to ENT_COMPAT to decode " entities,
+ * or ENT_QUOTES to do both " and '. Default is ENT_NOQUOTES where no quotes are 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.
+ * @return string The decoded text without HTML entities.
+ */
+function wp_specialchars_decode( $string, $quote_style = ENT_NOQUOTES )
+{
+       $string = (string) $string;
+
+       if ( 0 === strlen( $string ) ) {
+               return '';
+       }
+
+       // Don't bother if there are no entities - saves a lot of processing
+       if ( strpos( $string, '&' ) === false ) {
+               return $string;
+       }
+
+       // 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 ) ) {
+               $quote_style = ENT_QUOTES;
+       }
+
+       // More complete than get_html_translation_table( HTML_SPECIALCHARS )
+       $single = array( '&#039;'  => '\'', '&#x27;' => '\'' );
+       $single_preg = array( '/&#0*39;/'  => '&#039;', '/&#x0*27;/i' => '&#x27;' );
+       $double = array( '&quot;' => '"', '&#034;'  => '"', '&#x22;' => '"' );
+       $double_preg = array( '/&#0*34;/'  => '&#034;', '/&#x0*22;/i' => '&#x22;' );
+       $others = array( '&lt;'   => '<', '&#060;'  => '<', '&gt;'   => '>', '&#062;'  => '>', '&amp;'  => '&', '&#038;'  => '&', '&#x26;' => '&' );
+       $others_preg = array( '/&#0*60;/'  => '&#060;', '/&#0*62;/'  => '&#062;', '/&#0*38;/'  => '&#038;', '/&#x0*26;/i' => '&#x26;' );
+
+       if ( $quote_style === ENT_QUOTES ) {
+               $translation = array_merge( $single, $double, $others );
+               $translation_preg = array_merge( $single_preg, $double_preg, $others_preg );
+       } elseif ( $quote_style === ENT_COMPAT || $quote_style === 'double' ) {
+               $translation = array_merge( $double, $others );
+               $translation_preg = array_merge( $double_preg, $others_preg );
+       } elseif ( $quote_style === 'single' ) {
+               $translation = array_merge( $single, $others );
+               $translation_preg = array_merge( $single_preg, $others_preg );
+       } elseif ( $quote_style === ENT_NOQUOTES ) {
+               $translation = $others;
+               $translation_preg = $others_preg;
+       }
+
+       // Remove zero padding on numeric entities
+       $string = preg_replace( array_keys( $translation_preg ), array_values( $translation_preg ), $string );
+
+       // Replace characters according to translation table
+       return strtr( $string, $translation );
 }
 
 }
 
+/**
+ * Checks for invalid UTF8 in a string.
+ *
+ * @since 2.8
+ *
+ * @param string $string The text which is to be checked.
+ * @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 )
+{
+       $string = (string) $string;
+
+       if ( 0 === strlen( $string ) ) {
+               return '';
+       }
+
+       // Store the site charset as a static to avoid multiple calls to get_option()
+       static $is_utf8;
+       if ( !isset( $is_utf8 ) ) {
+               $is_utf8 = in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) );
+       }
+       if ( !$is_utf8 ) {
+               return $string;
+       }
+
+       // Check for support for utf8 in the installed PCRE library once and store the result in a static
+       static $utf8_pcre;
+       if ( !isset( $utf8_pcre ) ) {
+               $utf8_pcre = @preg_match( '/^./u', 'a' );
+       }
+       // We can't demand utf8 in the PCRE installation, so just return the string in those cases
+       if ( !$utf8_pcre ) {
+               return $string;
+       }
+
+       // preg_match fails when it encounters invalid UTF8 in $string
+       if ( 1 === @preg_match( '/^./us', $string ) ) {
+               return $string;
+       }
+
+       // Attempt to strip the bad chars if requested (not recommended)
+       if ( $strip && function_exists( 'iconv' ) ) {
+               return iconv( 'utf-8', 'utf-8', $string );
+       }
+
+       return '';
+}
+
+/**
+ * Encode the Unicode values to be used in the URI.
+ *
+ * @since 1.5.0
+ *
+ * @param string $utf8_string
+ * @param int $length Max length of the string
+ * @return string String with Unicode encoded for URI.
+ */
 function utf8_uri_encode( $utf8_string, $length = 0 ) {
        $unicode = '';
        $values = array();
 function utf8_uri_encode( $utf8_string, $length = 0 ) {
        $unicode = '';
        $values = array();
@@ -180,6 +424,16 @@ function utf8_uri_encode( $utf8_string, $length = 0 ) {
        return $unicode;
 }
 
        return $unicode;
 }
 
+/**
+ * Converts all accent characters to ASCII characters.
+ *
+ * If there are no accent characters, then the string given is just returned.
+ *
+ * @since 1.2.1
+ *
+ * @param string $string Text that might have accent characters
+ * @return string Filtered string with replaced "nice" characters.
+ */
 function remove_accents($string) {
        if ( !preg_match('/[\x80-\xff]/', $string) )
                return $string;
 function remove_accents($string) {
        if ( !preg_match('/[\x80-\xff]/', $string) )
                return $string;
@@ -310,6 +564,19 @@ function remove_accents($string) {
        return $string;
 }
 
        return $string;
 }
 
+/**
+ * Filters certain characters from the file name.
+ *
+ * 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.
+ *
+ * @since 2.1.0
+ *
+ * @param string $name The file name
+ * @return string Sanitized file name
+ */
 function sanitize_file_name( $name ) { // Like sanitize_title, but with periods
        $name = strtolower( $name );
        $name = preg_replace('/&.+?;/', '', $name); // kill entities
 function sanitize_file_name( $name ) { // Like sanitize_title, but with periods
        $name = strtolower( $name );
        $name = preg_replace('/&.+?;/', '', $name); // kill entities
@@ -321,6 +588,24 @@ function sanitize_file_name( $name ) { // Like sanitize_title, but with periods
        return $name;
 }
 
        return $name;
 }
 
+/**
+ * Sanitize username stripping out unsafe characters.
+ *
+ * If $strict is true, only alphanumeric characters (as well as _, space, ., -,
+ * @) are returned.
+ * Removes tags, octets, entities, and if strict is enabled, will remove all
+ * non-ASCII characters. After sanitizing, it passes the username, raw username
+ * (the username in the parameter), and the strict parameter as parameters for
+ * the filter.
+ *
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'sanitize_user' hook on username, raw username,
+ *             and $strict parameter.
+ *
+ * @param string $username The username to be sanitized.
+ * @param bool $strict If set limits $username to specific characters. Default false.
+ * @return string The sanitized username, after passing through filters.
+ */
 function sanitize_user( $username, $strict = false ) {
        $raw_username = $username;
        $username = strip_tags($username);
 function sanitize_user( $username, $strict = false ) {
        $raw_username = $username;
        $username = strip_tags($username);
@@ -338,6 +623,19 @@ function sanitize_user( $username, $strict = false ) {
        return apply_filters('sanitize_user', $username, $raw_username, $strict);
 }
 
        return apply_filters('sanitize_user', $username, $raw_username, $strict);
 }
 
+/**
+ * Sanitizes title or use fallback title.
+ *
+ * Specifically, HTML and PHP tags are stripped. Further actions can be added
+ * via the plugin API. If $title is empty and $fallback_title is set, the latter
+ * will be used.
+ *
+ * @since 1.0.0
+ *
+ * @param string $title The string to be sanitized.
+ * @param string $fallback_title Optional. A title to use if $title is empty.
+ * @return string The sanitized string.
+ */
 function sanitize_title($title, $fallback_title = '') {
        $title = strip_tags($title);
        $title = apply_filters('sanitize_title', $title);
 function sanitize_title($title, $fallback_title = '') {
        $title = strip_tags($title);
        $title = apply_filters('sanitize_title', $title);
@@ -348,6 +646,17 @@ function sanitize_title($title, $fallback_title = '') {
        return $title;
 }
 
        return $title;
 }
 
+/**
+ * Sanitizes title, replacing whitespace with dashes.
+ *
+ * Limits the output to alphanumeric characters, underscore (_) and dash (-).
+ * Whitespace becomes a dash.
+ *
+ * @since 1.2.0
+ *
+ * @param string $title The title to be sanitized.
+ * @return string The sanitized title.
+ */
 function sanitize_title_with_dashes($title) {
        $title = strip_tags($title);
        // Preserve escaped octets.
 function sanitize_title_with_dashes($title) {
        $title = strip_tags($title);
        // Preserve escaped octets.
@@ -375,8 +684,17 @@ function sanitize_title_with_dashes($title) {
        return $title;
 }
 
        return $title;
 }
 
-// ensures a string is a valid SQL order by clause like: post_name ASC, ID DESC
-// accepts one or more columns, with or without ASC/DESC, and also accepts RAND()
+/**
+ * Ensures a string is a valid SQL order by clause.
+ *
+ * Accepts one or more columns, with or without ASC/DESC, and also accepts
+ * RAND().
+ *
+ * @since 2.5.1
+ *
+ * @param string $orderby Order by string to be checked.
+ * @return string|false Returns the order by clause if it is a match, false otherwise.
+ */
 function sanitize_sql_orderby( $orderby ){
        preg_match('/^\s*([a-z0-9_]+(\s+(ASC|DESC))?(\s*,\s*|\s*$))+|^\s*RAND\(\s*\)\s*$/i', $orderby, $obmatches);
        if ( !$obmatches )
 function sanitize_sql_orderby( $orderby ){
        preg_match('/^\s*([a-z0-9_]+(\s+(ASC|DESC))?(\s*,\s*|\s*$))+|^\s*RAND\(\s*\)\s*$/i', $orderby, $obmatches);
        if ( !$obmatches )
@@ -384,6 +702,19 @@ function sanitize_sql_orderby( $orderby ){
        return $orderby;
 }
 
        return $orderby;
 }
 
+/**
+ * Converts a number of characters from a string.
+ *
+ * Metadata tags <<title>> and <<category>> are removed, <<br>> and <<hr>> are
+ * converted into correct XHTML and Unicode characters are converted to the
+ * valid range.
+ *
+ * @since 0.71
+ *
+ * @param string $content String of characters to be converted.
+ * @param string $deprecated Not used.
+ * @return string Converted string.
+ */
 function convert_chars($content, $deprecated = '') {
        // Translation of invalid Unicode references range to valid range
        $wp_htmltranswinuni = array(
 function convert_chars($content, $deprecated = '') {
        // Translation of invalid Unicode references range to valid range
        $wp_htmltranswinuni = array(
@@ -438,42 +769,66 @@ function convert_chars($content, $deprecated = '') {
        return $content;
 }
 
        return $content;
 }
 
+/**
+ * Fixes javascript bugs in browsers.
+ *
+ * Converts unicode characters to HTML numbered entities.
+ *
+ * @since 1.5.0
+ * @uses $is_macIE
+ * @uses $is_winIE
+ *
+ * @param string $text Text to be made safe.
+ * @return string Fixed text.
+ */
 function funky_javascript_fix($text) {
        // Fixes for browsers' javascript bugs
        global $is_macIE, $is_winIE;
 
 function funky_javascript_fix($text) {
        // Fixes for browsers' javascript bugs
        global $is_macIE, $is_winIE;
 
+       /** @todo use preg_replace_callback() instead */
        if ( $is_winIE || $is_macIE )
                $text =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $text);
 
        return $text;
 }
 
        if ( $is_winIE || $is_macIE )
                $text =  preg_replace("/\%u([0-9A-F]{4,4})/e",  "'&#'.base_convert('\\1',16,10).';'", $text);
 
        return $text;
 }
 
+/**
+ * Will only balance the tags if forced to and the option is set to balance tags.
+ *
+ * The option 'use_balanceTags' is used for whether the tags will be balanced.
+ * Both the $force parameter and 'use_balanceTags' option will have to be true
+ * before the tags will be balanced.
+ *
+ * @since 0.71
+ *
+ * @param string $text Text to be balanced
+ * @param bool $force Forces balancing, ignoring the value of the option. Default false.
+ * @return string Balanced text
+ */
 function balanceTags( $text, $force = false ) {
        if ( !$force && get_option('use_balanceTags') == 0 )
                return $text;
        return force_balance_tags( $text );
 }
 
 function balanceTags( $text, $force = false ) {
        if ( !$force && get_option('use_balanceTags') == 0 )
                return $text;
        return force_balance_tags( $text );
 }
 
-/*
- force_balance_tags
-
- Balances Tags of string using a modified stack.
-
- @param text      Text to be balanced
- @param force     Forces balancing, ignoring the value of the option
- @return          Returns balanced text
- @author          Leonard Lin (leonard@acm.org)
- @version         v1.1
- @date            November 4, 2001
- @license         GPL v2.0
- @notes
- @changelog
- ---  Modified by Scott Reilly (coffee2code) 02 Aug 2004
-       1.2  ***TODO*** Make better - change loop condition to $text
-       1.1  Fixed handling of append/stack pop order of end text
-            Added Cleaning Hooks
-       1.0  First Version
-*/
+/**
+ * Balances tags of string using a modified stack.
+ *
+ * @since 2.0.4
+ *
+ * @author Leonard Lin <leonard@acm.org>
+ * @license GPL v2.0
+ * @copyright November 4, 2001
+ * @version 1.1
+ * @todo Make better - change loop condition to $text in 1.2
+ * @internal Modified by Scott Reilly (coffee2code) 02 Aug 2004
+ *             1.1  Fixed handling of append/stack pop order of end text
+ *                      Added Cleaning Hooks
+ *             1.0  First Version
+ *
+ * @param string $text Text to be balanced.
+ * @return string Balanced text.
+ */
 function force_balance_tags( $text ) {
        $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = '';
        $single_tags = array('br', 'hr', 'img', 'input'); //Known single-entity/self-closing tags
 function force_balance_tags( $text ) {
        $tagstack = array(); $stacksize = 0; $tagqueue = ''; $newtext = '';
        $single_tags = array('br', 'hr', 'img', 'input'); //Known single-entity/self-closing tags
@@ -573,6 +928,19 @@ function force_balance_tags( $text ) {
        return $newtext;
 }
 
        return $newtext;
 }
 
+/**
+ * Acts on text which is about to be edited.
+ *
+ * Unless $richedit is set, it is simply a holder for the 'format_to_edit'
+ * filter. If $richedit is set true htmlspecialchars() will be run on the
+ * content, converting special characters to HTMl entities.
+ *
+ * @since 0.71
+ *
+ * @param string $content The text about to be edited.
+ * @param bool $richedit Whether or not the $content should pass through htmlspecialchars(). Default false.
+ * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
+ */
 function format_to_edit($content, $richedit = false) {
        $content = apply_filters('format_to_edit', $content);
        if (! $richedit )
 function format_to_edit($content, $richedit = false) {
        $content = apply_filters('format_to_edit', $content);
        if (! $richedit )
@@ -580,30 +948,99 @@ function format_to_edit($content, $richedit = false) {
        return $content;
 }
 
        return $content;
 }
 
+/**
+ * Holder for the 'format_to_post' filter.
+ *
+ * @since 0.71
+ *
+ * @param string $content The text to pass through the filter.
+ * @return string Text returned from the 'format_to_post' filter.
+ */
 function format_to_post($content) {
        $content = apply_filters('format_to_post', $content);
        return $content;
 }
 
 function format_to_post($content) {
        $content = apply_filters('format_to_post', $content);
        return $content;
 }
 
-function zeroise($number,$threshold) { // function to add leading zeros when necessary
+/**
+ * Add leading zeros when necessary.
+ *
+ * If you set the threshold to '4' and the number is '10', then you will get
+ * back '0010'. If you set the number to '4' and the number is '5000', then you
+ * will get back '5000'.
+ *
+ * Uses sprintf to append the amount of zeros based on the $threshold parameter
+ * and the size of the number. If the number is large enough, then no zeros will
+ * be appended.
+ *
+ * @since 0.71
+ *
+ * @param mixed $number Number to append zeros to if not greater than threshold.
+ * @param int $threshold Digit places number needs to be to not have zeros added.
+ * @return string Adds leading zeros to number if needed.
+ */
+function zeroise($number, $threshold) {
        return sprintf('%0'.$threshold.'s', $number);
 }
 
        return sprintf('%0'.$threshold.'s', $number);
 }
 
-
+/**
+ * Adds backslashes before letters and before a number at the start of a string.
+ *
+ * @since 0.71
+ *
+ * @param string $string Value to which backslashes will be added.
+ * @return string String with backslashes inserted.
+ */
 function backslashit($string) {
        $string = preg_replace('/^([0-9])/', '\\\\\\\\\1', $string);
        $string = preg_replace('/([a-z])/i', '\\\\\1', $string);
        return $string;
 }
 
 function backslashit($string) {
        $string = preg_replace('/^([0-9])/', '\\\\\\\\\1', $string);
        $string = preg_replace('/([a-z])/i', '\\\\\1', $string);
        return $string;
 }
 
+/**
+ * Appends a trailing slash.
+ *
+ * Will remove trailing slash if it exists already before adding a trailing
+ * slash. This prevents double slashing a string or path.
+ *
+ * The primary use of this is for paths and thus should be used for paths. It is
+ * not restricted to paths and offers no specific path support.
+ *
+ * @since 1.2.0
+ * @uses untrailingslashit() Unslashes string if it was slashed already.
+ *
+ * @param string $string What to add the trailing slash to.
+ * @return string String with trailing slash added.
+ */
 function trailingslashit($string) {
        return untrailingslashit($string) . '/';
 }
 
 function trailingslashit($string) {
        return untrailingslashit($string) . '/';
 }
 
+/**
+ * Removes trailing slash if it exists.
+ *
+ * The primary use of this is for paths and thus should be used for paths. It is
+ * not restricted to paths and offers no specific path support.
+ *
+ * @since 2.2.0
+ *
+ * @param string $string What to remove the trailing slash from.
+ * @return string String without the trailing slash.
+ */
 function untrailingslashit($string) {
        return rtrim($string, '/');
 }
 
 function untrailingslashit($string) {
        return rtrim($string, '/');
 }
 
+/**
+ * Adds slashes to escape strings.
+ *
+ * Slashes will first be removed if magic_quotes_gpc is set, see {@link
+ * http://www.php.net/magic_quotes} for more details.
+ *
+ * @since 0.71
+ *
+ * @param string $gpc The string returned from HTTP request data.
+ * @return string Returns a string escaped with slashes.
+ */
 function addslashes_gpc($gpc) {
        global $wpdb;
 
 function addslashes_gpc($gpc) {
        global $wpdb;
 
@@ -614,23 +1051,47 @@ function addslashes_gpc($gpc) {
        return $wpdb->escape($gpc);
 }
 
        return $wpdb->escape($gpc);
 }
 
-
+/**
+ * Navigates through an array and removes slashes from the values.
+ *
+ * If an array is passed, the array_map() function causes a callback to pass the
+ * value back to the function. The slashes from this value will removed.
+ *
+ * @since 2.0.0
+ *
+ * @param array|string $value The array or string to be striped.
+ * @return array|string Stripped array (or string in the callback).
+ */
 function stripslashes_deep($value) {
 function stripslashes_deep($value) {
-        $value = is_array($value) ?
-                array_map('stripslashes_deep', $value) :
-                stripslashes($value);
-
-        return $value;
+       $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value);
+       return $value;
 }
 
 }
 
+/**
+ * Navigates through an array and encodes the values to be used in a URL.
+ *
+ * Uses a callback to pass the value of the array back to the function as a
+ * string.
+ *
+ * @since 2.2.0
+ *
+ * @param array|string $value The array or string to be encoded.
+ * @return array|string $value The encoded array (or string from the callback).
+ */
 function urlencode_deep($value) {
 function urlencode_deep($value) {
-        $value = is_array($value) ?
-                array_map('urlencode_deep', $value) :
-                urlencode($value);
-
-        return $value;
+       $value = is_array($value) ? array_map('urlencode_deep', $value) : urlencode($value);
+       return $value;
 }
 
 }
 
+/**
+ * Converts email addresses characters to HTML entities to block spam bots.
+ *
+ * @since 0.71
+ *
+ * @param string $emailaddy Email address.
+ * @param int $mailto Optional. Range from 0 to 1. Used for encoding.
+ * @return string Converted email address.
+ */
 function antispambot($emailaddy, $mailto=0) {
        $emailNOSPAMaddy = '';
        srand ((float) microtime() * 1000000);
 function antispambot($emailaddy, $mailto=0) {
        $emailNOSPAMaddy = '';
        srand ((float) microtime() * 1000000);
@@ -648,6 +1109,18 @@ function antispambot($emailaddy, $mailto=0) {
        return $emailNOSPAMaddy;
 }
 
        return $emailNOSPAMaddy;
 }
 
+/**
+ * Callback to convert URI match to HTML A element.
+ *
+ * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
+ * make_clickable()}.
+ *
+ * @since 2.3.2
+ * @access private
+ *
+ * @param array $matches Single Regex Match.
+ * @return string HTML A element with URI address.
+ */
 function _make_url_clickable_cb($matches) {
        $ret = '';
        $url = $matches[2];
 function _make_url_clickable_cb($matches) {
        $ret = '';
        $url = $matches[2];
@@ -662,6 +1135,18 @@ function _make_url_clickable_cb($matches) {
        return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $ret;
 }
 
        return $matches[1] . "<a href=\"$url\" rel=\"nofollow\">$url</a>" . $ret;
 }
 
+/**
+ * Callback to convert URL match to HTML A element.
+ *
+ * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
+ * make_clickable()}.
+ *
+ * @since 2.3.2
+ * @access private
+ *
+ * @param array $matches Single Regex Match.
+ * @return string HTML A element with URL address.
+ */
 function _make_web_ftp_clickable_cb($matches) {
        $ret = '';
        $dest = $matches[2];
 function _make_web_ftp_clickable_cb($matches) {
        $ret = '';
        $dest = $matches[2];
@@ -677,16 +1162,39 @@ function _make_web_ftp_clickable_cb($matches) {
        return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>" . $ret;
 }
 
        return $matches[1] . "<a href=\"$dest\" rel=\"nofollow\">$dest</a>" . $ret;
 }
 
+/**
+ * Callback to convert email address match to HTML A element.
+ *
+ * This function was backported from 2.5.0 to 2.3.2. Regex callback for {@link
+ * make_clickable()}.
+ *
+ * @since 2.3.2
+ * @access private
+ *
+ * @param array $matches Single Regex Match.
+ * @return string HTML A element with email address.
+ */
 function _make_email_clickable_cb($matches) {
        $email = $matches[2] . '@' . $matches[3];
        return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
 }
 
 function _make_email_clickable_cb($matches) {
        $email = $matches[2] . '@' . $matches[3];
        return $matches[1] . "<a href=\"mailto:$email\">$email</a>";
 }
 
+/**
+ * Convert plaintext URI to HTML links.
+ *
+ * Converts URI, www and ftp, and email addresses. Finishes by fixing links
+ * within links.
+ *
+ * @since 0.71
+ *
+ * @param string $ret Content to convert URIs.
+ * @return string Content with converted URIs.
+ */
 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\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_url_clickable_cb', $ret);
-       $ret = preg_replace_callback('#([\s>])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is', '_make_web_ftp_clickable_cb', $ret);
+       $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>])([.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);
@@ -694,6 +1202,14 @@ function make_clickable($ret) {
        return $ret;
 }
 
        return $ret;
 }
 
+/**
+ * Adds rel nofollow string to all HTML A elements in content.
+ *
+ * @since 1.5.0
+ *
+ * @param string $text Content that may contain HTML A elements.
+ * @return string Converted content.
+ */
 function wp_rel_nofollow( $text ) {
        global $wpdb;
        // This is a pre save filter, so text is already escaped.
 function wp_rel_nofollow( $text ) {
        global $wpdb;
        // This is a pre save filter, so text is already escaped.
@@ -703,15 +1219,38 @@ function wp_rel_nofollow( $text ) {
        return $text;
 }
 
        return $text;
 }
 
+/**
+ * Callback to used to add rel=nofollow string to HTML A element.
+ *
+ * Will remove already existing rel="nofollow" and rel='nofollow' from the
+ * string to prevent from invalidating (X)HTML.
+ *
+ * @since 2.3.0
+ *
+ * @param array $matches Single Match
+ * @return string HTML A Element with rel nofollow.
+ */
 function wp_rel_nofollow_callback( $matches ) {
        $text = $matches[1];
        $text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
        return "<a $text rel=\"nofollow\">";
 }
 
 function wp_rel_nofollow_callback( $matches ) {
        $text = $matches[1];
        $text = str_replace(array(' rel="nofollow"', " rel='nofollow'"), '', $text);
        return "<a $text rel=\"nofollow\">";
 }
 
+/**
+ * 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.
+ *
+ * @since 0.71
+ * @uses $wp_smiliessearch, $wp_smiliesreplace Smiley replacement arrays.
+ *
+ * @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;
 function convert_smilies($text) {
        global $wp_smiliessearch, $wp_smiliesreplace;
-    $output = '';
+       $output = '';
        if ( get_option('use_smilies') && !empty($wp_smiliessearch) && !empty($wp_smiliesreplace) ) {
                // 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
        if ( get_option('use_smilies') && !empty($wp_smiliessearch) && !empty($wp_smiliesreplace) ) {
                // 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
@@ -730,7 +1269,14 @@ function convert_smilies($text) {
        return $output;
 }
 
        return $output;
 }
 
-
+/**
+ * Checks to see if the text is a valid email address.
+ *
+ * @since 0.71
+ *
+ * @param string $user_email The email address to be checked.
+ * @return bool Returns true if valid, otherwise false.
+ */
 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) {
 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) {
@@ -744,80 +1290,157 @@ function is_email($user_email) {
        }
 }
 
        }
 }
 
-// used by wp-mail to handle charsets in email subjects
+/**
+ * Convert to ASCII from email subjects.
+ *
+ * @since 1.2.0
+ * @usedby wp_mail() handles charsets in email subjects
+ *
+ * @param string $string Subject line
+ * @return string Converted string to ASCII
+ */
 function wp_iso_descrambler($string) {
 function wp_iso_descrambler($string) {
-  /* this may only work with iso-8859-1, I'm afraid */
-  if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
-    return $string;
-  } else {
-    $subject = str_replace('_', ' ', $matches[2]);
-    $subject = preg_replace('#\=([0-9a-f]{2})#ei', "chr(hexdec(strtolower('$1')))", $subject);
-    return $subject;
-  }
+       /* this may only work with iso-8859-1, I'm afraid */
+       if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) {
+               return $string;
+       } else {
+               $subject = str_replace('_', ' ', $matches[2]);
+               $subject = preg_replace_callback('#\=([0-9a-f]{2})#i', create_function('$match', 'return chr(hexdec(strtolower($match[1])));'), $subject);
+               return $subject;
+       }
 }
 
 }
 
-
-// give it a date, it will give you the same date as GMT
+/**
+ * Returns a date in the GMT equivalent.
+ *
+ * Requires and returns a date in the Y-m-d H:i:s format. Simply subtracts the
+ * value of the 'gmt_offset' option.
+ *
+ * @since 1.2.0
+ *
+ * @uses get_option() to retrieve the the value of 'gmt_offset'.
+ * @param string $string The date to be converted.
+ * @return string GMT version of the date provided.
+ */
 function get_gmt_from_date($string) {
 function get_gmt_from_date($string) {
-  // note: this only substracts $time_difference from the given date
-  preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
-  $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
-  $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600);
-  return $string_gmt;
+       preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
+       $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
+       $string_gmt = gmdate('Y-m-d H:i:s', $string_time - get_option('gmt_offset') * 3600);
+       return $string_gmt;
 }
 
 }
 
-// give it a GMT date, it will give you the same date with $time_difference added
+/**
+ * Converts a GMT date into the correct format for the blog.
+ *
+ * Requires and returns in the Y-m-d H:i:s format. Simply adds the value of
+ * gmt_offset.
+ *
+ * @since 1.2.0
+ *
+ * @param string $string The date to be converted.
+ * @return string Formatted date relative to the GMT offset.
+ */
 function get_date_from_gmt($string) {
 function get_date_from_gmt($string) {
-  // note: this only adds $time_difference to the given date
-  preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
-  $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
-  $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600);
-  return $string_localtime;
+       preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
+       $string_time = gmmktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
+       $string_localtime = gmdate('Y-m-d H:i:s', $string_time + get_option('gmt_offset')*3600);
+       return $string_localtime;
 }
 
 }
 
-// computes an offset in seconds from an iso8601 timezone
+/**
+ * Computes an offset in seconds from an iso8601 timezone.
+ *
+ * @since 1.5.0
+ *
+ * @param string $timezone Either 'Z' for 0 offset or '±hhmm'.
+ * @return int|float The offset in seconds.
+ */
 function iso8601_timezone_to_offset($timezone) {
 function iso8601_timezone_to_offset($timezone) {
-  // $timezone is either 'Z' or '[+|-]hhmm'
-  if ($timezone == 'Z') {
-    $offset = 0;
-  } else {
-    $sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1;
-    $hours   = intval(substr($timezone, 1, 2));
-    $minutes = intval(substr($timezone, 3, 4)) / 60;
-    $offset  = $sign * 3600 * ($hours + $minutes);
-  }
-  return $offset;
-}
-
-// converts an iso8601 date to MySQL DateTime format used by post_date[_gmt]
-function iso8601_to_datetime($date_string, $timezone = USER) {
-  if ($timezone == GMT) {
-    preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
-    if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
-      $offset = iso8601_timezone_to_offset($date_bits[7]);
-    } else { // we don't have a timezone, so we assume user local timezone (not server's!)
-      $offset = 3600 * get_option('gmt_offset');
-    }
-    $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
-    $timestamp -= $offset;
-    return gmdate('Y-m-d H:i:s', $timestamp);
-  } elseif ($timezone == USER) {
-    return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);
-  }
+       // $timezone is either 'Z' or '[+|-]hhmm'
+       if ($timezone == 'Z') {
+               $offset = 0;
+       } else {
+               $sign    = (substr($timezone, 0, 1) == '+') ? 1 : -1;
+               $hours   = intval(substr($timezone, 1, 2));
+               $minutes = intval(substr($timezone, 3, 4)) / 60;
+               $offset  = $sign * 3600 * ($hours + $minutes);
+       }
+       return $offset;
 }
 
 }
 
+/**
+ * Converts an iso8601 date to MySQL DateTime format used by post_date[_gmt].
+ *
+ * @since 1.5.0
+ *
+ * @param string $date_string Date and time in ISO 8601 format {@link http://en.wikipedia.org/wiki/ISO_8601}.
+ * @param string $timezone Optional. If set to GMT returns the time minus gmt_offset. Default is 'user'.
+ * @return string The date and time in MySQL DateTime format - Y-m-d H:i:s.
+ */
+function iso8601_to_datetime($date_string, $timezone = 'user') {
+       $timezone = strtolower($timezone);
+
+       if ($timezone == 'gmt') {
+
+               preg_match('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', $date_string, $date_bits);
+
+               if (!empty($date_bits[7])) { // we have a timezone, so let's compute an offset
+                       $offset = iso8601_timezone_to_offset($date_bits[7]);
+               } else { // we don't have a timezone, so we assume user local timezone (not server's!)
+                       $offset = 3600 * get_option('gmt_offset');
+               }
+
+               $timestamp = gmmktime($date_bits[4], $date_bits[5], $date_bits[6], $date_bits[2], $date_bits[3], $date_bits[1]);
+               $timestamp -= $offset;
+
+               return gmdate('Y-m-d H:i:s', $timestamp);
+
+       } else if ($timezone == 'user') {
+               return preg_replace('#([0-9]{4})([0-9]{2})([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(Z|[\+|\-][0-9]{2,4}){0,1}#', '$1-$2-$3 $4:$5:$6', $date_string);
+       }
+}
+
+/**
+ * Adds a element attributes to open links in new windows.
+ *
+ * Comment text in popup windows should be filtered through this. Right now it's
+ * a moderately dumb function, ideally it would detect whether a target or rel
+ * attribute was already there and adjust its actions accordingly.
+ *
+ * @since 0.71
+ *
+ * @param string $text Content to replace links to open in a new window.
+ * @return string Content that has filtered links.
+ */
 function popuplinks($text) {
 function popuplinks($text) {
-       // Comment text in popup windows should be filtered through this.
-       // Right now it's a moderately dumb function, ideally it would detect whether
-       // a target or rel attribute was already there and adjust its actions accordingly.
        $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
        return $text;
 }
 
        $text = preg_replace('/<a (.+?)>/i', "<a $1 target='_blank' rel='external'>", $text);
        return $text;
 }
 
+/**
+ * Strips out all characters that are not allowable in an email.
+ *
+ * @since 1.5.0
+ *
+ * @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) {
        return preg_replace('/[^a-z0-9+_.@-]/i', '', $email);
 }
 
+/**
+ * Determines the difference between two timestamps.
+ *
+ * The difference is returned in a human readable format such as "1 hour",
+ * "5 mins", "2 days".
+ *
+ * @since 1.5.0
+ *
+ * @param int $from Unix timestamp from which the difference begins.
+ * @param int $to Optional. Unix timestamp to end the time difference. Default becomes time() if not set.
+ * @return string Human readable time difference.
+ */
 function human_time_diff( $from, $to = '' ) {
        if ( empty($to) )
                $to = time();
 function human_time_diff( $from, $to = '' ) {
        if ( empty($to) )
                $to = time();
@@ -844,16 +1467,28 @@ function human_time_diff( $from, $to = '' ) {
        return $since;
 }
 
        return $since;
 }
 
-function wp_trim_excerpt($text) { // Fakes an excerpt if needed
+/**
+ * Generates an excerpt from the content, if needed.
+ *
+ * The excerpt word amount will be 55 words and if the amount is greater than
+ * that, then the string '[...]' will be appended to the excerpt. If the string
+ * is less than 55 words, then the content will be returned as is.
+ *
+ * @since 1.5.0
+ *
+ * @param string $text The exerpt. If set to empty an excerpt is generated.
+ * @return string The excerpt.
+ */
+function wp_trim_excerpt($text) {
        if ( '' == $text ) {
                $text = get_the_content('');
        if ( '' == $text ) {
                $text = get_the_content('');
-               
-               $text = strip_shortcodes( $text ); 
-               
+
+               $text = strip_shortcodes( $text );
+
                $text = apply_filters('the_content', $text);
                $text = str_replace(']]>', ']]&gt;', $text);
                $text = strip_tags($text);
                $text = apply_filters('the_content', $text);
                $text = str_replace(']]>', ']]&gt;', $text);
                $text = strip_tags($text);
-               $excerpt_length = 55;
+               $excerpt_length = apply_filters('excerpt_length', 55);
                $words = explode(' ', $text, $excerpt_length + 1);
                if (count($words) > $excerpt_length) {
                        array_pop($words);
                $words = explode(' ', $text, $excerpt_length + 1);
                if (count($words) > $excerpt_length) {
                        array_pop($words);
@@ -864,6 +1499,14 @@ function wp_trim_excerpt($text) { // Fakes an excerpt if needed
        return $text;
 }
 
        return $text;
 }
 
+/**
+ * Converts named entities into numbered entities.
+ *
+ * @since 1.5.1
+ *
+ * @param string $text The text within which entities will be converted.
+ * @return string Text with converted entities.
+ */
 function ent2ncr($text) {
        $to_ncr = array(
                '&quot;' => '&#34;',
 function ent2ncr($text) {
        $to_ncr = array(
                '&quot;' => '&#34;',
@@ -1128,6 +1771,17 @@ function ent2ncr($text) {
        return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
 }
 
        return str_replace( array_keys($to_ncr), array_values($to_ncr), $text );
 }
 
+/**
+ * Formats text for the rich text editor.
+ *
+ * The filter 'richedit_pre' is applied here. If $text is empty the filter will
+ * be applied to an empty string.
+ *
+ * @since 2.0.0
+ *
+ * @param string $text The text to be formatted.
+ * @return string The formatted text after filter is applied.
+ */
 function wp_richedit_pre($text) {
        // Filtering a blank results in an annoying <br />\n
        if ( empty($text) ) return apply_filters('richedit_pre', '');
 function wp_richedit_pre($text) {
        // Filtering a blank results in an annoying <br />\n
        if ( empty($text) ) return apply_filters('richedit_pre', '');
@@ -1139,6 +1793,17 @@ function wp_richedit_pre($text) {
        return apply_filters('richedit_pre', $output);
 }
 
        return apply_filters('richedit_pre', $output);
 }
 
+/**
+ * Formats text for the HTML editor.
+ *
+ * Unless $output is empty it will pass through htmlspecialchars before the
+ * 'htmledit_pre' filter is applied.
+ *
+ * @since 2.5.0
+ *
+ * @param string $output The text to be formatted.
+ * @return string Formatted text after filter applied.
+ */
 function wp_htmledit_pre($output) {
        if ( !empty($output) )
                $output = htmlspecialchars($output, ENT_NOQUOTES); // convert only < > &
 function wp_htmledit_pre($output) {
        if ( !empty($output) )
                $output = htmlspecialchars($output, ENT_NOQUOTES); // convert only < > &
@@ -1146,25 +1811,44 @@ function wp_htmledit_pre($output) {
        return apply_filters('htmledit_pre', $output);
 }
 
        return apply_filters('htmledit_pre', $output);
 }
 
+/**
+ * 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
+ * is applied to the returned cleaned URL.
+ *
+ * @since 1.2.0
+ * @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.
+ * @param string $context Optional. How the URL will be used. Default is 'display'.
+ * @return string The cleaned $url after the 'cleaned_url' filter is applied.
+ */
 function clean_url( $url, $protocols = null, $context = 'display' ) {
        $original_url = $url;
 
        if ('' == $url) return $url;
 function clean_url( $url, $protocols = null, $context = 'display' ) {
        $original_url = $url;
 
        if ('' == $url) return $url;
-       $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@()]|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);
        /* If the URL doesn't appear to contain a scheme, we
         * presume it needs http:// appended (unless a relative
         * link starting with / or a php file).
        $strip = array('%0d', '%0a');
        $url = str_replace($strip, '', $url);
        $url = str_replace(';//', '://', $url);
        /* If the URL doesn't appear to contain a scheme, we
         * presume it needs http:// appended (unless a relative
         * link starting with / or a php file).
-       */
+        */
        if ( strpos($url, ':') === false &&
                substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
                $url = 'http://' . $url;
 
        if ( strpos($url, ':') === false &&
                substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) )
                $url = 'http://' . $url;
 
-       // Replace ampersands ony when displaying.
-       if ( 'display' == $context )
+       // Replace ampersands and single quotes only when displaying.
+       if ( 'display' == $context ) {
                $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
                $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&#038;$1', $url);
+               $url = str_replace( "'", '&#039;', $url );
+       }
 
        if ( !is_array($protocols) )
                $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
 
        if ( !is_array($protocols) )
                $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');
@@ -1174,59 +1858,134 @@ function clean_url( $url, $protocols = null, $context = 'display' ) {
        return apply_filters('clean_url', $url, $original_url, $context);
 }
 
        return apply_filters('clean_url', $url, $original_url, $context);
 }
 
+/**
+ * Performs clean_url() for database usage.
+ *
+ * @see clean_url()
+ *
+ * @since 2.3.1
+ *
+ * @param string $url The URL to be cleaned.
+ * @param array $protocols An array of acceptable protocols.
+ * @return string The cleaned URL.
+ */
 function sanitize_url( $url, $protocols = null ) {
 function sanitize_url( $url, $protocols = null ) {
-       return clean_url( $url, $protocols, 'db');
+       return clean_url( $url, $protocols, 'db' );
 }
 
 }
 
-// Borrowed from the PHP Manual user notes. Convert entities, while
-// preserving already-encoded entities:
+/**
+ * Convert entities, while preserving already-encoded entities.
+ *
+ * @link http://www.php.net/htmlentities Borrowed from the PHP Manual user notes.
+ *
+ * @since 1.2.2
+ *
+ * @param string $myHTML The text to be converted.
+ * @return string Converted text.
+ */
 function htmlentities2($myHTML) {
 function htmlentities2($myHTML) {
-       $translation_table=get_html_translation_table (HTML_ENTITIES,ENT_QUOTES);
+       $translation_table = get_html_translation_table( HTML_ENTITIES, ENT_QUOTES );
        $translation_table[chr(38)] = '&';
        $translation_table[chr(38)] = '&';
-       return preg_replace("/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/","&amp;" , strtr($myHTML, $translation_table));
+       return preg_replace( "/&(?![A-Za-z]{0,4}\w{2,3};|#[0-9]{2,3};)/", "&amp;", strtr($myHTML, $translation_table) );
 }
 
 }
 
-// Escape single quotes, specialchar double quotes, and fix line endings.
+/**
+ * Escape single quotes, specialchar double quotes, and fix line endings.
+ *
+ * The filter 'js_escape' is also applied here.
+ *
+ * @since 2.0.4
+ *
+ * @param string $text The text to be escaped.
+ * @return string Escaped text.
+ */
 function js_escape($text) {
 function js_escape($text) {
-       $safe_text = wp_specialchars($text, 'double');
-       $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 = wp_check_invalid_utf8( $text );
+       $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 );
 }
 
 }
 
-// Escaping for HTML attributes
-function attribute_escape($text) {
-       $safe_text = wp_specialchars($text, true);
-       return apply_filters('attribute_escape', $safe_text, $text);
+/**
+ * Escaping for HTML attributes.
+ *
+ * @since 2.0.6
+ *
+ * @param string $text
+ * @return string
+ */
+function attribute_escape( $text ) {
+       $safe_text = wp_check_invalid_utf8( $text );
+       $safe_text = wp_specialchars( $safe_text, ENT_QUOTES );
+       return apply_filters( 'attribute_escape', $safe_text, $text );
 }
 
 }
 
-// Escape a HTML tag name
+/**
+ * Escape a HTML tag name.
+ *
+ * @since 2.5.0
+ *
+ * @param string $tag_name
+ * @return string
+ */
 function tag_escape($tag_name) {
 function tag_escape($tag_name) {
-       $safe_tag = strtolower( preg_replace('[^a-zA-Z_:]', '', $tag_name) );
+       $safe_tag = strtolower( preg_replace('/[^a-zA-Z_:]/', '', $tag_name) );
        return apply_filters('tag_escape', $safe_tag, $tag_name);
 }
 
 /**
        return apply_filters('tag_escape', $safe_tag, $tag_name);
 }
 
 /**
- * Escapes text for SQL LIKE special characters % and _
+ * Escapes text for SQL LIKE special characters % and _.
+ *
+ * @since 2.5.0
  *
  *
- * @param string text the text to be escaped
- * @return string text, safe for inclusion in LIKE query
+ * @param string $text The text to be escaped.
+ * @return string text, safe for inclusion in LIKE query.
  */
 function like_escape($text) {
        return str_replace(array("%", "_"), array("\\%", "\\_"), $text);
 }
 
  */
 function like_escape($text) {
        return str_replace(array("%", "_"), array("\\%", "\\_"), $text);
 }
 
+/**
+ * Convert full URL paths to absolute paths.
+ *
+ * Removes the http or https protocols and the domain. Keeps the path '/' at the
+ * beginning, so it isn't a true relative link, but from the web root base.
+ *
+ * @since 2.1.0
+ *
+ * @param string $link Full URL path.
+ * @return string Absolute path.
+ */
 function wp_make_link_relative( $link ) {
 function wp_make_link_relative( $link ) {
-       return preg_replace('|https?://[^/]+(/.*)|i', '$1', $link );
+       return preg_replace( '|https?://[^/]+(/.*)|i', '$1', $link );
 }
 
 }
 
-function sanitize_option($option, $value) { // Remember to call stripslashes!
+/**
+ * Sanitises various option values based on the nature of the option.
+ *
+ * This is basically a switch statement which will pass $value through a number
+ * of functions depending on the $option.
+ *
+ * @since 2.0.5
+ *
+ * @param string $option The name of the option.
+ * @param string $value The unsanitised value.
+ * @return string Sanitized value.
+ */
+function sanitize_option($option, $value) {
 
        switch ($option) {
                case 'admin_email':
                        $value = sanitize_email($value);
                        break;
 
 
        switch ($option) {
                case 'admin_email':
                        $value = sanitize_email($value);
                        break;
 
+               case 'thumbnail_size_w':
+               case 'thumbnail_size_h':
+               case 'medium_size_w':
+               case 'medium_size_h':
+               case 'large_size_w':
+               case 'large_size_h':
                case 'default_post_edit_rows':
                case 'mailserver_port':
                case 'comment_max_links':
                case 'default_post_edit_rows':
                case 'mailserver_port':
                case 'comment_max_links':
@@ -1235,6 +1994,9 @@ function sanitize_option($option, $value) { // Remember to call stripslashes!
                case 'default_category':
                case 'default_email_category':
                case 'default_link_category':
                case 'default_category':
                case 'default_email_category':
                case 'default_link_category':
+               case 'close_comments_days_old':
+               case 'comments_per_page':
+               case 'thread_comments_depth':
                        $value = abs((int) $value);
                        break;
 
                        $value = abs((int) $value);
                        break;
 
@@ -1294,18 +2056,49 @@ function sanitize_option($option, $value) { // Remember to call stripslashes!
        return $value;
 }
 
        return $value;
 }
 
+/**
+ * Parses a string into variables to be stored in an array.
+ *
+ * Uses {@link http://www.php.net/parse_str parse_str()} and stripslashes if
+ * {@link http://www.php.net/magic_quotes magic_quotes_gpc} is on.
+ *
+ * @since 2.2.1
+ * @uses apply_filters() for the 'wp_parse_str' filter.
+ *
+ * @param string $string The string to be parsed.
+ * @param array $array Variables will be stored in this array.
+ */
 function wp_parse_str( $string, &$array ) {
        parse_str( $string, $array );
        if ( get_magic_quotes_gpc() )
 function wp_parse_str( $string, &$array ) {
        parse_str( $string, $array );
        if ( get_magic_quotes_gpc() )
-               $array = stripslashes_deep( $array ); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str
+               $array = stripslashes_deep( $array );
        $array = apply_filters( 'wp_parse_str', $array );
 }
 
        $array = apply_filters( 'wp_parse_str', $array );
 }
 
-// Convert lone less than signs.  KSES already converts lone greater than signs.
+/**
+ * Convert lone less than signs.
+ *
+ * KSES already converts lone greater than signs.
+ *
+ * @uses wp_pre_kses_less_than_callback in the callback function.
+ * @since 2.3.0
+ *
+ * @param string $text Text to be converted.
+ * @return string Converted text.
+ */
 function wp_pre_kses_less_than( $text ) {
        return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text);
 }
 
 function wp_pre_kses_less_than( $text ) {
        return preg_replace_callback('%<[^>]*?((?=<)|>|$)%', 'wp_pre_kses_less_than_callback', $text);
 }
 
+/**
+ * Callback function used by preg_replace.
+ *
+ * @uses wp_specialchars to format the $matches text.
+ * @since 2.3.0
+ *
+ * @param array $matches Populated by matches to preg_replace.
+ * @return string The text returned after wp_specialchars if needed.
+ */
 function wp_pre_kses_less_than_callback( $matches ) {
        if ( false === strpos($matches[0], '>') )
                return wp_specialchars($matches[0]);
 function wp_pre_kses_less_than_callback( $matches ) {
        if ( false === strpos($matches[0], '>') )
                return wp_specialchars($matches[0]);
@@ -1313,7 +2106,14 @@ function wp_pre_kses_less_than_callback( $matches ) {
 }
 
 /**
 }
 
 /**
- * wp_sprintf() - sprintf() with filters
+ * WordPress implementation of PHP sprintf() with filters.
+ *
+ * @since 2.5.0
+ * @link http://www.php.net/sprintf
+ *
+ * @param string $pattern The string which formatted args are inserted.
+ * @param mixed $args,... Arguments to be formatted into the $pattern string.
+ * @return string The formatted string.
  */
 function wp_sprintf( $pattern ) {
        $args = func_get_args( );
  */
 function wp_sprintf( $pattern ) {
        $args = func_get_args( );
@@ -1368,11 +2168,17 @@ function wp_sprintf( $pattern ) {
 }
 
 /**
 }
 
 /**
- * wp_sprintf_l - List specifier %l for wp_sprintf
+ * Localize list items before the rest of the content.
+ *
+ * The '%l' must be at the first characters can then contain the rest of the
+ * content. The list items will have ', ', ', and', and ' and ' added depending
+ * on the amount of list items in the $args parameter.
  *
  *
- * @param unknown_type $pattern
- * @param unknown_type $args
- * @return unknown
+ * @since 2.5.0
+ *
+ * @param string $pattern Content containing '%l' at the beginning.
+ * @param array $args List items to prepend to the content and replace '%l'.
+ * @return string Localized list items and rest of the content.
  */
 function wp_sprintf_l($pattern, $args) {
        // Not a match
  */
 function wp_sprintf_l($pattern, $args) {
        // Not a match
@@ -1395,8 +2201,10 @@ function wp_sprintf_l($pattern, $args) {
        if ( count($args) == 1 )
                $result .= $l['between_only_two'] . array_shift($args);
        // Loop when more than two args
        if ( count($args) == 1 )
                $result .= $l['between_only_two'] . array_shift($args);
        // Loop when more than two args
-       while ( count($args) ) {
+       $i = count($args);
+       while ( $i ) {
                $arg = array_shift($args);
                $arg = array_shift($args);
+               $i--;
                if ( $i == 1 )
                        $result .= $l['between_last_two'] . $arg;
                else
                if ( $i == 1 )
                        $result .= $l['between_last_two'] . $arg;
                else
@@ -1406,14 +2214,17 @@ function wp_sprintf_l($pattern, $args) {
 }
 
 /**
 }
 
 /**
- * Safely extracts not more than the first $count characters from html string
+ * Safely extracts not more than the first $count characters from html string.
+ *
+ * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT*
+ * be counted as one character. For example &amp; will be counted as 4, &lt; as
+ * 3, etc.
  *
  *
- * UTF-8, tags and entities safe prefix extraction. Entities inside will *NOT* be
- * counted as one character. For example &amp; will be counted as 4, &lt; as 3, etc.
+ * @since 2.5.0
  *
  *
- * @param integer $str String to get the excerpt from
- * @param integer $count Maximum number of characters to take
- * @eaturn string the excerpt
+ * @param integer $str String to get the excerpt from.
+ * @param integer $count Maximum number of characters to take.
+ * @return string The excerpt.
  */
 function wp_html_excerpt( $str, $count ) {
        $str = strip_tags( $str );
  */
 function wp_html_excerpt( $str, $count ) {
        $str = strip_tags( $str );
@@ -1423,4 +2234,88 @@ function wp_html_excerpt( $str, $count ) {
        return $str;
 }
 
        return $str;
 }
 
+/**
+ * Add a Base url to relative links in passed content.
+ *
+ * By default it supports the 'src' and 'href' attributes. However this can be
+ * changed via the 3rd param.
+ *
+ * @since 2.7.0
+ *
+ * @param string $content String to search for links in.
+ * @param string $base The base URL to prefix to links.
+ * @param array $attrs The attributes which should be processed.
+ * @return string The processed content.
+ */
+function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) {
+       $attrs = implode('|', (array)$attrs);
+       return preg_replace_callback("!($attrs)=(['\"])(.+?)\\2!i",
+                       create_function('$m', 'return _links_add_base($m, "' . $base . '");'),
+                       $content);
+}
+
+/**
+ * Callback to add a base url to relative links in passed content.
+ *
+ * @since 2.7.0
+ * @access private
+ *
+ * @param string $m The matched link.
+ * @param string $base The base URL to prefix to links.
+ * @return string The processed link.
+ */
+function _links_add_base($m, $base) {
+       //1 = attribute name  2 = quotation mark  3 = URL
+       return $m[1] . '=' . $m[2] .
+               (strpos($m[3], 'http://') === false ?
+                       path_join($base, $m[3]) :
+                       $m[3])
+               . $m[2];
+}
+
+/**
+ * Adds a Target attribute to all links in passed content.
+ *
+ * This function by default only applies to <a> tags, however this can be
+ * modified by the 3rd param.
+ *
+ * <b>NOTE:</b> Any current target attributed will be striped and replaced.
+ *
+ * @since 2.7.0
+ *
+ * @param string $content String to search for links in.
+ * @param string $target The Target to add to the links.
+ * @param array $tags An array of tags to apply to.
+ * @return string The processed content.
+ */
+function links_add_target( $content, $target = '_blank', $tags = array('a') ) {
+       $tags = implode('|', (array)$tags);
+       return preg_replace_callback("!<($tags)(.+?)>!i",
+                       create_function('$m', 'return _links_add_target($m, "' . $target . '");'),
+                       $content);
+}
+/**
+ * Callback to add a target attribute to all links in passed content.
+ *
+ * @since 2.7.0
+ * @access private
+ *
+ * @param string $m The matched link.
+ * @param string $target The Target to add to the links.
+ * @return string The processed link.
+ */
+function _links_add_target( $m, $target ) {
+       $tag = $m[1];
+       $link = preg_replace('|(target=[\'"](.*?)[\'"])|i', '', $m[2]);
+       return '<' . $tag . $link . ' target="' . $target . '">';
+}
+
+// normalize EOL characters and strip duplicate whitespace
+function normalize_whitespace( $str ) {
+       $str  = trim($str);
+       $str  = str_replace("\r", "\n", $str);
+       $str  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $str );
+       return $str;
+}
+
 ?>
 ?>
index fb3aaf0f0060bc7e664a74b0235aea40944caac1..3ff8821adb02deefd1dcc44732a4539f7334def2 100644 (file)
@@ -79,14 +79,14 @@ function mysql2date( $dateformatstring, $mysqlstring, $translate = true ) {
  * The 'mysql' type will return the time in the format for MySQL DATETIME field.
  * The 'timestamp' type will return the current timestamp.
  *
  * The 'mysql' type will return the time in the format for MySQL DATETIME field.
  * The 'timestamp' type will return the current timestamp.
  *
- * If the $gmt is set to either '1' or 'true', then both types will use the
- * GMT offset in the WordPress option to add the GMT offset to the time.
+ * If $gmt is set to either '1' or 'true', then both types will use GMT time.
+ * if $gmt is false, the output is adjusted with the GMT offset in the WordPress option.
  *
  * @since 1.0.0
  *
  * @param string $type Either 'mysql' or 'timestamp'.
  *
  * @since 1.0.0
  *
  * @param string $type Either 'mysql' or 'timestamp'.
- * @param int|bool $gmt Optional. Whether to use $gmt offset. Default is false.
- * @return unknown
+ * @param int|bool $gmt Optional. Whether to use GMT timezone. Default is false.
+ * @return int|string String if $type is 'gmt', int if $type is 'timestamp'.
  */
 function current_time( $type, $gmt = 0 ) {
        switch ( $type ) {
  */
 function current_time( $type, $gmt = 0 ) {
        switch ( $type ) {
@@ -112,20 +112,29 @@ function current_time( $type, $gmt = 0 ) {
  * @param int $unixtimestamp Unix timestamp
  * @return string The date, translated if locale specifies it.
  */
  * @param int $unixtimestamp Unix timestamp
  * @return string The date, translated if locale specifies it.
  */
-function date_i18n( $dateformatstring, $unixtimestamp ) {
+function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
        global $wp_locale;
        $i = $unixtimestamp;
        // Sanity check for PHP 5.1.0-
        global $wp_locale;
        $i = $unixtimestamp;
        // Sanity check for PHP 5.1.0-
-       if ( -1 == $i )
-               $i = false;
-       
+       if ( false === $i || intval($i) < 0 ) {
+               if ( ! $gmt )
+                       $i = current_time( 'timestamp' );
+               else
+                       $i = time();
+               // we should not let date() interfere with our
+               // specially computed timestamp
+               $gmt = true;
+       }
+
+       $datefunc = $gmt? 'gmdate' : 'date';
+
        if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
        if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
-               $datemonth = $wp_locale->get_month( date( 'm', $i ) );
+               $datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) );
                $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
                $datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
-               $dateweekday = $wp_locale->get_weekday( date( 'w', $i ) );
+               $dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) );
                $dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
                $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 ) );
+               $datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) );
+               $datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i ) );
                $dateformatstring = ' '.$dateformatstring;
                $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
                $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
                $dateformatstring = ' '.$dateformatstring;
                $dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
                $dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
@@ -136,7 +145,7 @@ function date_i18n( $dateformatstring, $unixtimestamp ) {
 
                $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
        }
 
                $dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
        }
-       $j = @date( $dateformatstring, $i );
+       $j = @$datefunc( $dateformatstring, $i );
        return $j;
 }
 
        return $j;
 }
 
@@ -176,7 +185,7 @@ function number_format_i18n( $number, $decimals = null ) {
  *
  * @param int|string $bytes Number of bytes. Note max integer size for integers.
  * @param int $decimals Precision of number of decimal places.
  *
  * @param int|string $bytes Number of bytes. Note max integer size for integers.
  * @param int $decimals Precision of number of decimal places.
- * @return unknown
+ * @return bool|string False on failure. Number string on success.
  */
 function size_format( $bytes, $decimals = null ) {
        $quant = array(
  */
 function size_format( $bytes, $decimals = null ) {
        $quant = array(
@@ -195,14 +204,22 @@ function size_format( $bytes, $decimals = null ) {
        return false;
 }
 
        return false;
 }
 
-
+/**
+ * Get the week start and end from the datetime or date string from mysql.
+ *
+ * @since 0.71
+ *
+ * @param string $mysqlstring Date or datetime field type from mysql.
+ * @param int $start_of_week Optional. Start of the week as an integer.
+ * @return array Keys are 'start' and 'end'.
+ */
 function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
 function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
-       $my = substr( $mysqlstring, 0, 4 );
-       $mm = substr( $mysqlstring, 8, 2 );
-       $md = substr( $mysqlstring, 5, 2 );
-       $day = mktime( 0, 0, 0, $md, $mm, $my );
-       $weekday = date( 'w', $day );
-       $i = 86400;
+       $my = substr( $mysqlstring, 0, 4 ); // Mysql string Year
+       $mm = substr( $mysqlstring, 8, 2 ); // Mysql string Month
+       $md = substr( $mysqlstring, 5, 2 ); // Mysql string day
+       $day = mktime( 0, 0, 0, $md, $mm, $my ); // The timestamp for mysqlstring day.
+       $weekday = date( 'w', $day ); // The day of the week from the timestamp
+       $i = 86400; // One day
        if( !is_numeric($start_of_week) )
                $start_of_week = get_option( 'start_of_week' );
 
        if( !is_numeric($start_of_week) )
                $start_of_week = get_option( 'start_of_week' );
 
@@ -309,6 +326,9 @@ function is_serialized_string( $data ) {
  * There is a second filter called 'option_$option' with the $option being
  * replaced with the option name. This gives the value as the only parameter.
  *
  * There is a second filter called 'option_$option' with the $option being
  * replaced with the option name. This gives the value as the only parameter.
  *
+ * If the option was serialized, when the option was added and, or updated, then
+ * it will be unserialized, when it is returned.
+ *
  * @since 1.5.0
  * @package WordPress
  * @subpackage Option
  * @since 1.5.0
  * @package WordPress
  * @subpackage Option
@@ -319,7 +339,7 @@ function is_serialized_string( $data ) {
  * @param string $setting Name of option to retrieve. Should already be SQL-escaped
  * @return mixed Value set for the option.
  */
  * @param string $setting Name of option to retrieve. Should already be SQL-escaped
  * @return mixed Value set for the option.
  */
-function get_option( $setting ) {
+function get_option( $setting, $default = false ) {
        global $wpdb;
 
        // Allow plugins to short-circuit options.
        global $wpdb;
 
        // Allow plugins to short-circuit options.
@@ -330,7 +350,7 @@ function get_option( $setting ) {
        // prevent non-existent options from triggering multiple queries
        $notoptions = wp_cache_get( 'notoptions', 'options' );
        if ( isset( $notoptions[$setting] ) )
        // prevent non-existent options from triggering multiple queries
        $notoptions = wp_cache_get( 'notoptions', 'options' );
        if ( isset( $notoptions[$setting] ) )
-               return false;
+               return $default;
 
        $alloptions = wp_load_alloptions();
 
 
        $alloptions = wp_load_alloptions();
 
@@ -353,7 +373,7 @@ function get_option( $setting ) {
                        } else { // option does not exist, so we must cache its non-existence
                                $notoptions[$setting] = true;
                                wp_cache_set( 'notoptions', $notoptions, 'options' );
                        } else { // option does not exist, so we must cache its non-existence
                                $notoptions[$setting] = true;
                                wp_cache_set( 'notoptions', $notoptions, 'options' );
-                               return false;
+                               return $default;
                        }
                }
        }
                        }
                }
        }
@@ -371,7 +391,8 @@ function get_option( $setting ) {
 /**
  * Protect WordPress special option from being modified.
  *
 /**
  * Protect WordPress special option from being modified.
  *
- * Will die if $option is in protected list.
+ * Will die if $option is in protected list. Protected options are 'alloptions'
+ * and 'notoptions' options.
  *
  * @since 2.2.0
  * @package WordPress
  *
  * @since 2.2.0
  * @package WordPress
@@ -402,8 +423,9 @@ function form_option( $option ) {
 /**
  * Retrieve all autoload options or all options, if no autoloaded ones exist.
  *
 /**
  * Retrieve all autoload options or all options, if no autoloaded ones exist.
  *
- * This is different from wp_load_alloptions(), in this that function does not
- * cache all options and will retrieve all options from the database every time
+ * This is different from wp_load_alloptions() in that this function does not
+ * cache its results and will retrieve all options from the database every time
+ *
  * it is called.
  *
  * @since 1.0.0
  * it is called.
  *
  * @since 1.0.0
@@ -415,13 +437,13 @@ function form_option( $option ) {
  * @return array List of all options.
  */
 function get_alloptions() {
  * @return array List of all options.
  */
 function get_alloptions() {
-       global $wpdb, $wp_queries;
+       global $wpdb;
        $show = $wpdb->hide_errors();
        if ( !$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
                $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
        $wpdb->show_errors($show);
 
        $show = $wpdb->hide_errors();
        if ( !$options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options WHERE autoload = 'yes'" ) )
                $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" );
        $wpdb->show_errors($show);
 
-       foreach ( $options as $option ) {
+       foreach ( (array) $options as $option ) {
                // "When trying to design a foolproof system,
                //  never underestimate the ingenuity of the fools :)" -- Dougal
                if ( in_array( $option->option_name, array( 'siteurl', 'home', 'category_base', 'tag_base' ) ) )
                // "When trying to design a foolproof system,
                //  never underestimate the ingenuity of the fools :)" -- Dougal
                if ( in_array( $option->option_name, array( 'siteurl', 'home', 'category_base', 'tag_base' ) ) )
@@ -465,6 +487,10 @@ function wp_load_alloptions() {
 /**
  * Update the value of an option that was already added.
  *
 /**
  * Update the value of an option that was already added.
  *
+ * You do not need to serialize values, if the value needs to be serialize, then
+ * it will be serialized before it is inserted into the database. Remember,
+ * resources can not be serialized or added as an option.
+ *
  * If the option does not exist, then the option will be added with the 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().
  * If the option does not exist, then the option will be added with the 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().
@@ -531,6 +557,10 @@ function update_option( $option_name, $newvalue ) {
 /**
  * Add a new option.
  *
 /**
  * Add a new option.
  *
+ * You do not need to serialize values, if the value needs to be serialize, then
+ * it will be serialized before it is inserted into the database. Remember,
+ * resources can not be serialized or added as an option.
+ *
  * You can create options without values and then add values later. Does not
  * check whether the option has already been added, but does check that you
  * aren't adding a protected WordPress option. Care should be taken to not name
  * You can create options without values and then add values later. Does not
  * check whether the option has already been added, but does check that you
  * aren't adding a protected WordPress option. Care should be taken to not name
@@ -594,7 +624,7 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) {
  *
  * @package WordPress
  * @subpackage Option
  *
  * @package WordPress
  * @subpackage Option
- * @since unknown
+ * @since 1.2.0
  *
  * @param string $name Option name to remove.
  * @return bool True, if succeed. False, if failure.
  *
  * @param string $name Option name to remove.
  * @return bool True, if succeed. False, if failure.
@@ -623,9 +653,150 @@ function delete_option( $name ) {
        return true;
 }
 
        return true;
 }
 
+/**
+ * Saves and restores user interface settings stored in a cookie.
+ *
+ * Checks if the current user-settings cookie is updated and stores it. When no
+ * cookie exists (different browser used), adds the last saved cookie restoring
+ * the settings.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.7.0
+ */
+function wp_user_settings() {
+
+       if ( ! is_admin() )
+               return;
+
+       if ( defined('DOING_AJAX') )
+               return;
+
+       if ( ! $user = wp_get_current_user() )
+               return;
+
+       $settings = get_user_option( 'user-settings', $user->ID, false );
+
+       if ( isset( $_COOKIE['wp-settings-' . $user->ID] ) ) {
+               $cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user->ID] );
+
+               if ( ! empty( $cookie ) && strpos( $cookie, '=' ) ) {
+                       if ( $cookie == $settings )
+                               return;
+
+                       $last_time = (int) get_user_option( 'user-settings-time', $user->ID, false );
+                       $saved = isset( $_COOKIE['wp-settings-time-' . $user->ID]) ? preg_replace( '/[^0-9]/', '', $_COOKIE['wp-settings-time-' . $user->ID] ) : 0;
+
+                       if ( $saved > $last_time ) {
+                               update_user_option( $user->ID, 'user-settings', $cookie, false );
+                               update_user_option( $user->ID, 'user-settings-time', time() - 5, false );
+                               return;
+                       }
+               }
+       }
+
+       setcookie( 'wp-settings-' . $user->ID, $settings, time() + 31536000, SITECOOKIEPATH );
+       setcookie( 'wp-settings-time-' . $user->ID, time(), time() + 31536000, SITECOOKIEPATH );
+}
+
+/**
+ * Retrieve user interface setting value based on setting name.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.7.0
+ *
+ * @param string $name The name of the setting.
+ * @param string $default Optional default value to return when $name is not set.
+ * @return mixed the last saved user setting or the default value/false if it doesn't exist.
+ */
+function get_user_setting( $name, $default = false ) {
+
+       $arr = get_all_user_settings();
+
+       return isset($arr[$name]) ? $arr[$name] : $default;
+}
+
+/**
+ * Delete user interface settings.
+ *
+ * Deleting settings would reset them to the defaults.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.7.0
+ *
+ * @param mixed $names The name or array of names of the setting to be deleted.
+ */
+function delete_user_setting( $names ) {
+       global $current_user;
+
+       $arr = get_all_user_settings();
+       $names = (array) $names;
+
+       foreach ( $names as $name ) {
+               if ( isset($arr[$name]) ) {
+                       unset($arr[$name]);
+                       $settings = '';
+               }
+       }
+
+       if ( isset($settings) ) {
+               foreach ( $arr as $k => $v )
+                       $settings .= $k . '=' . $v . '&';
+
+               $settings = rtrim($settings, '&');
+
+               update_user_option( $current_user->ID, 'user-settings', $settings );
+               setcookie('wp-settings-'.$current_user->ID, $settings, time() + 31536000, SITECOOKIEPATH);
+       }
+}
+
+/**
+ * Retrieve all user interface settings.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.7.0
+ *
+ * @return array the last saved user settings or empty array.
+ */
+function get_all_user_settings() {
+       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 ( $cookie && strpos($cookie, '=') ) { // the '=' cannot be 1st char
+                       parse_str($cookie, $arr);
+                       return $arr;
+               }
+       }
+
+       return array();
+}
+
+/**
+ * Delete the user settings of the current user.
+ *
+ * @package WordPress
+ * @subpackage Option
+ * @since 2.7.0
+ */
+function delete_all_user_settings() {
+       if ( ! $user = wp_get_current_user() )
+               return;
+
+       delete_usermeta( $user->ID, 'user-settings' );
+       setcookie('wp-settings-'.$user->ID, ' ', time() - 31536000, SITECOOKIEPATH);
+}
+
 /**
  * Serialize data, if needed.
  *
 /**
  * Serialize data, if needed.
  *
+ * @since 2.0.5
+ *
  * @param mixed $data Data that might be serialized.
  * @return mixed A scalar data
  */
  * @param mixed $data Data that might be serialized.
  * @return mixed A scalar data
  */
@@ -639,13 +810,21 @@ function maybe_serialize( $data ) {
        return $data;
 }
 
        return $data;
 }
 
-
+/**
+ * Strip HTML and put links at the bottom of stripped content.
+ *
+ * Searches for all of the links, strips them out of the content, and places
+ * them at the bottom of the content with numbers.
+ *
+ * @since 0.71
+ *
+ * @param string $content Content to get links
+ * @return string HTML stripped out of content with links at the bottom.
+ */
 function make_url_footnote( $content ) {
        preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
 function make_url_footnote( $content ) {
        preg_match_all( '/<a(.+?)href=\"(.+?)\"(.*?)>(.+?)<\/a>/', $content, $matches );
-       $j = 0;
+       $links_summary = "\n";
        for ( $i=0; $i<count($matches[0]); $i++ ) {
        for ( $i=0; $i<count($matches[0]); $i++ ) {
-               $links_summary = ( !$j ) ? "\n" : $links_summary;
-               $j++;
                $link_match = $matches[0][$i];
                $link_number = '['.($i+1).']';
                $link_url = $matches[2][$i];
                $link_match = $matches[0][$i];
                $link_number = '['.($i+1).']';
                $link_url = $matches[2][$i];
@@ -659,7 +838,21 @@ function make_url_footnote( $content ) {
        return $content;
 }
 
        return $content;
 }
 
-
+/**
+ * Retrieve post title from XMLRPC XML.
+ *
+ * If the title element is not part of the XML, then the default post title from
+ * the $post_default_title will be used instead.
+ *
+ * @package WordPress
+ * @subpackage XMLRPC
+ * @since 0.71
+ *
+ * @global string $post_default_title Default XMLRPC post title.
+ *
+ * @param string $content XMLRPC XML Request content
+ * @return string Post title
+ */
 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 ) ) {
@@ -672,7 +865,22 @@ function xmlrpc_getposttitle( $content ) {
        return $post_title;
 }
 
        return $post_title;
 }
 
-
+/**
+ * Retrieve the post category or categories from XMLRPC XML.
+ *
+ * If the category element is not found, then the default post category will be
+ * used. The return type then would be what $post_default_category. If the
+ * category is found, then it will always be an array.
+ *
+ * @package WordPress
+ * @subpackage XMLRPC
+ * @since 0.71
+ *
+ * @global string $post_default_category Default XMLRPC post category.
+ *
+ * @param string $content XMLRPC XML Request content
+ * @return string|array List of categories or category name.
+ */
 function xmlrpc_getpostcategory( $content ) {
        global $post_default_category;
        if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {
 function xmlrpc_getpostcategory( $content ) {
        global $post_default_category;
        if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {
@@ -684,7 +892,16 @@ function xmlrpc_getpostcategory( $content ) {
        return $post_category;
 }
 
        return $post_category;
 }
 
-
+/**
+ * XMLRPC XML content without title and category elements.
+ *
+ * @package WordPress
+ * @subpackage XMLRPC
+ * @since 0.71
+ *
+ * @param string $content XMLRPC XML Request content
+ * @return string XMLRPC XML Request content without title and category elements.
+ */
 function xmlrpc_removepostdata( $content ) {
        $content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );
        $content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );
 function xmlrpc_removepostdata( $content ) {
        $content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );
        $content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );
@@ -701,7 +918,7 @@ function xmlrpc_removepostdata( $content ) {
  * @see fopen() for mode options.
  * @package WordPress
  * @subpackage Debug
  * @see fopen() for mode options.
  * @package WordPress
  * @subpackage Debug
- * @since unknown
+ * @since 0.71
  * @uses $debug Used for whether debugging is enabled.
  *
  * @param string $filename File path to debug file.
  * @uses $debug Used for whether debugging is enabled.
  *
  * @param string $filename File path to debug file.
@@ -726,7 +943,7 @@ function debug_fopen( $filename, $mode ) {
  *
  * @package WordPress
  * @subpackage Debug
  *
  * @package WordPress
  * @subpackage Debug
- * @since unknown
+ * @since 0.71
  * @uses $debug Used for whether debugging is enabled.
  *
  * @param resource $fp File handle for debugging file.
  * @uses $debug Used for whether debugging is enabled.
  *
  * @param resource $fp File handle for debugging file.
@@ -746,7 +963,7 @@ function debug_fwrite( $fp, $string ) {
  *
  * @package WordPress
  * @subpackage Debug
  *
  * @package WordPress
  * @subpackage Debug
- * @since unknown
+ * @since 0.71
  * @uses $debug Used for whether debugging is enabled.
  *
  * @param resource $fp Debug File handle.
  * @uses $debug Used for whether debugging is enabled.
  *
  * @param resource $fp Debug File handle.
@@ -757,6 +974,20 @@ function debug_fclose( $fp ) {
                fclose( $fp );
 }
 
                fclose( $fp );
 }
 
+/**
+ * Check content for video and audio links to add as enclosures.
+ *
+ * Will not add enclosures that have already been added. This is called as
+ * pingbacks and trackbacks.
+ *
+ * @package WordPress
+ * @since 1.5.0
+ *
+ * @uses $wpdb
+ *
+ * @param string $content Post Content
+ * @param int $post_ID Post ID
+ */
 function do_enclose( $content, $post_ID ) {
        global $wpdb;
        include_once( ABSPATH . WPINC . '/class-IXR.php' );
 function do_enclose( $content, $post_ID ) {
        global $wpdb;
        include_once( ABSPATH . WPINC . '/class-IXR.php' );
@@ -777,7 +1008,7 @@ 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 ( $post_links_temp[0] as $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 );
                        if ( isset( $test['query'] ) )
                if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
                        $test = parse_url( $link_test );
                        if ( isset( $test['query'] ) )
@@ -787,7 +1018,7 @@ function do_enclose( $content, $post_ID ) {
                }
        }
 
                }
        }
 
-       foreach ( $post_links as $url ) {
+       foreach ( (array) $post_links as $url ) {
                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'];
@@ -809,81 +1040,43 @@ function do_enclose( $content, $post_ID ) {
  * If $file_path is a writable filename, this will do a GET request and write
  * the file to that path.
  *
  * If $file_path is a writable filename, this will do a GET request and write
  * the file to that path.
  *
- * @since unknown
+ * @since 2.5.0
  *
  *
- * @param string $url
+ * @param string $url URL to fetch.
  * @param string|bool $file_path Optional. File path to write request to.
  * @param string|bool $file_path Optional. File path to write request to.
- * @param int $red Optional. Number of Redirects. Stops at 5 redirects.
+ * @param bool $deprecated Deprecated. Not used.
  * @return bool|string False on failure and string of headers if HEAD request.
  */
  * @return bool|string False on failure and string of headers if HEAD request.
  */
-function wp_get_http( $url, $file_path = false, $red = 1 ) {
-       global $wp_version;
+function wp_get_http( $url, $file_path = false, $deprecated = false ) {
        @set_time_limit( 60 );
 
        @set_time_limit( 60 );
 
-       if ( $red > 5 )
-                return false;
-
-       $parts = parse_url( $url );
-       $file = $parts['path'] . ( ( $parts['query'] ) ? '?' . $parts['query'] : '' );
-       $host = $parts['host'];
-       if ( !isset( $parts['port'] ) )
-               $parts['port'] = 80;
+       $options = array();
+       $options['redirection'] = 5;
 
 
-       if ( $file_path )
-               $request_type = 'GET';
+       if ( false == $file_path )
+               $options['method'] = 'HEAD';
        else
        else
-               $request_type = 'HEAD';
+               $options['method'] = 'GET';
 
 
-       $head = "$request_type $file HTTP/1.1\r\nHOST: $host\r\nUser-Agent: WordPress/" . $wp_version . "\r\n\r\n";
+       $response = wp_remote_request($url, $options);
 
 
-       $fp = @fsockopen( $host, $parts['port'], $err_num, $err_msg, 3 );
-       if ( !$fp )
+       if ( is_wp_error( $response ) )
                return false;
 
                return false;
 
-       $response = '';
-       fputs( $fp, $head );
-       while ( !feof( $fp ) && strpos( $response, "\r\n\r\n" ) == false )
-               $response .= fgets( $fp, 2048 );
-       preg_match_all( '/(.*?): (.*)\r/', $response, $matches );
-       $count = count( $matches[1] );
-       for ( $i = 0; $i < $count; $i++ ) {
-               $key = strtolower( $matches[1][$i] );
-               $headers["$key"] = $matches[2][$i];
-       }
-
-       preg_match( '/.*([0-9]{3}).*/', $response, $return );
-       $headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
-
-               $code = $headers['response'];
-               if ( ( '302' == $code || '301' == $code ) && isset( $headers['location'] ) ) {
-                               fclose($fp);
-                               return wp_get_http( $headers['location'], $file_path, ++$red );
-               }
-
-       // make a note of the final location, so the caller can tell if we were redirected or not
-       $headers['x-final-location'] = $url;
+       $headers = wp_remote_retrieve_headers( $response );
+       $headers['response'] = $response['response']['code'];
 
 
-       // HEAD request only
-       if ( !$file_path ) {
-               fclose($fp);
+       if ( false == $file_path )
                return $headers;
                return $headers;
-       }
 
 
-       // GET request - fetch and write it to the supplied filename
-       $content_length = $headers['content-length'];
-       $got_bytes = 0;
+       // GET request - write it to the supplied filename
        $out_fp = fopen($file_path, 'w');
        $out_fp = fopen($file_path, 'w');
-       while ( !feof($fp) ) {
-               $buf = fread( $fp, 4096 );
-               fwrite( $out_fp, $buf );
-               $got_bytes += strlen($buf);
-               // don't read past the content-length
-               if ($content_length and $got_bytes >= $content_length)
-                       break;
-       }
+       if ( !$out_fp )
+               return $headers;
 
 
+       fwrite( $out_fp,  $response['body']);
        fclose($out_fp);
        fclose($out_fp);
-       fclose($fp);
+
        return $headers;
 }
 
        return $headers;
 }
 
@@ -893,18 +1086,21 @@ function wp_get_http( $url, $file_path = false, $red = 1 ) {
  * @since 1.5.1
  *
  * @param string $url
  * @since 1.5.1
  *
  * @param string $url
- * @param int $red Optional. Number of redirects.
+ * @param bool $deprecated Not Used.
  * @return bool|string False on failure, headers on success.
  */
  * @return bool|string False on failure, headers on success.
  */
-function wp_get_http_headers( $url, $red = 1 ) {
-       return wp_get_http( $url, false, $red );
+function wp_get_http_headers( $url, $deprecated = false ) {
+       $response = wp_remote_head( $url );
+
+       if ( is_wp_error( $response ) )
+               return false;
+
+       return wp_remote_retrieve_headers( $response );
 }
 
 /**
  * Whether today is a new day.
  *
 }
 
 /**
  * Whether today is a new day.
  *
- * {@internal Need to find out how this function is used.}}
- *
  * @since 0.71
  * @uses $day Today
  * @uses $previousday Previous day
  * @since 0.71
  * @uses $day Today
  * @uses $previousday Previous day
@@ -929,13 +1125,13 @@ function is_new_day() {
  * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
  *             http_build_query() does.
  *
  * @link http://us2.php.net/manual/en/function.http-build-query.php more on what
  *             http_build_query() does.
  *
- * @since unknown
+ * @since 2.3.0
  *
  * @param array $data URL-encode key/value pairs.
  * @return string URL encoded string
  */
 function build_query( $data ) {
  *
  * @param array $data URL-encode key/value pairs.
  * @return string URL encoded string
  */
 function build_query( $data ) {
-       return _http_build_query( $data, NULL, '&', '', false );
+       return _http_build_query( $data, null, '&', '', false );
 }
 
 /**
 }
 
 /**
@@ -953,7 +1149,7 @@ function build_query( $data ) {
  * @param mixed $param1 Either newkey or an associative_array
  * @param mixed $param2 Either newvalue or oldquery or uri
  * @param mixed $param3 Optional. Old query or uri
  * @param mixed $param1 Either newkey or an associative_array
  * @param mixed $param2 Either newvalue or oldquery or uri
  * @param mixed $param3 Optional. Old query or uri
- * @return unknown
+ * @return string New URL query string.
  */
 function add_query_arg() {
        $ret = '';
  */
 function add_query_arg() {
        $ret = '';
@@ -1007,7 +1203,7 @@ function add_query_arg() {
                $qs[func_get_arg( 0 )] = func_get_arg( 1 );
        }
 
                $qs[func_get_arg( 0 )] = func_get_arg( 1 );
        }
 
-       foreach ( $qs as $k => $v ) {
+       foreach ( (array) $qs as $k => $v ) {
                if ( $v === false )
                        unset( $qs[$k] );
        }
                if ( $v === false )
                        unset( $qs[$k] );
        }
@@ -1027,11 +1223,11 @@ function add_query_arg() {
  *
  * @param string|array $key Query key or keys to remove.
  * @param bool $query When false uses the $_SERVER value.
  *
  * @param string|array $key Query key or keys to remove.
  * @param bool $query When false uses the $_SERVER value.
- * @return unknown
+ * @return string New URL query string.
  */
 function remove_query_arg( $key, $query=false ) {
        if ( is_array( $key ) ) { // removing multiple keys
  */
 function remove_query_arg( $key, $query=false ) {
        if ( is_array( $key ) ) { // removing multiple keys
-               foreach ( (array) $key as $k )
+               foreach ( $key as $k )
                        $query = add_query_arg( $k, false, $query );
                return $query;
        }
                        $query = add_query_arg( $k, false, $query );
                return $query;
        }
@@ -1042,6 +1238,7 @@ function remove_query_arg( $key, $query=false ) {
  * Walks the array while sanitizing the contents.
  *
  * @uses $wpdb Used to sanitize values
  * Walks the array while sanitizing the contents.
  *
  * @uses $wpdb Used to sanitize values
+ * @since 0.71
  *
  * @param array $array Array to used to walk while sanitizing contents.
  * @return array Sanitized $array.
  *
  * @param array $array Array to used to walk while sanitizing contents.
  * @return array Sanitized $array.
@@ -1049,7 +1246,7 @@ function remove_query_arg( $key, $query=false ) {
 function add_magic_quotes( $array ) {
        global $wpdb;
 
 function add_magic_quotes( $array ) {
        global $wpdb;
 
-       foreach ( $array as $k => $v ) {
+       foreach ( (array) $array as $k => $v ) {
                if ( is_array( $v ) ) {
                        $array[$k] = add_magic_quotes( $v );
                } else {
                if ( is_array( $v ) ) {
                        $array[$k] = add_magic_quotes( $v );
                } else {
@@ -1062,50 +1259,36 @@ function add_magic_quotes( $array ) {
 /**
  * HTTP request for URI to retrieve content.
  *
 /**
  * HTTP request for URI to retrieve content.
  *
- * Tries to retrieve the HTTP content with fopen first and then using cURL, if
- * fopen can't be used.
- *
- * @since unknown
+ * @since 1.5.1
+ * @uses wp_remote_get()
  *
  * @param string $uri URI/URL of web page to retrieve.
  *
  * @param string $uri URI/URL of web page to retrieve.
- * @return string HTTP content.
+ * @return bool|string HTTP content. False on failure.
  */
 function wp_remote_fopen( $uri ) {
  */
 function wp_remote_fopen( $uri ) {
-       $timeout = 10;
        $parsed_url = @parse_url( $uri );
 
        if ( !$parsed_url || !is_array( $parsed_url ) )
                return false;
 
        $parsed_url = @parse_url( $uri );
 
        if ( !$parsed_url || !is_array( $parsed_url ) )
                return false;
 
-       if ( !isset( $parsed_url['scheme'] ) || !in_array( $parsed_url['scheme'], array( 'http','https' ) ) )
-               $uri = 'http://' . $uri;
+       $options = array();
+       $options['timeout'] = 10;
 
 
-       if ( ini_get( 'allow_url_fopen' ) ) {
-               $fp = @fopen( $uri, 'r' );
-               if ( !$fp )
-                       return false;
+       $response = wp_remote_get( $uri, $options );
 
 
-               //stream_set_timeout($fp, $timeout); // Requires php 4.3
-               $linea = '';
-               while ( $remote_read = fread( $fp, 4096 ) )
-                       $linea .= $remote_read;
-               fclose( $fp );
-               return $linea;
-       } elseif ( function_exists( 'curl_init' ) ) {
-               $handle = curl_init();
-               curl_setopt( $handle, CURLOPT_URL, $uri);
-               curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 1 );
-               curl_setopt( $handle, CURLOPT_RETURNTRANSFER, 1 );
-               curl_setopt( $handle, CURLOPT_TIMEOUT, $timeout );
-               $buffer = curl_exec( $handle );
-               curl_close( $handle );
-               return $buffer;
-       } else {
+       if ( is_wp_error( $response ) )
                return false;
                return false;
-       }
-}
 
 
+       return $response['body'];
+}
 
 
+/**
+ * Setup the WordPress query.
+ *
+ * @since 2.0.0
+ *
+ * @param string $query_vars Default WP_Query arguments.
+ */
 function wp( $query_vars = '' ) {
        global $wp, $wp_query, $wp_the_query;
        $wp->main( $query_vars );
 function wp( $query_vars = '' ) {
        global $wp, $wp_query, $wp_the_query;
        $wp->main( $query_vars );
@@ -1184,7 +1367,7 @@ function get_status_header_desc( $code ) {
 /**
  * Set HTTP status header.
  *
 /**
  * Set HTTP status header.
  *
- * @since unknown
+ * @since 2.0.0
  * @uses apply_filters() Calls 'status_header' on status header string, HTTP
  *             HTTP code, HTTP code description, and protocol string as separate
  *             parameters.
  * @uses apply_filters() Calls 'status_header' on status header string, HTTP
  *             HTTP code, HTTP code description, and protocol string as separate
  *             parameters.
@@ -1263,7 +1446,18 @@ function bool_from_yn( $yn ) {
        return ( strtolower( $yn ) == 'y' );
 }
 
        return ( strtolower( $yn ) == 'y' );
 }
 
-
+/**
+ * Loads the feed template from the use of an action hook.
+ *
+ * If the feed action does not have a hook, then the function will die with a
+ * message telling the visitor that the feed is not valid.
+ *
+ * It is better to only have one hook for each feed.
+ *
+ * @since 2.1.0
+ * @uses $wp_query Used to tell if the use a comment feed.
+ * @uses do_action() Calls 'do_feed_$feed' hook, if a hook exists for the feed.
+ */
 function do_feed() {
        global $wp_query;
 
 function do_feed() {
        global $wp_query;
 
@@ -1353,11 +1547,24 @@ function do_robots() {
        }
 }
 
        }
 }
 
-
+/**
+ * Test whether blog is already installed.
+ *
+ * The cache will be checked first. If you have a cache plugin, which saves the
+ * cache values, then this will work. If you use the default WordPress cache,
+ * and the database goes away, then you might have problems.
+ *
+ * Checks for the option siteurl for whether WordPress is installed.
+ *
+ * @since 2.1.0
+ * @uses $wpdb
+ *
+ * @return bool Whether blog is already installed.
+ */
 function is_blog_installed() {
        global $wpdb;
 
 function is_blog_installed() {
        global $wpdb;
 
-       // Check cache first.  If options table goes away and we have true cached, oh well.
+       // Check cache first. If options table goes away and we have true cached, oh well.
        if ( wp_cache_get('is_blog_installed') )
                return true;
 
        if ( wp_cache_get('is_blog_installed') )
                return true;
 
@@ -1371,26 +1578,80 @@ function is_blog_installed() {
        return $installed;
 }
 
        return $installed;
 }
 
-
+/**
+ * Retrieve URL with nonce added to URL query.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param string $actionurl URL to add nonce action
+ * @param string $action Optional. Nonce action name
+ * @return string URL with nonce action added.
+ */
 function wp_nonce_url( $actionurl, $action = -1 ) {
        $actionurl = str_replace( '&amp;', '&', $actionurl );
        return wp_specialchars( add_query_arg( '_wpnonce', wp_create_nonce( $action ), $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 ) );
 }
 
-
+/**
+ * Retrieve or display nonce hidden field for forms.
+ *
+ * The nonce field is used to validate that the contents of the form came from
+ * the location on the current site and not somewhere else. The nonce does not
+ * offer absolute protection, but should protect against most cases. It is very
+ * important to use nonce field in forms.
+ *
+ * If you set $echo to true and set $referer to true, then you will need to
+ * retrieve the {@link wp_referer_field() wp referer field}. If you have the
+ * $referer set to true and are echoing the nonce field, it will also echo the
+ * referer field.
+ *
+ * The $action and $name are optional, but if you want to have better security,
+ * it is strongly suggested to set those two parameters. It is easier to just
+ * call the function without any parameters, because validation of the nonce
+ * doesn't require any parameters, but since crackers know what the default is
+ * it won't be difficult for them to find a way around your nonce and cause
+ * damage.
+ *
+ * The input name will be whatever $name value you gave. The input value will be
+ * the nonce creation value.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param string $action Optional. Action name.
+ * @param string $name Optional. Nonce name.
+ * @param bool $referer Optional, default true. Whether to set the referer field for validation.
+ * @param bool $echo Optional, default true. Whether to display or return hidden form field.
+ * @return string Nonce field.
+ */
 function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
        $name = attribute_escape( $name );
        $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
        if ( $echo )
                echo $nonce_field;
 function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
        $name = attribute_escape( $name );
        $nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
        if ( $echo )
                echo $nonce_field;
-       
+
        if ( $referer )
                wp_referer_field( $echo, 'previous' );
        if ( $referer )
                wp_referer_field( $echo, 'previous' );
-       
+
        return $nonce_field;
 }
 
        return $nonce_field;
 }
 
-
+/**
+ * Retrieve or display referer hidden field for forms.
+ *
+ * The referer link is the current Request URI from the server super global. The
+ * input name is '_wp_http_referer', in case you wanted to check manually.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param bool $echo Whether to echo or return the referer field.
+ * @return string Referer field.
+ */
 function wp_referer_field( $echo = true) {
        $ref = attribute_escape( $_SERVER['REQUEST_URI'] );
        $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
 function wp_referer_field( $echo = true) {
        $ref = attribute_escape( $_SERVER['REQUEST_URI'] );
        $referer_field = '<input type="hidden" name="_wp_http_referer" value="'. $ref . '" />';
@@ -1400,6 +1661,21 @@ function wp_referer_field( $echo = true) {
        return $referer_field;
 }
 
        return $referer_field;
 }
 
+/**
+ * Retrieve or display original referer hidden field for forms.
+ *
+ * The input name is '_wp_original_http_referer' and will be either the same
+ * value of {@link wp_referer_field()}, if that was posted already or it will
+ * be the current page, if it doesn't exist.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param bool $echo Whether to echo the original http referer
+ * @param string $jump_back_to Optional, default is 'current'. Can be 'previous' or page you want to jump back to.
+ * @return string Original referer field.
+ */
 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;
@@ -1409,8 +1685,17 @@ function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
        return $orig_referer_field;
 }
 
        return $orig_referer_field;
 }
 
-
+/**
+ * Retrieve referer from '_wp_http_referer', HTTP referer, or current page respectively.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @return string|bool False on failure. Referer URL on success.
+ */
 function wp_get_referer() {
 function wp_get_referer() {
+       $ref = '';
        if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
                $ref = $_REQUEST['_wp_http_referer'];
        else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
        if ( ! empty( $_REQUEST['_wp_http_referer'] ) )
                $ref = $_REQUEST['_wp_http_referer'];
        else if ( ! empty( $_SERVER['HTTP_REFERER'] ) )
@@ -1421,14 +1706,31 @@ function wp_get_referer() {
        return false;
 }
 
        return false;
 }
 
-
+/**
+ * Retrieve original referer that was posted, if it exists.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @return string|bool False if no original referer or original referer if set.
+ */
 function wp_get_original_referer() {
        if ( !empty( $_REQUEST['_wp_original_http_referer'] ) )
                return $_REQUEST['_wp_original_http_referer'];
        return false;
 }
 
 function wp_get_original_referer() {
        if ( !empty( $_REQUEST['_wp_original_http_referer'] ) )
                return $_REQUEST['_wp_original_http_referer'];
        return false;
 }
 
-
+/**
+ * Recursive directory creation based on full path.
+ *
+ * Will attempt to set permissions on folders.
+ *
+ * @since 2.0.1
+ *
+ * @param string $target Full path to attempt to create.
+ * @return bool Whether the path was created or not. True if path already exists.
+ */
 function wp_mkdir_p( $target ) {
        // from php.net/mkdir user contributed notes
        $target = str_replace( '//', '/', $target );
 function wp_mkdir_p( $target ) {
        // from php.net/mkdir user contributed notes
        $target = str_replace( '//', '/', $target );
@@ -1446,13 +1748,20 @@ function wp_mkdir_p( $target ) {
        }
 
        // If the above failed, attempt to create the parent node, then try again.
        }
 
        // If the above failed, attempt to create the parent node, then try again.
-       if ( wp_mkdir_p( dirname( $target ) ) )
+       if ( ( $target != '/' ) && ( wp_mkdir_p( dirname( $target ) ) ) )
                return wp_mkdir_p( $target );
 
        return false;
 }
 
                return wp_mkdir_p( $target );
 
        return false;
 }
 
-// Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows')
+/**
+ * Test if a give filesystem path is absolute ('/foo/bar', 'c:\windows').
+ *
+ * @since 2.5.0
+ *
+ * @param string $path File path
+ * @return bool True if path is absolute, false is not absolute.
+ */
 function path_is_absolute( $path ) {
        // this is definitive if true but fails if $path does not exist or contains a symbolic link
        if ( realpath($path) == $path )
 function path_is_absolute( $path ) {
        // this is definitive if true but fails if $path does not exist or contains a symbolic link
        if ( realpath($path) == $path )
@@ -1469,7 +1778,17 @@ function path_is_absolute( $path ) {
        return (bool) preg_match('#^[/\\\\]#', $path);
 }
 
        return (bool) preg_match('#^[/\\\\]#', $path);
 }
 
-// Join two filesystem paths together (e.g. 'give me $path relative to $base')
+/**
+ * Join two filesystem paths together (e.g. 'give me $path relative to $base').
+ *
+ * If the $path is absolute, then it the full path is returned.
+ *
+ * @since 2.5.0
+ *
+ * @param string $base
+ * @param string $path
+ * @return string The path with the base or absolute path.
+ */
 function path_join( $base, $path ) {
        if ( path_is_absolute($path) )
                return $path;
 function path_join( $base, $path ) {
        if ( path_is_absolute($path) )
                return $path;
@@ -1477,19 +1796,51 @@ function path_join( $base, $path ) {
        return rtrim($base, '/') . '/' . ltrim($path, '/');
 }
 
        return rtrim($base, '/') . '/' . ltrim($path, '/');
 }
 
-// Returns an array containing the current upload directory's path and url, or an error message.
-function wp_upload_dir( $time = NULL ) {
+/**
+ * Get an array containing the current upload directory's path and url.
+ *
+ * Checks the 'upload_path' option, which should be from the web root folder,
+ * and if it isn't empty it will be used. If it is empty, then the path will be
+ * 'WP_CONTENT_DIR/uploads'. If the 'UPLOADS' constant is defined, then it will
+ * override the 'upload_path' option and 'WP_CONTENT_DIR/uploads' path.
+ *
+ * The upload URL path is set either by the 'upload_url_path' option or by using
+ * the 'WP_CONTENT_URL' constant and appending '/uploads' to the path.
+ *
+ * If the 'uploads_use_yearmonth_folders' is set to true (checkbox if checked in
+ * the administration settings panel), then the time will be used. The format
+ * will be year first and then month.
+ *
+ * If the path couldn't be created, then an error will be returned with the key
+ * 'error' containing the error message. The error suggests that the parent
+ * directory is not writable by the server.
+ *
+ * On success, the returned array will have many indices:
+ * 'path' - base directory and sub directory or full path to upload directory.
+ * 'url' - base url and sub directory or absolute URL to upload directory.
+ * 'subdir' - sub directory if uploads use year/month folders option is on.
+ * 'basedir' - path without subdir.
+ * 'baseurl' - URL path without subdir.
+ * 'error' - set to false.
+ *
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'upload_dir' on returned array.
+ *
+ * @param string $time Optional. Time formatted in 'yyyy/mm'.
+ * @return array See above for description.
+ */
+function wp_upload_dir( $time = null ) {
        $siteurl = get_option( 'siteurl' );
        $upload_path = get_option( 'upload_path' );
        $upload_path = trim($upload_path);
        if ( empty($upload_path) )
                $dir = WP_CONTENT_DIR . '/uploads';
        $siteurl = get_option( 'siteurl' );
        $upload_path = get_option( 'upload_path' );
        $upload_path = trim($upload_path);
        if ( empty($upload_path) )
                $dir = WP_CONTENT_DIR . '/uploads';
-       else 
+       else
                $dir = $upload_path;
 
        // $dir is absolute, $path is (maybe) relative to ABSPATH
        $dir = path_join( ABSPATH, $dir );
                $dir = $upload_path;
 
        // $dir is absolute, $path is (maybe) relative to ABSPATH
        $dir = path_join( ABSPATH, $dir );
-       
+
        if ( !$url = get_option( 'upload_url_path' ) ) {
                if ( empty($upload_path) or ( $upload_path == $dir ) )
                        $url = WP_CONTENT_URL . '/uploads';
        if ( !$url = get_option( 'upload_url_path' ) ) {
                if ( empty($upload_path) or ( $upload_path == $dir ) )
                        $url = WP_CONTENT_URL . '/uploads';
@@ -1502,7 +1853,7 @@ function wp_upload_dir( $time = NULL ) {
                $url = trailingslashit( $siteurl ) . UPLOADS;
        }
 
                $url = trailingslashit( $siteurl ) . UPLOADS;
        }
 
-       $bdir = $dir; 
+       $bdir = $dir;
        $burl = $url;
 
        $subdir = '';
        $burl = $url;
 
        $subdir = '';
@@ -1523,20 +1874,36 @@ function wp_upload_dir( $time = NULL ) {
                $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
                return array( 'error' => $message );
        }
                $message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $dir );
                return array( 'error' => $message );
        }
-       
+
        $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
 
        return apply_filters( 'upload_dir', $uploads );
 }
 
        $uploads = array( 'path' => $dir, 'url' => $url, 'subdir' => $subdir, 'basedir' => $bdir, 'baseurl' => $burl, 'error' => false );
 
        return apply_filters( 'upload_dir', $uploads );
 }
 
-// return a filename that is sanitized and unique for the given directory
-function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL ) {
+/**
+ * Get a filename that is sanitized and unique for the given directory.
+ *
+ * If the filename is not unique, then a number will be added to the filename
+ * before the extension, and will continue adding numbers until the filename is
+ * unique.
+ *
+ * The callback must accept two parameters, the first one is the directory and
+ * the second is the filename. The callback must be a function.
+ *
+ * @since 2.5
+ *
+ * @param string $dir
+ * @param string $filename
+ * @param string $unique_filename_callback Function name, must be a function.
+ * @return string New filename, if given wasn't unique.
+ */
+function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
        $filename = strtolower( $filename );
        // separate the filename into a name and extension
        $info = pathinfo($filename);
        $filename = strtolower( $filename );
        // separate the filename into a name and extension
        $info = pathinfo($filename);
-       $ext = $info['extension'];
+       $ext = !empty($info['extension']) ? $info['extension'] : '';
        $name = basename($filename, ".{$ext}");
        $name = basename($filename, ".{$ext}");
-       
+
        // edge case: if file is named '.ext', treat as an empty name
        if( $name === ".$ext" )
                $name = '';
        // edge case: if file is named '.ext', treat as an empty name
        if( $name === ".$ext" )
                $name = '';
@@ -1547,9 +1914,7 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL )
        } else {
                $number = '';
 
        } else {
                $number = '';
 
-               if ( empty( $ext ) )
-                       $ext = '';
-               else
+               if ( !empty( $ext ) )
                        $ext = strtolower( ".$ext" );
 
                $filename = str_replace( $ext, '', $filename );
                        $ext = strtolower( ".$ext" );
 
                $filename = str_replace( $ext, '', $filename );
@@ -1567,13 +1932,36 @@ function wp_unique_filename( $dir, $filename, $unique_filename_callback = NULL )
        return $filename;
 }
 
        return $filename;
 }
 
-function wp_upload_bits( $name, $deprecated, $bits, $time = NULL ) {
+/**
+ * Create a file in the upload folder with given content.
+ *
+ * If there is an error, then the key 'error' will exist with the error message.
+ * If success, then the key 'file' will have the unique file path, the 'url' key
+ * will have the link to the new file. and the 'error' key will be set to false.
+ *
+ * This function will not move an uploaded file to the upload folder. It will
+ * create a new file with the content in $bits parameter. If you move the upload
+ * file, read the content of the uploaded file, and then you can give the
+ * filename and content to this function, which will add it to the upload
+ * folder.
+ *
+ * The permissions will be set on the new file automatically by this function.
+ *
+ * @since 2.0.0
+ *
+ * @param string $name
+ * @param null $deprecated Not used. Set to null.
+ * @param mixed $bits File content
+ * @param string $time Optional. Time formatted in 'yyyy/mm'.
+ * @return array
+ */
+function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
        if ( empty( $name ) )
        if ( empty( $name ) )
-               return array( 'error' => __( "Empty filename" ) );
+               return array( 'error' => __( 'Empty filename' ) );
 
        $wp_filetype = wp_check_filetype( $name );
        if ( !$wp_filetype['ext'] )
 
        $wp_filetype = wp_check_filetype( $name );
        if ( !$wp_filetype['ext'] )
-               return array( 'error' => __( "Invalid file type" ) );
+               return array( 'error' => __( 'Invalid file type' ) );
 
        $upload = wp_upload_dir( $time );
 
 
        $upload = wp_upload_dir( $time );
 
@@ -1606,13 +1994,23 @@ function wp_upload_bits( $name, $deprecated, $bits, $time = NULL ) {
        return array( 'file' => $new_file, 'url' => $url, 'error' => false );
 }
 
        return array( 'file' => $new_file, 'url' => $url, 'error' => false );
 }
 
+/**
+ * Retrieve the file type based on the extension name.
+ *
+ * @package WordPress
+ * @since 2.5.0
+ * @uses apply_filters() Calls 'ext2type' hook on default supported types.
+ *
+ * @param string $ext The extension to search.
+ * @return string|null The file type, example: audio, video, document, spreadsheet, etc. Null if not found.
+ */
 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'),
 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'),
-               'document' => array('doc','pages','odt','rtf','pdf'),
-               'spreadsheet' => array('xls','numbers','ods'),
-               'interactive' => array('ppt','key','odp','swf'),
+               'document' => array('doc','docx','pages','odt','rtf','pdf'),
+               'spreadsheet' => array('xls','xlsx','numbers','ods'),
+               'interactive' => array('ppt','pptx','key','odp','swf'),
                'text' => array('txt'),
                'archive' => array('tar','bz2','gz','cab','dmg','rar','sea','sit','sqx','zip'),
                'code' => array('css','html','php','js'),
                'text' => array('txt'),
                'archive' => array('tar','bz2','gz','cab','dmg','rar','sea','sit','sqx','zip'),
                'code' => array('css','html','php','js'),
@@ -1622,6 +2020,17 @@ function wp_ext2type( $ext ) {
                        return $type;
 }
 
                        return $type;
 }
 
+/**
+ * Retrieve the file type from the file name.
+ *
+ * You can optionally define the mime array, if needed.
+ *
+ * @since 2.0.4
+ *
+ * @param string $filename File name or path.
+ * @param array $mimes Optional. Key is the file extension with value as the mime type.
+ * @return array Values with extension first and mime type.
+ */
 function wp_check_filetype( $filename, $mimes = null ) {
        // Accepted MIME types are set here as PCRE unless provided.
        $mimes = ( is_array( $mimes ) ) ? $mimes : apply_filters( 'upload_mimes', array(
 function wp_check_filetype( $filename, $mimes = null ) {
        // Accepted MIME types are set here as PCRE unless provided.
        $mimes = ( is_array( $mimes ) ) ? $mimes : apply_filters( 'upload_mimes', array(
@@ -1633,6 +2042,7 @@ function wp_check_filetype( $filename, $mimes = null ) {
                'ico' => 'image/x-icon',
                'asf|asx|wax|wmv|wmx' => 'video/asf',
                'avi' => 'video/avi',
                'ico' => 'image/x-icon',
                'asf|asx|wax|wmv|wmx' => 'video/asf',
                'avi' => 'video/avi',
+               'divx' => 'video/divx',
                'mov|qt' => 'video/quicktime',
                'mpeg|mpg|mpe|mp4' => 'video/mpeg',
                'txt|c|cc|h' => 'text/plain',
                'mov|qt' => 'video/quicktime',
                'mpeg|mpg|mpe|mp4' => 'video/mpeg',
                'txt|c|cc|h' => 'text/plain',
@@ -1648,10 +2058,10 @@ function wp_check_filetype( $filename, $mimes = null ) {
                'rtf' => 'application/rtf',
                'js' => 'application/javascript',
                'pdf' => 'application/pdf',
                'rtf' => 'application/rtf',
                'js' => 'application/javascript',
                'pdf' => 'application/pdf',
-               'doc' => 'application/msword',
-               'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
+               'doc|docx' => 'application/msword',
+               'pot|pps|ppt|pptx' => 'application/vnd.ms-powerpoint',
                'wri' => 'application/vnd.ms-write',
                'wri' => 'application/vnd.ms-write',
-               'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
+               'xla|xls|xlsx|xlt|xlw' => 'application/vnd.ms-excel',
                'mdb' => 'application/vnd.ms-access',
                'mpp' => 'application/vnd.ms-project',
                'swf' => 'application/x-shockwave-flash',
                'mdb' => 'application/vnd.ms-access',
                'mpp' => 'application/vnd.ms-project',
                'swf' => 'application/x-shockwave-flash',
@@ -1686,6 +2096,29 @@ function wp_check_filetype( $filename, $mimes = null ) {
        return compact( 'ext', 'type' );
 }
 
        return compact( 'ext', 'type' );
 }
 
+/**
+ * Retrieve nonce action "Are you sure" message.
+ *
+ * The action is split by verb and noun. The action format is as follows:
+ * verb-action_extra. The verb is before the first dash and has the format of
+ * letters and no spaces and numbers. The noun is after the dash and before the
+ * underscore, if an underscore exists. The noun is also only letters.
+ *
+ * The filter will be called for any action, which is not defined by WordPress.
+ * You may use the filter for your plugin to explain nonce actions to the user,
+ * when they get the "Are you sure?" message. The filter is in the format of
+ * 'explain_nonce_$verb-$noun' with the $verb replaced by the found verb and the
+ * $noun replaced by the found noun. The two parameters that are given to the
+ * hook are the localized "Are you sure you want to do this?" message with the
+ * extra text (the text after the underscore).
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param string $action Nonce action.
+ * @return string Are you sure message.
+ */
 function wp_explain_nonce( $action ) {
        if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) {
                $verb = $matches[1];
 function wp_explain_nonce( $action ) {
        if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) {
                $verb = $matches[1];
@@ -1717,7 +2150,7 @@ function wp_explain_nonce( $action ) {
                $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['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['upgrade']['plugin']    = array( __( 'Your attempt to upgrade this plugin: &quot;%s&quot; has failed.' ), 'use_id' );
 
                $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['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' );
@@ -1735,6 +2168,8 @@ function wp_explain_nonce( $action ) {
                $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']['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['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] ) ) {
                        if ( !empty( $trans[$verb][$noun][1] ) ) {
                                $lookup = $trans[$verb][$noun][1];
@@ -1751,19 +2186,50 @@ function wp_explain_nonce( $action ) {
        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] );
 }
 
-
+/**
+ * Display "Are You Sure" message to confirm the action being taken.
+ *
+ * If the action has the nonce explain message, then it will be displayed along
+ * with the "Are you sure?" message.
+ *
+ * @package WordPress
+ * @subpackage Security
+ * @since 2.0.4
+ *
+ * @param string $action The 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 ) ) . '</p>';
+       $html = wp_specialchars( wp_explain_nonce( $action ) );
        if ( wp_get_referer() )
        if ( wp_get_referer() )
-               $html .= "<p><a href='" . remove_query_arg( 'updated', clean_url( wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
+               $html .= "</p><p><a href='" . remove_query_arg( 'updated', clean_url( wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
+       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' ) );
+
        wp_die( $html, $title);
 }
 
        wp_die( $html, $title);
 }
 
-
-function wp_die( $message, $title = '' ) {
+/**
+ * Kill WordPress execution and display HTML message with error message.
+ *
+ * Call this function complements the die() PHP function. The difference is that
+ * HTML will be displayed to the user. It is recommended to use this function
+ * only, when the execution should not continue any further. It is not
+ * recommended to call this function very often and try to handle as many errors
+ * as possible siliently.
+ *
+ * @since 2.0.4
+ *
+ * @param string $message Error message.
+ * @param string $title Error title.
+ * @param string|array $args Optional arguements to control behaviour.
+ */
+function wp_die( $message, $title = '', $args = array() ) {
        global $wp_locale;
 
        global $wp_locale;
 
+       $defaults = array( 'response' => 500 );
+       $r = wp_parse_args($args, $defaults);
+
        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();
@@ -1797,7 +2263,7 @@ function wp_die( $message, $title = '' ) {
 
        if ( !function_exists( 'did_action' ) || !did_action( 'admin_head' ) ) :
        if( !headers_sent() ){
 
        if ( !function_exists( 'did_action' ) || !did_action( 'admin_head' ) ) :
        if( !headers_sent() ){
-               status_header( 500 );
+               status_header( $r['response'] );
                nocache_headers();
                header( 'Content-Type: text/html; charset=utf-8' );
        }
                nocache_headers();
                header( 'Content-Type: text/html; charset=utf-8' );
        }
@@ -1824,27 +2290,70 @@ if ( ( $wp_locale ) && ( 'rtl' == $wp_locale->text_direction ) ) : ?>
 <body id="error-page">
 <?php endif; ?>
        <?php echo $message; ?>
 <body id="error-page">
 <?php endif; ?>
        <?php echo $message; ?>
+       <?php if ( strlen($message) < 512) echo str_repeat(' ', 512-strlen($message)); ?>
 </body>
 </html>
 <?php
        die();
 }
 
 </body>
 </html>
 <?php
        die();
 }
 
-
+/**
+ * Retrieve the WordPress home page URL.
+ *
+ * If the constant named 'WP_HOME' exists, then it willl be used and returned by
+ * the function. This can be used to counter the redirection on your local
+ * development environment.
+ *
+ * @access private
+ * @package WordPress
+ * @since 2.2.0
+ *
+ * @param string $url URL for the home location
+ * @return string Homepage location.
+ */
 function _config_wp_home( $url = '' ) {
        if ( defined( 'WP_HOME' ) )
                return WP_HOME;
        return $url;
 }
 
 function _config_wp_home( $url = '' ) {
        if ( defined( 'WP_HOME' ) )
                return WP_HOME;
        return $url;
 }
 
-
+/**
+ * Retrieve the WordPress site URL.
+ *
+ * If the constant named 'WP_SITEURL' is defined, then the value in that
+ * constant will always be returned. This can be used for debugging a site on
+ * your localhost while not having to change the database to your URL.
+ *
+ * @access private
+ * @package WordPress
+ * @since 2.2.0
+ *
+ * @param string $url URL to set the WordPress site location.
+ * @return string The WordPress Site URL
+ */
 function _config_wp_siteurl( $url = '' ) {
        if ( defined( 'WP_SITEURL' ) )
                return WP_SITEURL;
        return $url;
 }
 
 function _config_wp_siteurl( $url = '' ) {
        if ( defined( 'WP_SITEURL' ) )
                return WP_SITEURL;
        return $url;
 }
 
-
+/**
+ * Set the localized direction for MCE plugin.
+ *
+ * Will only set the direction to 'rtl', if the WordPress locale has the text
+ * direction set to 'rtl'.
+ *
+ * Fills in the 'directionality', 'plugins', and 'theme_advanced_button1' array
+ * keys. These keys are then returned in the $input array.
+ *
+ * @access private
+ * @package WordPress
+ * @subpackage MCE
+ * @since 2.1.0
+ *
+ * @param array $input MCE plugin array.
+ * @return array Direction set for 'rtl', if needed by locale.
+ */
 function _mce_set_direction( $input ) {
        global $wp_locale;
 
 function _mce_set_direction( $input ) {
        global $wp_locale;
 
@@ -1857,7 +2366,33 @@ function _mce_set_direction( $input ) {
        return $input;
 }
 
        return $input;
 }
 
-
+/**
+ * Convert smiley code to the icon graphic file equivalent.
+ *
+ * You can turn off smilies, by going to the write setting screen and unchecking
+ * the box, or by setting 'use_smilies' option to false or removing the option.
+ *
+ * Plugins may override the default smiley list by setting the $wpsmiliestrans
+ * 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 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 $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace;
 
 function smilies_init() {
        global $wpsmiliestrans, $wp_smiliessearch, $wp_smiliesreplace;
 
@@ -1993,7 +2528,7 @@ function wp_ob_end_flush_all() {
  * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is
  * defined globally by the inline code in wp-db.php.
  *
  * wp-admin/setup-config.php We must globalise $wpdb to ensure that it is
  * defined globally by the inline code in wp-db.php.
  *
- * @since 2.5
+ * @since 2.5.0
  * @global $wpdb WordPress Database Object
  */
 function require_wp_db() {
  * @global $wpdb WordPress Database Object
  */
 function require_wp_db() {
@@ -2015,7 +2550,10 @@ function require_wp_db() {
  * search engines from caching the message. Custom DB messages should do the
  * same.
  *
  * search engines from caching the message. Custom DB messages should do the
  * same.
  *
- * @since 2.5
+ * This function was backported to the the WordPress 2.3.2, but originally was
+ * added in WordPress 2.5.0.
+ *
+ * @since 2.3.2
  * @uses $wpdb
  */
 function dead_db() {
  * @uses $wpdb
  */
 function dead_db() {
@@ -2054,10 +2592,10 @@ function dead_db() {
 /**
  * Converts value to positive integer.
  *
 /**
  * Converts value to positive integer.
  *
- * @since 2.5
- * 
- * @param mixed $maybeint data you wish to have convered to an absolute integer
- * @return int an absolute integer
+ * @since 2.5.0
+ *
+ * @param mixed $maybeint Data you wish to have convered to an absolute integer
+ * @return int An absolute integer
  */
 function absint( $maybeint ) {
        return abs( intval( $maybeint ) );
  */
 function absint( $maybeint ) {
        return abs( intval( $maybeint ) );
@@ -2069,29 +2607,29 @@ function absint( $maybeint ) {
  * Determines if blog can be accessed over SSL by using cURL to access the site
  * using the https in the siteurl. Requires cURL extension to work correctly.
  *
  * Determines if blog can be accessed over SSL by using cURL to access the site
  * using the https in the siteurl. Requires cURL extension to work correctly.
  *
- * @since 2.5
+ * @since 2.5.0
  *
  * @return bool Whether or not SSL access is available
  */
 function url_is_accessable_via_ssl($url)
 {
        if (in_array('curl', get_loaded_extensions())) {
  *
  * @return bool Whether or not SSL access is available
  */
 function url_is_accessable_via_ssl($url)
 {
        if (in_array('curl', get_loaded_extensions())) {
-                $ssl = preg_replace( '/^http:\/\//', 'https://',  $url );
+               $ssl = preg_replace( '/^http:\/\//', 'https://',  $url );
 
 
-                $ch = curl_init();
-                curl_setopt($ch, CURLOPT_URL, $ssl);
-                curl_setopt($ch, CURLOPT_FAILONERROR, true);
-                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
-                curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+               $ch = curl_init();
+               curl_setopt($ch, CURLOPT_URL, $ssl);
+               curl_setopt($ch, CURLOPT_FAILONERROR, true);
+               curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+               curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
 
 
-                curl_exec($ch);
+               curl_exec($ch);
 
 
-                $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
-                curl_close ($ch);
+               $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
+               curl_close ($ch);
 
 
-                if ($status == 200 || $status == 401) {
-                        return true;
-                }
+               if ($status == 200 || $status == 401) {
+                       return true;
+               }
        }
        return false;
 }
        }
        return false;
 }
@@ -2099,7 +2637,7 @@ function url_is_accessable_via_ssl($url)
 /**
  * Secure URL, if available or the given URL.
  *
 /**
  * Secure URL, if available or the given URL.
  *
- * @since 2.5
+ * @since 2.5.0
  *
  * @param string $url Complete URL path with transport.
  * @return string Secure or regular URL path.
  *
  * @param string $url Complete URL path with transport.
  * @return string Secure or regular URL path.
@@ -2126,14 +2664,14 @@ function atom_service_url_filter($url)
  *
  * @package WordPress
  * @package Debug
  *
  * @package WordPress
  * @package Debug
- * @since 2.5
+ * @since 2.5.0
  * @access private
  *
  * @uses do_action() Calls 'deprecated_function_run' and passes the function name and what to use instead.
  * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do trigger or false to not trigger error.
  *
  * @param string $function The function that was called
  * @access private
  *
  * @uses do_action() Calls 'deprecated_function_run' and passes the function name and what to use instead.
  * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do trigger or false to not trigger error.
  *
  * @param string $function The function that was called
- * @param string $version The version of WordPress that depreceated the function
+ * @param string $version The version of WordPress that deprecated the function
  * @param string $replacement Optional. The function that should have been called
  */
 function _deprecated_function($function, $version, $replacement=null) {
  * @param string $replacement Optional. The function that should have been called
  */
 function _deprecated_function($function, $version, $replacement=null) {
@@ -2163,14 +2701,14 @@ function _deprecated_function($function, $version, $replacement=null) {
  *
  * @package WordPress
  * @package Debug
  *
  * @package WordPress
  * @package Debug
- * @since 2.5
+ * @since 2.5.0
  * @access private
  *
  * @uses do_action() Calls 'deprecated_file_included' and passes the file name and what to use instead.
  * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do trigger or false to not trigger error.
  *
  * @param string $file The file that was included
  * @access private
  *
  * @uses do_action() Calls 'deprecated_file_included' and passes the file name and what to use instead.
  * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do trigger or false to not trigger error.
  *
  * @param string $file The file that was included
- * @param string $version The version of WordPress that depreceated the function
+ * @param string $version The version of WordPress that deprecated the function
  * @param string $replacement Optional. The function that should have been called
  */
 function _deprecated_file($file, $version, $replacement=null) {
  * @param string $replacement Optional. The function that should have been called
  */
 function _deprecated_file($file, $version, $replacement=null) {
@@ -2189,7 +2727,7 @@ function _deprecated_file($file, $version, $replacement=null) {
 /**
  * Is the server running earlier than 1.5.0 version of lighttpd
  *
 /**
  * Is the server running earlier than 1.5.0 version of lighttpd
  *
- * @since unknown
+ * @since 2.5.0
  *
  * @return bool Whether the server is running lighttpd < 1.5.0
  */
  *
  * @return bool Whether the server is running lighttpd < 1.5.0
  */
@@ -2202,7 +2740,7 @@ function is_lighttpd_before_150() {
 /**
  * Does the specified module exist in the apache config?
  *
 /**
  * Does the specified module exist in the apache config?
  *
- * @since unknown
+ * @since 2.5.0
  *
  * @param string $mod e.g. mod_rewrite
  * @param bool $default The default return value if the module is not found
  *
  * @param string $mod e.g. mod_rewrite
  * @param bool $default The default return value if the module is not found
@@ -2236,7 +2774,7 @@ function apache_mod_loaded($mod, $default = false) {
  * character. A return value of '3' means that the file is not in the allowed
  * files list.
  *
  * character. A return value of '3' means that the file is not in the allowed
  * files list.
  *
- * @since 2.6
+ * @since 1.2.0
  *
  * @param string $file File path.
  * @param array $allowed_files List of allowed files.
  *
  * @param string $file File path.
  * @param array $allowed_files List of allowed files.
@@ -2261,18 +2799,26 @@ function validate_file( $file, $allowed_files = '' ) {
 /**
  * Determine if SSL is used.
  *
 /**
  * Determine if SSL is used.
  *
- * @since 2.6
+ * @since 2.6.0
  *
  * @return bool True if SSL, false if not used.
  */
 function is_ssl() {
  *
  * @return bool True if SSL, false if not used.
  */
 function is_ssl() {
-       return ( isset($_SERVER['HTTPS']) && 'on' == strtolower($_SERVER['HTTPS']) ) ? true : false; 
+       if ( isset($_SERVER['HTTPS']) ) {
+               if ( 'on' == strtolower($_SERVER['HTTPS']) )
+                       return true;
+               if ( '1' == $_SERVER['HTTPS'] )
+                       return true;
+       } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
+               return true;
+       }
+       return false;
 }
 
 /**
  * Whether SSL login should be forced.
  *
 }
 
 /**
  * Whether SSL login should be forced.
  *
- * @since 2.6
+ * @since 2.6.0
  *
  * @param string|bool $force Optional.
  * @return bool True if forced, false if not forced.
  *
  * @param string|bool $force Optional.
  * @return bool True if forced, false if not forced.
@@ -2292,7 +2838,7 @@ function force_ssl_login($force = '') {
 /**
  * Whether to force SSL used for the Administration Panels.
  *
 /**
  * Whether to force SSL used for the Administration Panels.
  *
- * @since 2.6
+ * @since 2.6.0
  *
  * @param string|bool $force
  * @return bool True if forced, false if not forced.
  *
  * @param string|bool $force
  * @return bool True if forced, false if not forced.
@@ -2315,7 +2861,7 @@ function force_ssl_admin($force = '') {
  * Will remove wp-admin links to retrieve only return URLs not in the wp-admin
  * directory.
  *
  * Will remove wp-admin links to retrieve only return URLs not in the wp-admin
  * directory.
  *
- * @since 2.6
+ * @since 2.6.0
  *
  * @return string
  */
  *
  * @return string
  */
@@ -2329,4 +2875,43 @@ function wp_guess_url() {
        return $url;
 }
 
        return $url;
 }
 
-?>
\ No newline at end of file
+/**
+ * Suspend cache invalidation.
+ *
+ * Turns cache invalidation on and off.  Useful during imports where you don't wont to do invalidations
+ * every time a post is inserted.  Callers must be sure that what they are doing won't lead to an inconsistent
+ * cache when invalidation is suspended.
+ *
+ * @since 2.7.0
+ *
+ * @param bool $suspend Whether to suspend or enable cache invalidation
+ * @return bool The current suspend setting
+ */
+function wp_suspend_cache_invalidation($suspend = true) {
+       global $_wp_suspend_cache_invalidation;
+
+       $current_suspend = $_wp_suspend_cache_invalidation;
+       $_wp_suspend_cache_invalidation = $suspend;
+       return $current_suspend;
+}
+
+/**
+ * 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;
+}
+
+
+?>
index 87995a4b9ab2915be961a73453ef15db0cf48a6d..1f7e6aca71224e526e5730a73f671f2263e25457 100644 (file)
@@ -1,13 +1,21 @@
 <?php
 <?php
+/**
+ * BackPress script procedural API.
+ *
+ * @package BackPress
+ * @since r16
+ */
 
 /**
 
 /**
- * Prints script tags in document head
+ * Prints script tags in document head.
  *
  *
- * Called by admin-header.php and by wp_head hook. Since it is called by wp_head on every page load,
- * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
- * Does make use of already instantiated $wp_scripts if present.
- * Use provided wp_print_scripts hook to register/enqueue new scripts.
+ * Called by admin-header.php and by wp_head hook. Since it is called by wp_head
+ * on every page load, the function does not instantiate the WP_Scripts object
+ * unless script names are explicitly passed. Does make use of already
+ * instantiated $wp_scripts if present. Use provided wp_print_scripts hook to
+ * register/enqueue new scripts.
  *
  *
+ * @since r16
  * @see WP_Scripts::print_scripts()
  */
 function wp_print_scripts( $handles = false ) {
  * @see WP_Scripts::print_scripts()
  */
 function wp_print_scripts( $handles = false ) {
@@ -26,6 +34,12 @@ function wp_print_scripts( $handles = false ) {
        return $wp_scripts->do_items( $handles );
 }
 
        return $wp_scripts->do_items( $handles );
 }
 
+/**
+ * Register new JavaScript file.
+ *
+ * @since r16
+ * @see WP_Scripts::add() For parameter information.
+ */
 function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
 function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
@@ -35,10 +49,11 @@ function wp_register_script( $handle, $src, $deps = array(), $ver = false ) {
 }
 
 /**
 }
 
 /**
- * Localizes a script
+ * Localizes a script.
  *
  *
- * Localizes only if script has already been added
+ * Localizes only if script has already been added.
  *
  *
+ * @since r16
  * @see WP_Script::localize()
  */
 function wp_localize_script( $handle, $object_name, $l10n ) {
  * @see WP_Script::localize()
  */
 function wp_localize_script( $handle, $object_name, $l10n ) {
@@ -49,6 +64,12 @@ function wp_localize_script( $handle, $object_name, $l10n ) {
        return $wp_scripts->localize( $handle, $object_name, $l10n );
 }
 
        return $wp_scripts->localize( $handle, $object_name, $l10n );
 }
 
+/**
+ * Remove a registered script.
+ *
+ * @since r16
+ * @see WP_Scripts::remove() For parameter information.
+ */
 function wp_deregister_script( $handle ) {
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
 function wp_deregister_script( $handle ) {
        global $wp_scripts;
        if ( !is_a($wp_scripts, 'WP_Scripts') )
@@ -58,10 +79,11 @@ function wp_deregister_script( $handle ) {
 }
 
 /**
 }
 
 /**
- * Equeues script
+ * Enqueues script.
  *
  * Registers the script if src provided (does NOT overwrite) and enqueues.
  *
  *
  * Registers the script if src provided (does NOT overwrite) and enqueues.
  *
+ * @since r16
  * @see WP_Script::add(), WP_Script::enqueue()
 */
 function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
  * @see WP_Script::add(), WP_Script::enqueue()
 */
 function wp_enqueue_script( $handle, $src = false, $deps = array(), $ver = false ) {
index 8a3828265f7f988bd4b59bbd3a7713bae0a5624a..44e362c023337df7bd627abbc0f64ab1f9edbef4 100644 (file)
@@ -1,5 +1,21 @@
 <?php
 <?php
+/**
+ * BackPress styles procedural API.
+ *
+ * @package BackPress
+ * @since r79
+ */
 
 
+/**
+ * Display styles that are in the queue or part of $handles.
+ *
+ * @since r79
+ * @uses do_action() Calls 'wp_print_styles' hook.
+ * @global object $wp_styles The WP_Styles object for printing styles.
+ *
+ * @param array $handles (optional) Styles to be printed.  (void) prints queue, (string) prints that style, (array of strings) prints those styles.
+ * @return bool True on success, false on failure.
+ */
 function wp_print_styles( $handles = false ) {
        do_action( 'wp_print_styles' );
        if ( '' === $handles ) // for wp_head
 function wp_print_styles( $handles = false ) {
        do_action( 'wp_print_styles' );
        if ( '' === $handles ) // for wp_head
@@ -16,7 +32,13 @@ function wp_print_styles( $handles = false ) {
        return $wp_styles->do_items( $handles );
 }
 
        return $wp_styles->do_items( $handles );
 }
 
-function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = false ) {
+/**
+ * Register CSS style file.
+ *
+ * @since r79
+ * @see WP_Styles::add() For parameter and additional information.
+ */
+function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
                $wp_styles = new WP_Styles();
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
                $wp_styles = new WP_Styles();
@@ -24,6 +46,12 @@ function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media
        $wp_styles->add( $handle, $src, $deps, $ver, $media );
 }
 
        $wp_styles->add( $handle, $src, $deps, $ver, $media );
 }
 
+/**
+ * Remove a registered CSS file.
+ *
+ * @since r79
+ * @see WP_Styles::remove() For parameter and additional information.
+ */
 function wp_deregister_style( $handle ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
 function wp_deregister_style( $handle ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
@@ -32,6 +60,12 @@ function wp_deregister_style( $handle ) {
        $wp_styles->remove( $handle );
 }
 
        $wp_styles->remove( $handle );
 }
 
+/**
+ * Enqueue a CSS style file.
+ *
+ * @since r79
+ * @see WP_Styles::add(), WP_Styles::enqueue()
+ */
 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
index 1d070149dc3ade3fbab7b1e009968543c49e55f8..f2e087149eb4d1c129bde843270e736a3c4d2e76 100644 (file)
 <?php
 <?php
+/**
+ * General template tags that can go anywhere in a template.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
 
 
-/* Note: these tags go anywhere in the template */
-
-function get_header() {
+/**
+ * Load header template.
+ *
+ * Includes the header template for a theme or if a name is specified then a
+ * specialised header will be included. If the theme contains no header.php file
+ * then the header from the default theme will be included.
+ *
+ * For the parameter, if the file is called "header-special.php" then specify
+ * "special".
+ *
+ * @uses locate_template()
+ * @since 1.5.0
+ * @uses do_action() Calls 'get_header' action.
+ *
+ * @param string $name The name of the specialised header.
+ */
+function get_header( $name = null ) {
        do_action( 'get_header' );
        do_action( 'get_header' );
-       if ( file_exists( TEMPLATEPATH . '/header.php') )
-               load_template( TEMPLATEPATH . '/header.php');
-       else
-               load_template( WP_CONTENT_DIR . '/themes/default/header.php');
-}
 
 
+       $templates = array();
+       if ( isset($name) )
+               $templates[] = "header-{$name}.php";
 
 
-function get_footer() {
-       do_action( 'get_footer' );
-       if ( file_exists( TEMPLATEPATH . '/footer.php') )
-               load_template( TEMPLATEPATH . '/footer.php');
-       else
-               load_template( WP_CONTENT_DIR . '/themes/default/footer.php');
+       $templates[] = "header.php";
+
+       if ('' == locate_template($templates, true))
+               load_template( get_theme_root() . '/default/header.php');
 }
 
 }
 
+/**
+ * Load footer template.
+ *
+ * Includes the footer template for a theme or if a name is specified then a
+ * specialised footer will be included. If the theme contains no footer.php file
+ * then the footer from the default theme will be included.
+ *
+ * For the parameter, if the file is called "footer-special.php" then specify
+ * "special".
+ *
+ * @uses locate_template()
+ * @since 1.5.0
+ * @uses do_action() Calls 'get_footer' action.
+ *
+ * @param string $name The name of the specialised footer.
+ */
+function get_footer( $name = null ) {
+       do_action( 'get_footer' );
+
+       $templates = array();
+       if ( isset($name) )
+               $templates[] = "footer-{$name}.php";
+
+       $templates[] = "footer.php";
+
+       if ('' == locate_template($templates, true))
+               load_template( get_theme_root() . '/default/footer.php');
+}
 
 
+/**
+ * Load sidebar template.
+ *
+ * Includes the sidebar template for a theme or if a name is specified then a
+ * specialised sidebar will be included. If the theme contains no sidebar.php
+ * file then the sidebar from the default theme will be included.
+ *
+ * For the parameter, if the file is called "sidebar-special.php" then specify
+ * "special".
+ *
+ * @uses locate_template()
+ * @since 1.5.0
+ * @uses do_action() Calls 'get_sidebar' action.
+ *
+ * @param string $name The name of the specialised sidebar.
+ */
 function get_sidebar( $name = null ) {
        do_action( 'get_sidebar' );
 function get_sidebar( $name = null ) {
        do_action( 'get_sidebar' );
-       if ( isset($name) && file_exists( TEMPLATEPATH . "/sidebar-{$name}.php") )
-               load_template( TEMPLATEPATH . "/sidebar-{$name}.php");
-       elseif ( file_exists( TEMPLATEPATH . '/sidebar.php') )
-               load_template( TEMPLATEPATH . '/sidebar.php');
-       else
-               load_template( WP_CONTENT_DIR . '/themes/default/sidebar.php');
+
+       $templates = array();
+       if ( isset($name) )
+               $templates[] = "sidebar-{$name}.php";
+
+       $templates[] = "sidebar.php";
+
+       if ('' == locate_template($templates, true))
+               load_template( get_theme_root() . '/default/sidebar.php');
 }
 
 }
 
+/**
+ * Display 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.
+ *
+ * @since 2.7.0
+ */
+function get_search_form() {
+       do_action( 'get_search_form' );
+
+       if ( '' != locate_template(array('searchform.php'), true) )
+               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')).'" />
+       </div>
+       </form>';
+
+       echo apply_filters('get_search_form', $form);
+}
 
 
+/**
+ * Display the Log In/Out link.
+ *
+ * Displays a link, which allows the user to navigate to the Log In page to log in
+ * or log out depending on whether or not they are currently logged in.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'loginout' hook on HTML link content.
+ */
 function wp_loginout() {
        if ( ! is_user_logged_in() )
 function wp_loginout() {
        if ( ! is_user_logged_in() )
-               $link = '<a href="' . site_url('wp-login.php', 'login') . '">' . __('Log in') . '</a>';
+               $link = '<a href="' . wp_login_url() . '">' . __('Log in') . '</a>';
        else
        else
-               $link = '<a href="' . site_url('wp-login.php?action=logout', 'login') . '">' . __('Log out') . '</a>';
+               $link = '<a href="' . wp_logout_url() . '">' . __('Log out') . '</a>';
 
        echo apply_filters('loginout', $link);
 }
 
 
        echo apply_filters('loginout', $link);
 }
 
+/**
+ * Returns the Log Out URL.
+ *
+ * Returns the URL that allows the user to log out of the site
+ *
+ * @since 2.7
+ * @uses wp_nonce_url() To protect against CSRF
+ * @uses site_url() To generate the log in URL
+ *
+ * @param string $redirect Path to redirect to on logout.
+ */
+function wp_logout_url($redirect = '') {
+       if ( strlen($redirect) )
+               $redirect = "&redirect_to=$redirect";
+
+       return wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' );
+}
 
 
+/**
+ * Returns the Log In URL.
+ *
+ * Returns the URL that allows the user to log in to the site
+ *
+ * @since 2.7
+ * @uses site_url() To generate the log in URL
+ *
+ * @param string $redirect Path to redirect to on login.
+ */
+function wp_login_url($redirect = '') {
+       if ( strlen($redirect) )
+               $redirect = "?redirect_to=$redirect";
+
+       return site_url("wp-login.php$redirect", 'login');
+}
+
+/**
+ * Display the Registration or Admin link.
+ *
+ * Display a link which allows the user to navigate to the registration page if
+ * not logged in and registration is enabled or to the dashboard if logged in.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'register' hook on register / admin link content.
+ *
+ * @param string $before Text to output before the link (defaults to <li>).
+ * @param string $after Text to output after the link (defaults to </li>).
+ */
 function wp_register( $before = '<li>', $after = '</li>' ) {
 
        if ( ! is_user_logged_in() ) {
 function wp_register( $before = '<li>', $after = '</li>' ) {
 
        if ( ! is_user_logged_in() ) {
@@ -55,21 +197,60 @@ function wp_register( $before = '<li>', $after = '</li>' ) {
        echo apply_filters('register', $link);
 }
 
        echo apply_filters('register', $link);
 }
 
-
+/**
+ * Theme container function for the 'wp_meta' action.
+ *
+ * The 'wp_meta' action can have several purposes, depending on how you use it,
+ * but one purpose might have been to allow for theme switching.
+ *
+ * @since 1.5.0
+ * @link http://trac.wordpress.org/ticket/1458 Explanation of 'wp_meta' action.
+ * @uses do_action() Calls 'wp_meta' hook.
+ */
 function wp_meta() {
        do_action('wp_meta');
 }
 
 function wp_meta() {
        do_action('wp_meta');
 }
 
-
+/**
+ * Display information about the blog.
+ *
+ * @see get_bloginfo() For possible values for the parameter.
+ * @since 0.71
+ *
+ * @param string $show What to display.
+ */
 function bloginfo($show='') {
        echo get_bloginfo($show, 'display');
 }
 
 /**
 function bloginfo($show='') {
        echo get_bloginfo($show, 'display');
 }
 
 /**
- * Note: some of these values are DEPRECATED. Meaning they could be
- * taken out at any time and shouldn't be relied upon. Options
- * without "// DEPRECATED" are the preferred and recommended ways
- * to get the information.
+ * Retrieve information about the blog.
+ *
+ * Some show parameter values are deprecated and will be removed in future
+ * versions. Care should be taken to check the function contents and know what
+ * the deprecated blog info options are. Options without "// DEPRECATED" are
+ * the preferred and recommended ways to get the information.
+ *
+ * The possible values for the 'show' parameter are listed below.
+ * <ol>
+ * <li><strong>url<strong> - Blog URI to homepage.</li>
+ * <li><strong>wpurl</strong> - Blog URI path to WordPress.</li>
+ * <li><strong>description</strong> - Secondary title</li>
+ * </ol>
+ *
+ * The feed URL options can be retrieved from 'rdf_url' (RSS 0.91),
+ * 'rss_url' (RSS 1.0), 'rss2_url' (RSS 2.0), or 'atom_url' (Atom feed). The
+ * comment feeds can be retrieved from the 'comments_atom_url' (Atom comment
+ * feed) or 'comments_rss2_url' (RSS 2.0 comment feed).
+ *
+ * There are many other options and you should check the function contents:
+ * {@source 32 37}
+ *
+ * @since 0.71
+ *
+ * @param string $show Blog info to retrieve.
+ * @param string $filter How to filter what is retrieved.
+ * @return string Mostly string values, might be empty.
  */
 function get_bloginfo($show = '', $filter = 'raw') {
 
  */
 function get_bloginfo($show = '', $filter = 'raw') {
 
@@ -160,7 +341,28 @@ function get_bloginfo($show = '', $filter = 'raw') {
        return $output;
 }
 
        return $output;
 }
 
-
+/**
+ * Display or retrieve page title for all areas of blog.
+ *
+ * By default, the page title will display the separator before the page title,
+ * so that the blog title will be before the page title. This is not good for
+ * title display, since the blog title shows up on most tabs and not what is
+ * important, which is the page that the user is looking at.
+ *
+ * There are also SEO benefits to having the blog title after or to the 'right'
+ * or the page title. However, it is mostly common sense to have the blog title
+ * to the right with most browsers supporting tabs. You can achieve this by
+ * using the seplocation parameter and setting the value to 'right'. This change
+ * was introduced around 2.5.0, in case backwards compatibility of themes is
+ * important.
+ *
+ * @since 1.0.0
+ *
+ * @param string $sep Optional, default is '&raquo;'. How to separate the various items within the page title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @param string $seplocation Optional. Direction to display title, 'right'.
+ * @return string|null String on retrieve, null when displaying.
+ */
 function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
        global $wpdb, $wp_locale, $wp_query;
 
 function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
        global $wpdb, $wp_locale, $wp_query;
 
@@ -175,6 +377,8 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
        $day = get_query_var('day');
        $title = '';
 
        $day = get_query_var('day');
        $title = '';
 
+       $t_sep = '%WP_TITILE_SEP%'; // Temporary separator, for accurate flipping, if necessary
+
        // If there's a category
        if ( !empty($cat) ) {
                        // category exclusion
        // If there's a category
        if ( !empty($cat) ) {
                        // category exclusion
@@ -216,19 +420,19 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
                $my_year = substr($m, 0, 4);
                $my_month = $wp_locale->get_month(substr($m, 4, 2));
                $my_day = intval(substr($m, 6, 2));
                $my_year = substr($m, 0, 4);
                $my_month = $wp_locale->get_month(substr($m, 4, 2));
                $my_day = intval(substr($m, 6, 2));
-               $title = "$my_year" . ($my_month ? "$sep $my_month" : "") . ($my_day ? "$sep $my_day" : "");
+               $title = "$my_year" . ($my_month ? "$t_sep$my_month" : "") . ($my_day ? "$t_sep$my_day" : "");
        }
 
        if ( !empty($year) ) {
                $title = $year;
                if ( !empty($monthnum) )
        }
 
        if ( !empty($year) ) {
                $title = $year;
                if ( !empty($monthnum) )
-                       $title .= " $sep " . $wp_locale->get_month($monthnum);
+                       $title .= "$t_sep" . $wp_locale->get_month($monthnum);
                if ( !empty($day) )
                if ( !empty($day) )
-                       $title .= " $sep " . zeroise($day, 2);
+                       $title .= "$t_sep" . zeroise($day, 2);
        }
 
        // If there is a post
        }
 
        // If there is a post
-       if ( is_single() || is_page() ) {
+       if ( is_single() ||  ( 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 ) );
        }
@@ -240,23 +444,28 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
                $tax = $tax->label;
                $term = $wp_query->get_queried_object();
                $term = $term->name;
                $tax = $tax->label;
                $term = $wp_query->get_queried_object();
                $term = $term->name;
-               if ( 'right' == $seplocation )
-                       $title = "$term $sep $tax";
-               else
-                       $title = "$tax $sep $term";
+               $title = "$tax$t_sep$term";
+       }
+
+       if ( is_404() ) {
+               $title = __('Page not found');
        }
 
        $prefix = '';
        if ( !empty($title) )
                $prefix = " $sep ";
 
        }
 
        $prefix = '';
        if ( !empty($title) )
                $prefix = " $sep ";
 
-       // Determines position of the separator
-       if ( 'right' == $seplocation )
-               $title = $title . $prefix;
-       else
-               $title = $prefix . $title;
+       // Determines position of the separator and direction of the breadcrumb
+       if ( 'right' == $seplocation ) { // sep on right, so reverse the order
+               $title_array = explode( $t_sep, $title );
+               $title_array = array_reverse( $title_array );
+               $title = implode( " $sep ", $title_array ) . $prefix;
+       } else {
+               $title_array = explode( $t_sep, $title );
+               $title = $prefix . implode( " $sep ", $title_array );
+       }
 
 
-       $title = apply_filters('wp_title', $title, $sep);
+       $title = apply_filters('wp_title', $title, $sep, $seplocation);
 
        // Send it out
        if ( $display )
 
        // Send it out
        if ( $display )
@@ -266,7 +475,24 @@ function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
 
 }
 
 
 }
 
-
+/**
+ * Display or retrieve page title for post.
+ *
+ * This is optimized for single.php template file for displaying the post title.
+ * Only useful for posts, does not support pages for example.
+ *
+ * It does not support placing the separator after the title, but by leaving the
+ * prefix parameter empty, you can set the title separator manually. The prefix
+ * does not automatically place a space between the prefix, so if there should
+ * be a space, the parameter value will need to have it at the end.
+ *
+ * @since 0.71
+ * @uses $wpdb
+ *
+ * @param string $prefix Optional. What to display before the title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @return string|null Title when retrieving, null when displaying or failure.
+ */
 function single_post_title($prefix = '', $display = true) {
        global $wpdb;
        $p = get_query_var('p');
 function single_post_title($prefix = '', $display = true) {
        global $wpdb;
        $p = get_query_var('p');
@@ -285,7 +511,23 @@ function single_post_title($prefix = '', $display = true) {
        }
 }
 
        }
 }
 
-
+/**
+ * Display or retrieve page title for category archive.
+ *
+ * This is useful for category template file or files, because it is optimized
+ * for category page title and with less overhead than {@link wp_title()}.
+ *
+ * It does not support placing the separator after the title, but by leaving the
+ * prefix parameter empty, you can set the title separator manually. The prefix
+ * does not automatically place a space between the prefix, so if there should
+ * be a space, the parameter value will need to have it at the end.
+ *
+ * @since 0.71
+ *
+ * @param string $prefix Optional. What to display before the title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @return string|null Title when retrieving, null when displaying or failure.
+ */
 function single_cat_title($prefix = '', $display = true ) {
        $cat = intval( get_query_var('cat') );
        if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
 function single_cat_title($prefix = '', $display = true ) {
        $cat = intval( get_query_var('cat') );
        if ( !empty($cat) && !(strtoupper($cat) == 'ALL') ) {
@@ -301,7 +543,23 @@ function single_cat_title($prefix = '', $display = true ) {
        }
 }
 
        }
 }
 
-
+/**
+ * Display or retrieve page title for tag post archive.
+ *
+ * Useful for tag template files for displaying the tag page title. It has less
+ * overhead than {@link wp_title()}, because of its limited implementation.
+ *
+ * It does not support placing the separator after the title, but by leaving the
+ * prefix parameter empty, you can set the title separator manually. The prefix
+ * does not automatically place a space between the prefix, so if there should
+ * be a space, the parameter value will need to have it at the end.
+ *
+ * @since 2.3.0
+ *
+ * @param string $prefix Optional. What to display before the title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @return string|null Title when retrieving, null when displaying or failure.
+ */
 function single_tag_title($prefix = '', $display = true ) {
        if ( !is_tag() )
                return;
 function single_tag_title($prefix = '', $display = true ) {
        if ( !is_tag() )
                return;
@@ -322,7 +580,24 @@ function single_tag_title($prefix = '', $display = true ) {
        }
 }
 
        }
 }
 
-
+/**
+ * Display or retrieve page title for post archive based on date.
+ *
+ * Useful for when the template only needs to display the month and year, if
+ * either are available. Optimized for just this purpose, so if it is all that
+ * is needed, should be better than {@link wp_title()}.
+ *
+ * It does not support placing the separator after the title, but by leaving the
+ * prefix parameter empty, you can set the title separator manually. The prefix
+ * does not automatically place a space between the prefix, so if there should
+ * be a space, the parameter value will need to have it at the end.
+ *
+ * @since 0.71
+ *
+ * @param string $prefix Optional. What to display before the title.
+ * @param bool $display Optional, default is true. Whether to display or retrieve title.
+ * @return string|null Title when retrieving, null when displaying or failure.
+ */
 function single_month_title($prefix = '', $display = true ) {
        global $wp_locale;
 
 function single_month_title($prefix = '', $display = true ) {
        global $wp_locale;
 
@@ -348,8 +623,41 @@ function single_month_title($prefix = '', $display = true ) {
        echo $result;
 }
 
        echo $result;
 }
 
-
-/* link navigation hack by Orien http://icecode.com/ */
+/**
+ * Retrieve archive link content based on predefined or custom code.
+ *
+ * The format can be one of four styles. The 'link' for head element, 'option'
+ * for use in the select element, 'html' for use in list (either ol or ul HTML
+ * elements). Custom content is also supported using the before and after
+ * parameters.
+ *
+ * The 'link' format uses the link HTML element with the <em>archives</em>
+ * relationship. The before and after parameters are not used. The text
+ * parameter is used to describe the link.
+ *
+ * The 'option' format uses the option HTML element for use in select element.
+ * The value is the url parameter and the before and after parameters are used
+ * between the text description.
+ *
+ * The 'html' format, which is the default, uses the li HTML element for use in
+ * the list HTML elements. The before parameter is before the link and the after
+ * parameter is after the closing link.
+ *
+ * The custom format uses the before parameter before the link ('a' HTML
+ * element) and the after parameter after the closing link tag. If the above
+ * three values for the format are not used, then custom format is assumed.
+ *
+ * @since 1.0.0
+ * @author Orien
+ * @link http://icecode.com/ link navigation hack by Orien
+ *
+ * @param string $url URL to archive.
+ * @param string $text Archive text description.
+ * @param string $format Optional, default is 'html'. Can be 'link', 'option', 'html', or custom.
+ * @param string $before Optional.
+ * @param string $after Optional.
+ * @return string HTML link content for archive.
+ */
 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
        $text = wptexturize($text);
        $title_text = attribute_escape($text);
 function get_archives_link($url, $text, $format = 'html', $before = '', $after = '') {
        $text = wptexturize($text);
        $title_text = attribute_escape($text);
@@ -365,18 +673,44 @@ function get_archives_link($url, $text, $format = 'html', $before = '', $after =
                $link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
 
        $link_html = apply_filters( "get_archives_link", $link_html );
                $link_html = "\t$before<a href='$url' title='$title_text'>$text</a>$after\n";
 
        $link_html = apply_filters( "get_archives_link", $link_html );
-               
+
        return $link_html;
 }
 
        return $link_html;
 }
 
-
+/**
+ * Display archive links based on type and format.
+ *
+ * The 'type' argument offers a few choices and by default will display monthly
+ * archive links. The other options for values are 'daily', 'weekly', 'monthly',
+ * 'yearly', 'postbypost' or 'alpha'. Both 'postbypost' and 'alpha' display the
+ * same archive link list, the difference between the two is that 'alpha'
+ * will order by post title and 'postbypost' will order by post date.
+ *
+ * The date archives will logically display dates with links to the archive post
+ * page. The 'postbypost' and 'alpha' values for 'type' argument will display
+ * the post titles.
+ *
+ * The 'limit' argument will only display a limited amount of links, specified
+ * by the 'limit' integer value. By default, there is no limit. The
+ * 'show_post_count' argument will show how many posts are within the archive.
+ * By default, the 'show_post_count' argument is set to false.
+ *
+ * For the 'format', 'before', and 'after' arguments, see {@link
+ * get_archives_link()}. The values of these arguments have to do with that
+ * function.
+ *
+ * @since 1.2.0
+ *
+ * @param string|array $args Optional. Override defaults.
+ */
 function wp_get_archives($args = '') {
        global $wpdb, $wp_locale;
 
        $defaults = array(
                'type' => 'monthly', 'limit' => '',
                'format' => 'html', 'before' => '',
 function wp_get_archives($args = '') {
        global $wpdb, $wp_locale;
 
        $defaults = array(
                'type' => 'monthly', 'limit' => '',
                'format' => 'html', 'before' => '',
-               'after' => '', 'show_post_count' => false
+               'after' => '', 'show_post_count' => false,
+               'echo' => 1
        );
 
        $r = wp_parse_args( $args, $defaults );
        );
 
        $r = wp_parse_args( $args, $defaults );
@@ -413,6 +747,8 @@ function wp_get_archives($args = '') {
        $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
        $join = apply_filters('getarchives_join', "", $r);
 
        $where = apply_filters('getarchives_where', "WHERE post_type = 'post' AND post_status = 'publish'", $r );
        $join = apply_filters('getarchives_join', "", $r);
 
+       $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";
                $key = md5($query);
        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";
                $key = md5($query);
@@ -426,12 +762,12 @@ function wp_get_archives($args = '') {
                }
                if ( $arcresults ) {
                        $afterafter = $after;
                }
                if ( $arcresults ) {
                        $afterafter = $after;
-                       foreach ( $arcresults as $arcresult ) {
-                               $url    = get_month_link($arcresult->year,      $arcresult->month);
+                       foreach ( (array) $arcresults as $arcresult ) {
+                               $url = get_month_link( $arcresult->year, $arcresult->month );
                                $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
                                if ( $show_post_count )
                                        $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
                                $text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($arcresult->month), $arcresult->year);
                                if ( $show_post_count )
                                        $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
-                               echo get_archives_link($url, $text, $format, $before, $after);
+                               $output .= get_archives_link($url, $text, $format, $before, $after);
                        }
                }
        } elseif ('yearly' == $type) {
                        }
                }
        } elseif ('yearly' == $type) {
@@ -447,12 +783,12 @@ function wp_get_archives($args = '') {
                }
                if ($arcresults) {
                        $afterafter = $after;
                }
                if ($arcresults) {
                        $afterafter = $after;
-                       foreach ($arcresults as $arcresult) {
+                       foreach ( (array) $arcresults as $arcresult) {
                                $url = get_year_link($arcresult->year);
                                $text = sprintf('%d', $arcresult->year);
                                if ($show_post_count)
                                        $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
                                $url = get_year_link($arcresult->year);
                                $text = sprintf('%d', $arcresult->year);
                                if ($show_post_count)
                                        $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
-                               echo get_archives_link($url, $text, $format, $before, $after);
+                               $output .= get_archives_link($url, $text, $format, $before, $after);
                        }
                }
        } elseif ( 'daily' == $type ) {
                        }
                }
        } elseif ( 'daily' == $type ) {
@@ -468,13 +804,13 @@ function wp_get_archives($args = '') {
                }
                if ( $arcresults ) {
                        $afterafter = $after;
                }
                if ( $arcresults ) {
                        $afterafter = $after;
-                       foreach ( $arcresults as $arcresult ) {
+                       foreach ( (array) $arcresults as $arcresult ) {
                                $url    = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
                                $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
                                $text = mysql2date($archive_day_date_format, $date);
                                if ($show_post_count)
                                        $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
                                $url    = get_day_link($arcresult->year, $arcresult->month, $arcresult->dayofmonth);
                                $date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $arcresult->year, $arcresult->month, $arcresult->dayofmonth);
                                $text = mysql2date($archive_day_date_format, $date);
                                if ($show_post_count)
                                        $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
-                               echo get_archives_link($url, $text, $format, $before, $after);
+                               $output .= get_archives_link($url, $text, $format, $before, $after);
                        }
                }
        } elseif ( 'weekly' == $type ) {
                        }
                }
        } elseif ( 'weekly' == $type ) {
@@ -492,7 +828,7 @@ function wp_get_archives($args = '') {
                $arc_w_last = '';
                $afterafter = $after;
                if ( $arcresults ) {
                $arc_w_last = '';
                $afterafter = $after;
                if ( $arcresults ) {
-                               foreach ( $arcresults as $arcresult ) {
+                               foreach ( (array) $arcresults as $arcresult ) {
                                        if ( $arcresult->week != $arc_w_last ) {
                                                $arc_year = $arcresult->yr;
                                                $arc_w_last = $arcresult->week;
                                        if ( $arcresult->week != $arc_w_last ) {
                                                $arc_year = $arcresult->yr;
                                                $arc_w_last = $arcresult->week;
@@ -503,12 +839,12 @@ function wp_get_archives($args = '') {
                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end;
                                                if ($show_post_count)
                                                        $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
                                                $text = $arc_week_start . $archive_week_separator . $arc_week_end;
                                                if ($show_post_count)
                                                        $after = '&nbsp;('.$arcresult->posts.')'.$afterafter;
-                                               echo get_archives_link($url, $text, $format, $before, $after);
+                                               $output .= get_archives_link($url, $text, $format, $before, $after);
                                        }
                                }
                }
        } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
                                        }
                                }
                }
        } elseif ( ( 'postbypost' == $type ) || ('alpha' == $type) ) {
-               ('alpha' == $type) ? $orderby = "post_title ASC " : $orderby = "post_date DESC ";
+               $orderby = ('alpha' == $type) ? "post_title ASC " : "post_date DESC ";
                $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
                $query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
                $key = md5($query);
                $cache = wp_cache_get( 'wp_get_archives' , 'general');
@@ -520,7 +856,7 @@ function wp_get_archives($args = '') {
                        $arcresults = $cache[ $key ];
                }
                if ( $arcresults ) {
                        $arcresults = $cache[ $key ];
                }
                if ( $arcresults ) {
-                       foreach ( $arcresults as $arcresult ) {
+                       foreach ( (array) $arcresults as $arcresult ) {
                                if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
                                        $url  = get_permalink($arcresult);
                                        $arc_title = $arcresult->post_title;
                                if ( $arcresult->post_date != '0000-00-00 00:00:00' ) {
                                        $url  = get_permalink($arcresult);
                                        $arc_title = $arcresult->post_title;
@@ -528,21 +864,41 @@ function wp_get_archives($args = '') {
                                                $text = strip_tags(apply_filters('the_title', $arc_title));
                                        else
                                                $text = $arcresult->ID;
                                                $text = strip_tags(apply_filters('the_title', $arc_title));
                                        else
                                                $text = $arcresult->ID;
-                                       echo get_archives_link($url, $text, $format, $before, $after);
+                                       $output .= get_archives_link($url, $text, $format, $before, $after);
                                }
                        }
                }
        }
                                }
                        }
                }
        }
+       if ( $echo )
+               echo $output;
+       else
+               return $output;
 }
 
 }
 
-
-// Used in get_calendar
+/**
+ * Get number of days since the start of the week.
+ *
+ * @since 1.5.0
+ * @usedby get_calendar()
+ *
+ * @param int $num Number of day.
+ * @return int Days since the start of the week.
+ */
 function calendar_week_mod($num) {
        $base = 7;
        return ($num - $base*floor($num/$base));
 }
 
 function calendar_week_mod($num) {
        $base = 7;
        return ($num - $base*floor($num/$base));
 }
 
-
+/**
+ * Display calendar with days that have posts as links.
+ *
+ * The calendar is cached, which will be retrieved, if it exists. If there are
+ * no posts for the month, then it will not be displayed.
+ *
+ * @since 1.0.0
+ *
+ * @param bool $initial Optional, default is true. Use initial calendar names.
+ */
 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;
 
@@ -660,7 +1016,7 @@ function get_calendar($initial = true) {
                AND post_type = 'post' AND post_status = 'publish'
                AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
        if ( $dayswithposts ) {
                AND post_type = 'post' AND post_status = 'publish'
                AND post_date < '" . current_time('mysql') . '\'', ARRAY_N);
        if ( $dayswithposts ) {
-               foreach ( $dayswithposts as $daywith ) {
+               foreach ( (array) $dayswithposts as $daywith ) {
                        $daywithpost[] = $daywith[0];
                }
        } else {
                        $daywithpost[] = $daywith[0];
                }
        } else {
@@ -681,7 +1037,7 @@ function get_calendar($initial = true) {
                ."AND post_type = 'post' AND post_status = 'publish'"
        );
        if ( $ak_post_titles ) {
                ."AND post_type = 'post' AND post_status = 'publish'"
        );
        if ( $ak_post_titles ) {
-               foreach ( $ak_post_titles as $ak_post_title ) {
+               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 = apply_filters( "the_title", $ak_post_title->post_title );
                                $post_title = str_replace('"', '&quot;', wptexturize( $post_title ));
@@ -735,6 +1091,12 @@ function get_calendar($initial = true) {
        wp_cache_set( 'get_calendar', $cache, 'calendar' );
 }
 
        wp_cache_set( 'get_calendar', $cache, 'calendar' );
 }
 
+/**
+ * Purge the cached results of get_calendar.
+ *
+ * @see get_calendar
+ * @since 2.1.0
+ */
 function delete_get_calendar_cache() {
        wp_cache_delete( 'get_calendar', 'calendar' );
 }
 function delete_get_calendar_cache() {
        wp_cache_delete( 'get_calendar', 'calendar' );
 }
@@ -744,11 +1106,21 @@ add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
 add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
 
 add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
 add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
 
-
+/**
+ * Display all of the allowed tags in HTML format with attributes.
+ *
+ * This is useful for displaying in the comment area, which elements and
+ * attributes are supported. As well as any plugins which want to display it.
+ *
+ * @since 1.0.1
+ * @uses $allowedtags
+ *
+ * @return string HTML allowed tags entity encoded.
+ */
 function allowed_tags() {
        global $allowedtags;
        $allowed = '';
 function allowed_tags() {
        global $allowedtags;
        $allowed = '';
-       foreach ( $allowedtags as $tag => $attributes ) {
+       foreach ( (array) $allowedtags as $tag => $attributes ) {
                $allowed .= '<'.$tag;
                if ( 0 < count($attributes) ) {
                        foreach ( $attributes as $attribute => $limits ) {
                $allowed .= '<'.$tag;
                if ( 0 < count($attributes) ) {
                        foreach ( $attributes as $attribute => $limits ) {
@@ -760,17 +1132,32 @@ function allowed_tags() {
        return htmlentities($allowed);
 }
 
        return htmlentities($allowed);
 }
 
-
 /***** Date/Time tags *****/
 
 /***** Date/Time tags *****/
 
-
+/**
+ * Outputs the date in iso8601 format for xml files.
+ *
+ * @since 1.0.0
+ */
 function the_date_xml() {
        global $post;
        echo mysql2date('Y-m-d', $post->post_date);
 function the_date_xml() {
        global $post;
        echo mysql2date('Y-m-d', $post->post_date);
-       //echo ""+$post->post_date;
 }
 
 }
 
-
+/**
+ * Display or Retrieve the date the post was written.
+ *
+ * Will only output the date if the current post's date is different from the
+ * previous one output.
+ *
+ * @since 0.71
+ *
+ * @param string $d Optional. PHP date format defaults to the date_format option if not specified.
+ * @param string $before Optional. Output before the date.
+ * @param string $after Optional. Output after the date.
+ * @param bool $echo Optional, default is display. Whether to echo the date or return it.
+ * @return string|null Null if displaying, string if retrieving.
+ */
 function the_date($d='', $before='', $after='', $echo = true) {
        global $post, $day, $previousday;
        $the_date = '';
 function the_date($d='', $before='', $after='', $echo = true) {
        global $post, $day, $previousday;
        $the_date = '';
@@ -790,12 +1177,26 @@ function the_date($d='', $before='', $after='', $echo = true) {
                return $the_date;
 }
 
                return $the_date;
 }
 
-
+/**
+ * Display the date on which the post was last modified.
+ *
+ * @since 2.1.0
+ *
+ * @param string $d Optional. PHP date format.
+ * @return string
+ */
 function the_modified_date($d = '') {
        echo apply_filters('the_modified_date', get_the_modified_date($d), $d);
 }
 
 function the_modified_date($d = '') {
        echo apply_filters('the_modified_date', get_the_modified_date($d), $d);
 }
 
-
+/**
+ * Retrieve the date on which the post was last modified.
+ *
+ * @since 2.1.0
+ *
+ * @param string $d Optional. PHP date format. Defaults to the "date_format" option
+ * @return string
+ */
 function get_the_modified_date($d = '') {
        if ( '' == $d )
                $the_time = get_post_modified_time(get_option('date_format'));
 function get_the_modified_date($d = '') {
        if ( '' == $d )
                $the_time = get_post_modified_time(get_option('date_format'));
@@ -804,23 +1205,49 @@ function get_the_modified_date($d = '') {
        return apply_filters('get_the_modified_date', $the_time, $d);
 }
 
        return apply_filters('get_the_modified_date', $the_time, $d);
 }
 
-
+/**
+ * Display the time at which the post was written.
+ *
+ * @since 0.71
+ *
+ * @param string $d Either 'G', 'U', or php date format.
+ */
 function the_time( $d = '' ) {
        echo apply_filters('the_time', get_the_time( $d ), $d);
 }
 
 function the_time( $d = '' ) {
        echo apply_filters('the_time', get_the_time( $d ), $d);
 }
 
+/**
+ * Retrieve the time at which the post was written.
+ *
+ * @since 1.5.0
+ *
+ * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
+ * @param int|object $post Optional post ID or object. Default is global $post object.
+ * @return string
+ */
+function get_the_time( $d = '', $post = null ) {
+       $post = get_post($post);
 
 
-function get_the_time( $d = '' ) {
        if ( '' == $d )
        if ( '' == $d )
-               $the_time = get_post_time(get_option('time_format'));
+               $the_time = get_post_time(get_option('time_format'), false, $post);
        else
        else
-               $the_time = get_post_time($d);
-       return apply_filters('get_the_time', $the_time, $d);
+               $the_time = get_post_time($d, false, $post);
+       return apply_filters('get_the_time', $the_time, $d, $post);
 }
 
 }
 
+/**
+ * Retrieve the time at which the post was written.
+ *
+ * @since 2.0.0
+ *
+ * @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.
+ * @return string
+ */
+function get_post_time( $d = 'U', $gmt = false, $post = null ) { // returns timestamp
+       $post = get_post($post);
 
 
-function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
-       global $post;
        if ( $gmt )
                $time = $post->post_date_gmt;
        else
        if ( $gmt )
                $time = $post->post_date_gmt;
        else
@@ -830,12 +1257,25 @@ function get_post_time( $d = 'U', $gmt = false ) { // returns timestamp
        return apply_filters('get_post_time', $time, $d, $gmt);
 }
 
        return apply_filters('get_post_time', $time, $d, $gmt);
 }
 
-
+/**
+ * Display the time at which the post was last modified.
+ *
+ * @since 2.0.0
+ *
+ * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
+ */
 function the_modified_time($d = '') {
        echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
 }
 
 function the_modified_time($d = '') {
        echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
 }
 
-
+/**
+ * Retrieve the time at which the post was last modified.
+ *
+ * @since 2.0.0
+ *
+ * @param string $d Either 'G', 'U', or php date format defaults to the value specified in the time_format option.
+ * @return string
+ */
 function get_the_modified_time($d = '') {
        if ( '' == $d )
                $the_time = get_post_modified_time(get_option('time_format'));
 function get_the_modified_time($d = '') {
        if ( '' == $d )
                $the_time = get_post_modified_time(get_option('time_format'));
@@ -844,8 +1284,16 @@ function get_the_modified_time($d = '') {
        return apply_filters('get_the_modified_time', $the_time, $d);
 }
 
        return apply_filters('get_the_modified_time', $the_time, $d);
 }
 
-
-function get_post_modified_time( $d = 'U', $gmt = false ) { // returns timestamp
+/**
+ * Retrieve the time at which the post was last modified.
+ *
+ * @since 2.0.0
+ *
+ * @param string $d Either 'G', 'U', or php date format.
+ * @param bool $gmt Whether of not to return the gmt time.
+ * @return string Returns timestamp
+ */
+function get_post_modified_time( $d = 'U', $gmt = false ) {
        global $post;
 
        if ( $gmt )
        global $post;
 
        if ( $gmt )
@@ -857,7 +1305,13 @@ function get_post_modified_time( $d = 'U', $gmt = false ) { // returns timestamp
        return apply_filters('get_the_modified_time', $time, $d, $gmt);
 }
 
        return apply_filters('get_the_modified_time', $time, $d, $gmt);
 }
 
-
+/**
+ * Display the weekday on which the post was written.
+ *
+ * @since 0.71
+ * @uses $wp_locale
+ * @uses $post
+ */
 function the_weekday() {
        global $wp_locale, $post;
        $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date));
 function the_weekday() {
        global $wp_locale, $post;
        $the_weekday = $wp_locale->get_weekday(mysql2date('w', $post->post_date));
@@ -865,7 +1319,17 @@ function the_weekday() {
        echo $the_weekday;
 }
 
        echo $the_weekday;
 }
 
-
+/**
+ * Display the weekday on which the post was written.
+ *
+ * Will only output the weekday if the current post's weekday is different from
+ * the previous one output.
+ *
+ * @since 0.71
+ *
+ * @param string $before output before the date.
+ * @param string $after output after the date.
+  */
 function the_weekday_date($before='',$after='') {
        global $wp_locale, $post, $day, $previousweekday;
        $the_weekday_date = '';
 function the_weekday_date($before='',$after='') {
        global $wp_locale, $post, $day, $previousweekday;
        $the_weekday_date = '';
@@ -879,29 +1343,70 @@ function the_weekday_date($before='',$after='') {
        echo $the_weekday_date;
 }
 
        echo $the_weekday_date;
 }
 
+/**
+ * Fire the wp_head action
+ *
+ * @since 1.2.0
+ * @uses do_action() Calls 'wp_head' hook.
+ */
 function wp_head() {
        do_action('wp_head');
 }
 
 function wp_head() {
        do_action('wp_head');
 }
 
+/**
+ * Fire the wp_footer action
+ *
+ * @since 1.5.1
+ * @uses do_action() Calls 'wp_footer' hook.
+ */
 function wp_footer() {
        do_action('wp_footer');
 }
 
 function wp_footer() {
        do_action('wp_footer');
 }
 
+/**
+ * Display the link to the Really Simple Discovery service endpoint.
+ *
+ * @link http://archipelago.phrasewise.com/rsd
+ * @since 2.0.0
+ */
 function rsd_link() {
        echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
 }
 
 function rsd_link() {
        echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . get_bloginfo('wpurl') . "/xmlrpc.php?rsd\" />\n";
 }
 
+/**
+ * Display the link to the Windows Live Writer manifest file.
+ *
+ * @link http://msdn.microsoft.com/en-us/library/bb463265.aspx
+ * @since 2.3.1
+ */
 function wlwmanifest_link() {
        echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="'
                . get_bloginfo('wpurl') . '/wp-includes/wlwmanifest.xml" /> ' . "\n";
 }
 
 function wlwmanifest_link() {
        echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="'
                . get_bloginfo('wpurl') . '/wp-includes/wlwmanifest.xml" /> ' . "\n";
 }
 
+/**
+ * Display a noindex meta tag if required by the blog configuration.
+ *
+ * If a blog is marked as not being public then the noindex meta tag will be
+ * output to tell web robots not to index the page content.
+ *
+ * @since 2.1.0
+ */
 function noindex() {
        // If the blog is not public, tell robots to go away.
        if ( '0' == get_option('blog_public') )
                echo "<meta name='robots' content='noindex,nofollow' />\n";
 }
 
 function noindex() {
        // If the blog is not public, tell robots to go away.
        if ( '0' == get_option('blog_public') )
                echo "<meta name='robots' content='noindex,nofollow' />\n";
 }
 
+/**
+ * Determine if TinyMCE is available.
+ *
+ * Checks to see if the user has deleted the tinymce files to slim down there WordPress install.
+ *
+ * @since 2.1.0
+ *
+ * @return bool Whether of not TinyMCE exists.
+ */
 function rich_edit_exists() {
        global $wp_rich_edit_exists;
        if ( !isset($wp_rich_edit_exists) )
 function rich_edit_exists() {
        global $wp_rich_edit_exists;
        if ( !isset($wp_rich_edit_exists) )
@@ -909,6 +1414,16 @@ function rich_edit_exists() {
        return $wp_rich_edit_exists;
 }
 
        return $wp_rich_edit_exists;
 }
 
+/**
+ * Whether or not the user should have a WYSIWIG editor.
+ *
+ * Checks that the user requires a WYSIWIG editor and that the editor is
+ * supported in the users browser.
+ *
+ * @since 2.0.0
+ *
+ * @return bool
+ */
 function user_can_richedit() {
        global $wp_rich_edit, $pagenow;
 
 function user_can_richedit() {
        global $wp_rich_edit, $pagenow;
 
@@ -926,98 +1441,149 @@ function user_can_richedit() {
        return apply_filters('user_can_richedit', $wp_rich_edit);
 }
 
        return apply_filters('user_can_richedit', $wp_rich_edit);
 }
 
+/**
+ * Find out which editor should be displayed by default.
+ *
+ * Works out which of the two editors to display as the current editor for a
+ * user.
+ *
+ * @since 2.5.0
+ *
+ * @return string Either 'tinymce', or 'html', or 'test'
+ */
 function wp_default_editor() {
        $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
        if ( $user = wp_get_current_user() ) { // look for cookie
 function wp_default_editor() {
        $r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
        if ( $user = wp_get_current_user() ) { // look for cookie
-               if ( isset($_COOKIE['wordpress_editor_' . $user->ID]) && in_array($_COOKIE['wordpress_editor_' . $user->ID], array('tinymce', 'html', 'test') ) )
-                       $r = $_COOKIE['wordpress_editor_' . $user->ID];
+               $ed = get_user_setting('editor', 'tinymce');
+               $r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;
        }
        return apply_filters( 'wp_default_editor', $r ); // filter
 }
 
        }
        return apply_filters( 'wp_default_editor', $r ); // filter
 }
 
+/**
+ * Display visual editor forms: TinyMCE, or HTML, or both.
+ *
+ * The amount of rows the text area will have for the content has to be between
+ * 3 and 100 or will default at 12. There is only one option used for all users,
+ * named 'default_post_edit_rows'.
+ *
+ * If the user can not use the rich editor (TinyMCE), then the switch button
+ * will not be displayed.
+ *
+ * @since 2.1.0
+ *
+ * @param string $content Textarea content.
+ * @param string $id HTML ID attribute value.
+ * @param string $prev_id HTML ID name for switching back and forth between visual editors.
+ * @param bool $media_buttons Optional, default is true. Whether to display media buttons.
+ * @param int $tab_index Optional, default is 2. Tabindex for textarea element.
+ */
 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2) {
        $rows = get_option('default_post_edit_rows');
        if (($rows < 3) || ($rows > 100))
                $rows = 12;
 
 function the_editor($content, $id = 'content', $prev_id = 'title', $media_buttons = true, $tab_index = 2) {
        $rows = get_option('default_post_edit_rows');
        if (($rows < 3) || ($rows > 100))
                $rows = 12;
 
-       $rows = "rows='$rows'"; ?>
+       if ( !current_user_can( 'upload_files' ) )
+               $media_buttons = false;
+
+       $richedit =  user_can_richedit();
+       $rows = "rows='$rows'";
+
+       if ( $richedit || $media_buttons ) { ?>
        <div id="editor-toolbar">
        <div id="editor-toolbar">
-       <?php if ( user_can_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 ( 'tinymce' == $wp_default_editor ) {
-                       add_filter('the_editor_content', 'wp_richedit_pre'); ?>
-                       <a id="edButtonHTML" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('HTML'); ?></a>
-                       <a id="edButtonPreview" class="active"><?php _e('Visual'); ?></a>
-               <?php } elseif ( '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"><?php _e('HTML'); ?></a>
-                       <a id="edButtonPreview" onclick="switchEditors.go('<?php echo $id; ?>');"><?php _e('Visual'); ?></a>
+                       <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 {
+                       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 }
                <?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' ); ?>
        <script type="text/javascript">edToolbar()</script>
        </div>
 
 
        <div id="quicktags">
        <?php wp_print_scripts( 'quicktags' ); ?>
        <script type="text/javascript">edToolbar()</script>
        </div>
 
-    <?php if ( 'html' != $wp_default_editor ) : ?>
-    <script type="text/javascript">
-    // <![CDATA[
-        if ( typeof tinyMCE != "undefined" )
-            document.getElementById("quicktags").style.display="none";
-    // ]]>
-    </script>
-    <?php endif; // 'html' != $wp_default_editor
-
-       $the_editor = apply_filters('the_editor', "<div id='editorcontainer'><textarea class='' $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 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">
-    // <![CDATA[
-    edCanvas = document.getElementById('<?php echo $id; ?>');
-    <?php if ( $prev_id && user_can_richedit() ) : ?>
-    // If tinyMCE is defined.
-    if ( typeof tinyMCE != 'undefined' ) {
-    // This code is meant to allow tabbing from Title to Post (TinyMCE).
-        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) {
-            e = e || window.event;
-            if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) {
-                if ( tinyMCE.activeEditor ) {
-                    if ( (jQuery("#post_ID").val() < 1) && (jQuery("#title").val().length > 0) ) { autosave(); }
-                    e = null;
-                    if ( tinyMCE.activeEditor.isHidden() ) return true;
-                    tinyMCE.activeEditor.focus();
-                    return false;
-                }
-                return true;
-            }
-        }
-    }
-    <?php endif; ?>
-    // ]]>
-    </script>
-    <?php
+       <script type="text/javascript">
+       // <![CDATA[
+       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>
+       <?php
 }
 
 }
 
+/**
+ * Retrieve the contents of the search WordPress query variable.
+ *
+ * @since 2.3.0
+ *
+ * @return string
+ */
 function get_search_query() {
        return apply_filters( 'get_search_query', stripslashes( get_query_var( 's' ) ) );
 }
 
 function get_search_query() {
        return apply_filters( 'get_search_query', stripslashes( get_query_var( 's' ) ) );
 }
 
+/**
+ * Display the contents of the search query variable.
+ *
+ * The search query string is passed through {@link attribute_escape()}
+ * to ensure that it is safe for placing in an html attribute.
+ *
+ * @uses attribute_escape
+ * @since 2.1.0
+ */
 function the_search_query() {
        echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
 }
 
 function the_search_query() {
        echo attribute_escape( apply_filters( 'the_search_query', get_search_query() ) );
 }
 
+/**
+ * Display the language attributes for the html tag.
+ *
+ * Builds up a set of html attributes containing the text direction and language
+ * information for the page.
+ *
+ * @since 2.1.0
+ *
+ * @param string $doctype The type of html document (xhtml|html).
+ */
 function language_attributes($doctype = 'html') {
        $attributes = array();
        $output = '';
 function language_attributes($doctype = 'html') {
        $attributes = array();
        $output = '';
@@ -1026,7 +1592,7 @@ function language_attributes($doctype = 'html') {
                $attributes[] = "dir=\"$dir\"";
 
        if ( $lang = get_bloginfo('language') ) {
                $attributes[] = "dir=\"$dir\"";
 
        if ( $lang = get_bloginfo('language') ) {
-               if ( get_option('html_type') == 'text/html' || $doctype == 'xhtml' )
+               if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
                        $attributes[] = "lang=\"$lang\"";
 
                if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
                        $attributes[] = "lang=\"$lang\"";
 
                if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
@@ -1038,6 +1604,51 @@ function language_attributes($doctype = 'html') {
        echo $output;
 }
 
        echo $output;
 }
 
+/**
+ * Retrieve paginated link for archive post pages.
+ *
+ * Technically, the function can be used to create paginated link list for any
+ * area. The 'base' argument is used to reference the url, which will be used to
+ * create the paginated links. The 'format' argument is then used for replacing
+ * the page number. It is however, most likely and by default, to be used on the
+ * archive post pages.
+ *
+ * The 'type' argument controls format of the returned value. The default is
+ * 'plain', which is just a string with the links separated by a newline
+ * character. The other possible values are either 'array' or 'list'. The
+ * 'array' value will return an array of the paginated link list to offer full
+ * control of display. The 'list' value will place all of the paginated links in
+ * an unordered HTML list.
+ *
+ * The 'total' argument is the total amount of pages and is an integer. The
+ * 'current' argument is the current page number and is also an integer.
+ *
+ * An example of the 'base' argument is "http://example.com/all_posts.php%_%"
+ * and the '%_%' is required. The '%_%' will be replaced by the contents of in
+ * the 'format' argument. An example for the 'format' argument is "?page=%#%"
+ * and the '%#%' is also required. The '%#%' will be replaced with the page
+ * number.
+ *
+ * You can include the previous and next links in the list by setting the
+ * 'prev_next' argument to true, which it is by default. You can set the
+ * previous text, by using the 'prev_text' argument. You can set the next text
+ * by setting the 'next_text' argument.
+ *
+ * If the 'show_all' argument is set to true, then it will show all of the pages
+ * instead of a short list of the pages near the current page. By default, the
+ * 'show_all' is set to false and controlled by the 'end_size' and 'mid_size'
+ * arguments. The 'end_size' argument is how many numbers on either the start
+ * and the end list edges, by default is 1. The 'mid_size' argument is how many
+ * numbers to either side of current page, but not including current page.
+ *
+ * It is possible to add query vars to the link by using the 'add_args' argument
+ * and see {@link add_query_arg()} for more information.
+ *
+ * @since 2.1.0
+ *
+ * @param string|array $args Optional. Override defaults.
+ * @return array|string String of page links or array of page links.
+ */
 function paginate_links( $args = '' ) {
        $defaults = array(
                'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
 function paginate_links( $args = '' ) {
        $defaults = array(
                'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
@@ -1048,17 +1659,18 @@ function paginate_links( $args = '' ) {
                'prev_next' => true,
                'prev_text' => __('&laquo; Previous'),
                'next_text' => __('Next &raquo;'),
                'prev_next' => true,
                'prev_text' => __('&laquo; Previous'),
                'next_text' => __('Next &raquo;'),
-               'end_size' => 1, // How many numbers on either end including the end
-               'mid_size' => 2, // How many numbers to either side of current not including current
+               'end_size' => 1,
+               'mid_size' => 2,
                'type' => 'plain',
                'type' => 'plain',
-               'add_args' => false // array of query args to aadd
+               'add_args' => false, // array of query args to add
+               'add_fragment' => ''
        );
 
        $args = wp_parse_args( $args, $defaults );
        extract($args, EXTR_SKIP);
 
        // Who knows what else people pass in $args
        );
 
        $args = wp_parse_args( $args, $defaults );
        extract($args, EXTR_SKIP);
 
        // Who knows what else people pass in $args
-       $total    = (int) $total;
+       $total = (int) $total;
        if ( $total < 2 )
                return;
        $current  = (int) $current;
        if ( $total < 2 )
                return;
        $current  = (int) $current;
@@ -1075,11 +1687,13 @@ function paginate_links( $args = '' ) {
                $link = str_replace('%#%', $current - 1, $link);
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link = str_replace('%#%', $current - 1, $link);
                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>";
        endif;
        for ( $n = 1; $n <= $total; $n++ ) :
                $page_links[] = "<a class='prev page-numbers' href='" . clean_url($link) . "'>$prev_text</a>";
        endif;
        for ( $n = 1; $n <= $total; $n++ ) :
+               $n_display = number_format_i18n($n);
                if ( $n == $current ) :
                if ( $n == $current ) :
-                       $page_links[] = "<span class='page-numbers current'>$n</span>";
+                       $page_links[] = "<span class='page-numbers current'>$n_display</span>";
                        $dots = true;
                else :
                        if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
                        $dots = true;
                else :
                        if ( $show_all || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
@@ -1087,7 +1701,8 @@ function paginate_links( $args = '' ) {
                                $link = str_replace('%#%', $n, $link);
                                if ( $add_args )
                                        $link = add_query_arg( $add_args, $link );
                                $link = str_replace('%#%', $n, $link);
                                if ( $add_args )
                                        $link = add_query_arg( $add_args, $link );
-                               $page_links[] = "<a class='page-numbers' href='" . clean_url($link) . "'>$n</a>";
+                               $link .= $add_fragment;
+                               $page_links[] = "<a class='page-numbers' href='" . clean_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>";
@@ -1100,6 +1715,7 @@ function paginate_links( $args = '' ) {
                $link = str_replace('%#%', $current + 1, $link);
                if ( $add_args )
                        $link = add_query_arg( $add_args, $link );
                $link = str_replace('%#%', $current + 1, $link);
                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>";
        endif;
        switch ( $type ) :
                $page_links[] = "<a class='next page-numbers' href='" . clean_url($link) . "'>$next_text</a>";
        endif;
        switch ( $type ) :
@@ -1118,6 +1734,22 @@ function paginate_links( $args = '' ) {
        return $r;
 }
 
        return $r;
 }
 
+/**
+ * Registers an admin colour scheme css file.
+ *
+ * Allows a plugin to register a new admin colour scheme. For example:
+ * <code>
+ * wp_admin_css_color('classic', __('Classic'), admin_url("css/colors-classic.css"),
+ * array('#07273E', '#14568A', '#D54E21', '#2683AE'));
+ * </code>
+ *
+ * @since 2.5.0
+ *
+ * @param string $key The unique key for this theme.
+ * @param string $name The name of the theme.
+ * @param string $url The url of the css file containing the colour scheme.
+ * @param array @colors An array of CSS color definitions which are used to give the user a feel for the theme.
+ */
 function wp_admin_css_color($key, $name, $url, $colors = array()) {
        global $_wp_admin_css_colors;
 
 function wp_admin_css_color($key, $name, $url, $colors = array()) {
        global $_wp_admin_css_colors;
 
@@ -1128,13 +1760,14 @@ function wp_admin_css_color($key, $name, $url, $colors = array()) {
 }
 
 /**
 }
 
 /**
- * wp_admin_css_uri() - Outputs the URL of a WordPress admin CSS file
+ * Display the URL of a WordPress admin CSS file.
  *
  * @see WP_Styles::_css_href and its style_loader_src filter.
  *
  *
  * @see WP_Styles::_css_href and its style_loader_src filter.
  *
+ * @since 2.3.0
+ *
  * @param string $file file relative to wp-admin/ without its ".css" extension.
  */
  * @param string $file file relative to wp-admin/ without its ".css" extension.
  */
-
 function wp_admin_css_uri( $file = 'wp-admin' ) {
        if ( defined('WP_INSTALLING') ) {
                $_file = "./$file.css";
 function wp_admin_css_uri( $file = 'wp-admin' ) {
        if ( defined('WP_INSTALLING') ) {
                $_file = "./$file.css";
@@ -1147,26 +1780,26 @@ function wp_admin_css_uri( $file = 'wp-admin' ) {
 }
 
 /**
 }
 
 /**
- * wp_admin_css() - Enqueues or directly prints a stylesheet link to the specified CSS file.
+ * Enqueues or directly prints a stylesheet link to the specified CSS file.
  *
  *
- * "Intelligently" decides to enqueue or to print the CSS file.
- * If the wp_print_styles action has *not* yet been called, the CSS file will be enqueued.
- * If the wp_print_styles action *has* been called, the CSS link will be printed.
- * Printing may be forced by passing TRUE as the $force_echo (second) parameter.
+ * "Intelligently" decides to enqueue or to print the CSS file. If the
+ * 'wp_print_styles' action has *not* yet been called, the CSS file will be
+ * enqueued. If the wp_print_styles action *has* been called, the CSS link will
+ * be printed. Printing may be forced by passing TRUE as the $force_echo
+ * (second) parameter.
  *
  *
- * For backward compatibility with WordPress 2.3 calling method:
- * If the $file (first) parameter does not correspond to a registered CSS file, we assume $file is a
- * file relative to wp-admin/ without its ".css" extension.  A stylesheet link to that generated URL is printed.
+ * For backward compatibility with WordPress 2.3 calling method: If the $file
+ * (first) parameter does not correspond to a registered CSS file, we assume
+ * $file is a file relative to wp-admin/ without its ".css" extension. A
+ * stylesheet link to that generated URL is printed.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.3
- *
+ * @since 2.3.0
  * @uses $wp_styles WordPress Styles Object
  *
  * @param string $file Style handle name or file name (without ".css" extension) relative to wp-admin/
  * @param bool $force_echo Optional.  Force the stylesheet link to be printed rather than enqueued.
  */
  * @uses $wp_styles WordPress Styles Object
  *
  * @param string $file Style handle name or file name (without ".css" extension) relative to wp-admin/
  * @param bool $force_echo Optional.  Force the stylesheet link to be printed rather than enqueued.
  */
-
 function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
 function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
        global $wp_styles;
        if ( !is_a($wp_styles, 'WP_Styles') )
@@ -1189,10 +1822,13 @@ function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
 }
 
 /**
 }
 
 /**
- * Enqueues the default ThickBox js and css. 
- * If any of the settings need to be changed, this can be done with another js file
- * similar to media-upload.js and theme-preview.js. That file should require array('thickbox')
- * to ensure it is loaded after. 
+ * Enqueues the default ThickBox js and css.
+ *
+ * If any of the settings need to be changed, this can be done with another js
+ * file similar to media-upload.js and theme-preview.js. That file should
+ * require array('thickbox') to ensure it is loaded after.
+ *
+ * @since 2.5.0
  */
 function add_thickbox() {
        wp_enqueue_script( 'thickbox' );
  */
 function add_thickbox() {
        wp_enqueue_script( 'thickbox' );
@@ -1200,26 +1836,43 @@ function add_thickbox() {
 }
 
 /**
 }
 
 /**
- * Outputs the XHTML generator that is generated on the wp_head hook.
+ * Display the XHTML generator that is generated on the wp_head hook.
+ *
+ * @since 2.5.0
  */
  */
-function wp_generator()
-{
+function wp_generator() {
        the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
 }
 
 /**
        the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
 }
 
 /**
- * Outputs the generator XML or Comment for RSS, ATOM, etc.
- * @param {String} $type The type of generator to return.
+ * Display the generator XML or Comment for RSS, ATOM, etc.
+ *
+ * Returns the correct generator type for the requested output format. Allows
+ * for a plugin to filter generators overall the the_generator filter.
+ *
+ * @since 2.5.0
+ * @uses apply_filters() Calls 'the_generator' hook.
+ *
+ * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
  */
  */
-function the_generator ( $type ) {
-       echo apply_filters('the_generator',get_the_generator($type),$type) . "\n";
+function the_generator( $type ) {
+       echo apply_filters('the_generator', get_the_generator($type), $type) . "\n";
 }
 
 /**
  * Creates the generator XML or Comment for RSS, ATOM, etc.
 }
 
 /**
  * Creates the generator XML or Comment for RSS, ATOM, etc.
- * @param {String} $type The type of generator to return.
+ *
+ * Returns the correct generator type for the requested output format. Allows
+ * for a plugin to filter generators on an individual basis using the
+ * 'get_the_generator_{$type}' filter.
+ *
+ * @since 2.5.0
+ * @uses apply_filters() Calls 'get_the_generator_$type' hook.
+ *
+ * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export).
+ * @return string The HTML content for the generator.
  */
  */
-function get_the_generator ( $type ) {
+function get_the_generator( $type ) {
        switch ($type) {
                case 'html':
                        $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">' . "\n";
        switch ($type) {
                case 'html':
                        $gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">' . "\n";
@@ -1245,4 +1898,5 @@ function get_the_generator ( $type ) {
        }
        return apply_filters( "get_the_generator_{$type}", $gen, $type );
 }
        }
        return apply_filters( "get_the_generator_{$type}", $gen, $type );
 }
+
 ?>
 ?>
diff --git a/wp-includes/http.php b/wp-includes/http.php
new file mode 100644 (file)
index 0000000..08ec580
--- /dev/null
@@ -0,0 +1,1254 @@
+<?php
+/**
+ * Simple and uniform HTTP request API.
+ *
+ * Will eventually replace and standardize the WordPress HTTP requests made.
+ *
+ * @link http://trac.wordpress.org/ticket/4779 HTTP API Proposal
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ * @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.
+ *
+ * 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.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ */
+class WP_Http {
+
+       /**
+        * PHP4 style Constructor - Calls PHP5 Style Constructor
+        *
+        * @since 2.7
+        * @return WP_Http
+        */
+       function WP_Http() {
+               $this->__construct();
+       }
+
+       /**
+        * PHP5 style Constructor - Setup available transport if not available.
+        *
+        * PHP4 does not have the 'self' keyword and since WordPress supports PHP4,
+        * the class needs to be used for the static call.
+        *
+        * The transport are setup to save time. This should only be called once, so
+        * the overhead should be fine.
+        *
+        * @since 2.7
+        * @return WP_Http
+        */
+       function __construct() {
+               WP_Http::_getTransport();
+               WP_Http::_postTransport();
+       }
+
+       /**
+        * Tests the WordPress HTTP objects for an object to use and returns it.
+        *
+        * 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.
+        *
+        * There are currently issues with "localhost" not resolving correctly with
+        * DNS. This may cause an error "failed to open stream: A connection attempt
+        * failed because the connected party did not properly respond after a
+        * period of time, or established connection failed because connected host
+        * has failed to respond."
+        *
+        * @since 2.7
+        * @access private
+        *
+        * @param array $args Request args, default us an empty array
+        * @return object|null Null if no transports are available, HTTP transport object.
+        */
+       function &_getTransport( $args = array() ) {
+               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) ) {
+                               $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) ) {
+                               $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) ) {
+                               $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'];
+                       }
+
+                       foreach ( array('curl', 'streams', 'fopen', 'fsockopen', 'exthttp') as $transport ) {
+                               if ( isset($working_transport[$transport]) )
+                                       $nonblocking_transport[] = &$working_transport[$transport];
+                       }
+               }
+
+               if ( isset($args['blocking']) && !$args['blocking'] )
+                       return $nonblocking_transport;
+               else
+                       return $blocking_transport;
+       }
+
+       /**
+        * Tests the WordPress HTTP objects for an object to use and returns it.
+        *
+        * Tests all of the objects and returns the object that passes. Also caches
+        * that object to be used later. This is for posting content to a URL and
+        * is used when there is a body. The plain Fopen Transport can not be used
+        * 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
+        * @access private
+        *
+        * @param array $args Request args, default us an empty array
+        * @return object|null Null if no transports are available, HTTP transport object.
+        */
+       function &_postTransport( $args = array() ) {
+               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) ) {
+                               $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) ) {
+                               $working_transport['fsockopen'] = new WP_Http_Fsockopen();
+                               $blocking_transport[] = &$working_transport['fsockopen'];
+                       }
+
+                       foreach ( array('streams', 'fsockopen', 'exthttp') as $transport ) {
+                               if ( isset($working_transport[$transport]) )
+                                       $nonblocking_transport[] = &$working_transport[$transport];
+                       }
+               }
+
+               if ( isset($args['blocking']) && !$args['blocking'] )
+                       return $nonblocking_transport;
+               else
+                       return $blocking_transport;
+       }
+
+       /**
+        * 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
+        * 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
+        * '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.
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return boolean
+        */
+       function request( $url, $args = array() ) {
+               global $wp_version;
+
+               $defaults = array(
+                       'method' => 'GET',
+                       '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 ),
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null
+               );
+
+               $r = wp_parse_args( $args, $defaults );
+               $r = apply_filters( 'http_request_args', $r );
+
+               if ( is_null( $r['headers'] ) )
+                       $r['headers'] = array();
+
+               if ( ! is_array($r['headers']) ) {
+                       $processedHeaders = WP_Http::processHeaders($r['headers']);
+                       $r['headers'] = $processedHeaders['headers'];
+               }
+
+               if ( isset($r['headers']['User-Agent']) ) {
+                       $r['user-agent'] = $r['headers']['User-Agent'];
+                       unset($r['headers']['User-Agent']);
+               }
+
+               if ( isset($r['headers']['user-agent']) ) {
+                       $r['user-agent'] = $r['headers']['user-agent'];
+                       unset($r['headers']['user-agent']);
+               }
+
+               if ( is_null($r['body']) ) {
+                       // Some servers fail when sending content without the content-length
+                       // header being set.
+                       $r['headers']['Content-Length'] = 0;
+                       $transports = WP_Http::_getTransport($r);
+               } else {
+                       if ( is_array( $r['body'] ) || is_object( $r['body'] ) ) {
+                               $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']);
+                       }
+
+                       if ( ! isset( $r['headers']['Content-Length'] ) && ! isset( $r['headers']['content-length'] ) )
+                               $r['headers']['Content-Length'] = strlen($r['body']);
+
+                       $transports = WP_Http::_postTransport($r);
+               }
+
+               $response = array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+               foreach( (array) $transports as $transport ) {
+                       $response = $transport->request($url, $r);
+
+                       if( !is_wp_error($response) )
+                               return $response;
+               }
+
+               return $response;
+       }
+
+       /**
+        * Uses the POST HTTP method.
+        *
+        * Used for sending data that is expected to be in the body.
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return boolean
+        */
+       function post($url, $args = array()) {
+               $defaults = array('method' => 'POST');
+               $r = wp_parse_args( $args, $defaults );
+               return $this->request($url, $r);
+       }
+
+       /**
+        * Uses the GET HTTP method.
+        *
+        * Used for sending data that is expected to be in the body.
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return boolean
+        */
+       function get($url, $args = array()) {
+               $defaults = array('method' => 'GET');
+               $r = wp_parse_args( $args, $defaults );
+               return $this->request($url, $r);
+       }
+
+       /**
+        * Uses the HEAD HTTP method.
+        *
+        * Used for sending data that is expected to be in the body.
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return boolean
+        */
+       function head($url, $args = array()) {
+               $defaults = array('method' => 'HEAD');
+               $r = wp_parse_args( $args, $defaults );
+               return $this->request($url, $r);
+       }
+
+       /**
+        * Parses the responses and splits the parts into headers and body.
+        *
+        * @access public
+        * @static
+        * @since 2.7
+        *
+        * @param string $strResponse The full response string
+        * @return array Array with 'headers' and 'body' keys.
+        */
+       function processResponse($strResponse) {
+               list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
+               return array('headers' => $theHeaders, 'body' => $theBody);
+       }
+
+       /**
+        * 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.
+        *
+        * @access public
+        * @static
+        * @since 2.7
+        *
+        * @param string|array $headers
+        * @return array Processed string headers
+        */
+       function processHeaders($headers) {
+               if ( is_string($headers) )
+                       $headers = explode("\n", str_replace(array("\r\n", "\r"), "\n", $headers) );
+
+               $response = array('code' => 0, 'message' => '');
+
+               $newheaders = array();
+               foreach ( $headers as $tempheader ) {
+                       if ( empty($tempheader) )
+                               continue;
+
+                       if ( false === strpos($tempheader, ':') ) {
+                               list( , $iResponseCode, $strResponseMsg) = explode(' ', $tempheader, 3);
+                               $response['code'] = $iResponseCode;
+                               $response['message'] = $strResponseMsg;
+                               continue;
+                       }
+
+                       list($key, $value) = explode(':', $tempheader, 2);
+
+                       if ( ! empty($value) )
+                               $newheaders[strtolower($key)] = trim($value);
+               }
+
+               return array('response' => $response, 'headers' => $newheaders);
+       }
+
+       /**
+        * 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.
+        *
+        * @todo Add support for footer chunked headers.
+        * @access public
+        * @since 2.7
+        * @static
+        *
+        * @param string $body Body content
+        * @return string Chunked decoded body on success or raw body on failure.
+        */
+       function chunkTransferDecode($body) {
+               $body = str_replace(array("\r\n", "\r"), "\n", $body);
+               // The body is not chunked encoding or is malformed.
+               if ( ! preg_match( '/^[0-9a-f]+(\s|\n)+/mi', trim($body) ) )
+                       return $body;
+
+               $parsedBody = '';
+               //$parsedHeaders = array(); Unsupported
+
+               while ( true ) {
+                       $hasChunk = (bool) preg_match( '/^([0-9a-f]+)(\s|\n)+/mi', $body, $match );
+
+                       if ( $hasChunk ) {
+                               if ( empty($match[1]) )
+                                       return $body;
+
+                               $length = hexdec( $match[1] );
+                               $chunkLength = strlen( $match[0] );
+
+                               $strBody = substr($body, $chunkLength, $length);
+                               $parsedBody .= $strBody;
+
+                               $body = ltrim(str_replace(array($match[0], $strBody), '', $body), "\n");
+
+                               if( "0" == trim($body) )
+                                       return $parsedBody; // Ignore footer headers.
+                       } else {
+                               return $body;
+                       }
+               }
+       }
+}
+
+/**
+ * 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.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ */
+class WP_Http_Fsockopen {
+       /**
+        * Send a HTTP request to a URI using fsockopen().
+        *
+        * Does not support non-blocking mode.
+        *
+        * @see WP_Http::request For default options descriptions.
+        *
+        * @since 2.7
+        * @access public
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null
+               );
+
+               $r = wp_parse_args( $args, $defaults );
+
+               if ( isset($r['headers']['User-Agent']) ) {
+                       $r['user-agent'] = $r['headers']['User-Agent'];
+                       unset($r['headers']['User-Agent']);
+               } else if( isset($r['headers']['user-agent']) ) {
+                       $r['user-agent'] = $r['headers']['user-agent'];
+                       unset($r['headers']['user-agent']);
+               }
+
+               $iError = null; // Store error number
+               $strError = null; // Store error string
+
+               $arrURL = parse_url($url);
+
+               $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);
+                               $secure_transport = true;
+                       } else {
+                               $arrURL['port'] = apply_filters('http_request_default_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.
+               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'] );
+
+               $endDelay = time();
+
+               // 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 );
+
+               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'] );
+
+               $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' );
+               $requestPath = empty($requestPath) ? '/' : $requestPath;
+
+               $strHeaders = '';
+               $strHeaders .= strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n";
+               $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n";
+
+               if( isset($r['user-agent']) )
+                       $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n";
+
+               if ( is_array($r['headers']) ) {
+                       foreach ( (array) $r['headers'] as $header => $headerValue )
+                               $strHeaders .= $header . ': ' . $headerValue . "\r\n";
+               } else {
+                       $strHeaders .= $r['headers'];
+               }
+
+               $strHeaders .= "\r\n";
+
+               if ( ! is_null($r['body']) )
+                       $strHeaders .= $r['body'];
+
+               fwrite($handle, $strHeaders);
+
+               if ( ! $r['blocking'] ) {
+                       fclose($handle);
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+               }
+
+               $strResponse = '';
+               while ( ! feof($handle) )
+                       $strResponse .= fread($handle, 4096);
+
+               fclose($handle);
+
+               if ( true === $secure_transport )
+                       error_reporting($error_reporting);
+
+               $process = WP_Http::processResponse($strResponse);
+               $arrHeaders = WP_Http::processHeaders($process['headers']);
+
+               // Is the response code within the 400 range?
+               if ( (int) $arrHeaders['response']['code'] >= 400 && (int) $arrHeaders['response']['code'] < 500 )
+                       return new WP_Error('http_request_failed', $arrHeaders['response']['code'] . ': ' . $arrHeaders['response']['message']);
+
+               // If location is found, then assume redirect and redirect to location.
+               if ( isset($arrHeaders['headers']['location']) ) {
+                       if ( $r['redirection']-- > 0 ) {
+                               return $this->request($arrHeaders['headers']['location'], $r);
+                       } else {
+                               return new WP_Error('http_request_failed', __('Too many redirects.'));
+                       }
+               }
+
+               // If the body was chunk encoded, then decode it.
+               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']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @since 2.7
+        * @static
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test() {
+               if ( false !== ($option = get_option( 'disable_fsockopen' )) && time()-$option < 43200 ) // 12 hours
+                       return false;
+
+               if ( function_exists( 'fsockopen' ) )
+                       return true;
+
+               return false;
+       }
+}
+
+/**
+ * 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.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ */
+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.
+        *
+        * Notes: Does not support non-blocking mode. Ignores 'redirection' option.
+        *
+        * @see WP_Http::retrieve For default options descriptions.
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url URI resource.
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               global $http_response_header;
+
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null
+               );
+
+               $r = wp_parse_args( $args, $defaults );
+
+               $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);
+
+               if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
+                       $handle = @fopen($url, 'r');
+               else
+                       $handle = fopen($url, 'r');
+
+               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);
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+               }
+
+               $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( isset( $meta['wrapper_data']['headers'] ) )
+                               $theHeaders = $meta['wrapper_data']['headers'];
+               } else {
+                       if( ! isset( $http_response_header ) )
+                               global $http_response_header;
+                       $theHeaders = $http_response_header;
+               }
+
+               fclose($handle);
+
+               $processedHeaders = WP_Http::processHeaders($theHeaders);
+
+               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']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @static
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test() {
+               if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) )
+                       return false;
+
+               return true;
+       }
+}
+
+/**
+ * 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.
+ *
+ * Second preferred method for getting the URL, for PHP 5.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ */
+class WP_Http_Streams {
+       /**
+        * Send a HTTP request to a URI using streams with fopen().
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null
+               );
+
+               $r = wp_parse_args( $args, $defaults );
+
+               if ( isset($r['headers']['User-Agent']) ) {
+                       $r['user-agent'] = $r['headers']['User-Agent'];
+                       unset($r['headers']['User-Agent']);
+               } else if( isset($r['headers']['user-agent']) ) {
+                       $r['user-agent'] = $r['headers']['user-agent'];
+                       unset($r['headers']['user-agent']);
+               }
+
+               $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);
+
+               // Convert Header array to string.
+               $strHeaders = '';
+               if ( is_array( $r['headers'] ) )
+                       foreach( $r['headers'] as $name => $value )
+                               $strHeaders .= "{$name}: $value\r\n";
+               else if ( is_string( $r['headers'] ) )
+                       $strHeaders = $r['headers'];
+
+               $arrContext = array('http' =>
+                       array(
+                               'method' => strtoupper($r['method']),
+                               'user_agent' => $r['user-agent'],
+                               'max_redirects' => $r['redirection'],
+                               'protocol_version' => (float) $r['httpversion'],
+                               'header' => $strHeaders,
+                               'timeout' => $r['timeout']
+                       )
+               );
+
+               if ( ! is_null($r['body']) && ! empty($r['body'] ) )
+                       $arrContext['http']['content'] = $r['body'];
+
+               $context = stream_context_create($arrContext);
+
+               if ( ! defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
+                       $handle = @fopen($url, 'r', false, $context);
+               else
+                       $handle = fopen($url, 'r', false, $context);
+
+               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'] ) {
+                       stream_set_blocking($handle, 0);
+                       fclose($handle);
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+               }
+
+               $strResponse = stream_get_contents($handle);
+               $meta = stream_get_meta_data($handle);
+
+               $processedHeaders = array();
+               if( isset( $meta['wrapper_data']['headers'] ) )
+                       $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']['headers']);
+               else
+                       $processedHeaders = WP_Http::processHeaders($meta['wrapper_data']);
+
+               if ( ! empty( $strResponse ) && isset( $processedHeaders['headers']['transfer-encoding'] ) && 'chunked' == $processedHeaders['headers']['transfer-encoding'] )
+                       $strResponse = WP_Http::chunkTransferDecode($strResponse);
+
+               fclose($handle);
+
+               return array('headers' => $processedHeaders['headers'], 'body' => $strResponse, 'response' => $processedHeaders['response']);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @static
+        * @access public
+        * @since 2.7
+        *
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test() {
+               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;
+       }
+}
+
+/**
+ * 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.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ */
+class WP_Http_ExtHTTP {
+       /**
+        * Send a HTTP request to a URI using HTTP extension.
+        *
+        * Does not support non-blocking.
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null
+               );
+
+               $r = wp_parse_args( $args, $defaults );
+
+               if ( isset($r['headers']['User-Agent']) ) {
+                       $r['user-agent'] = $r['headers']['User-Agent'];
+                       unset($r['headers']['User-Agent']);
+               } else if( isset($r['headers']['user-agent']) ) {
+                       $r['user-agent'] = $r['headers']['user-agent'];
+                       unset($r['headers']['user-agent']);
+               }
+
+               switch ( $r['method'] ) {
+                       case 'POST':
+                               $r['method'] = HTTP_METH_POST;
+                               break;
+                       case 'HEAD':
+                               $r['method'] = HTTP_METH_HEAD;
+                               break;
+                       case 'GET':
+                       default:
+                               $r['method'] = HTTP_METH_GET;
+               }
+
+               $arrURL = parse_url($url);
+
+               if ( 'http' != $arrURL['scheme'] || 'https' != $arrURL['scheme'] )
+                       $url = str_replace($arrURL['scheme'], 'http', $url);
+
+               $options = array(
+                       'timeout' => $r['timeout'],
+                       'connecttimeout' => $r['timeout'],
+                       'redirect' => $r['redirection'],
+                       'useragent' => $r['user-agent'],
+                       'headers' => $r['headers'],
+               );
+
+               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
+                       return new WP_Error('http_request_failed', $info['response_code'] . ': ' . $info['error']);
+
+               if ( ! $r['blocking'] )
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+
+               list($theHeaders, $theBody) = explode("\r\n\r\n", $strResponse, 2);
+               $theHeaders = WP_Http::processHeaders($theHeaders);
+
+               if ( ! empty( $theBody ) && isset( $theHeaders['headers']['transfer-encoding'] ) && 'chunked' == $theHeaders['headers']['transfer-encoding'] ) {
+                       if ( !defined('WP_DEBUG') || ( defined('WP_DEBUG') && false === WP_DEBUG ) )
+                               $theBody = @http_chunked_decode($theBody);
+                       else
+                               $theBody = http_chunked_decode($theBody);
+               }
+
+               $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);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @static
+        * @since 2.7
+        *
+        * @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;
+       }
+}
+
+/**
+ * HTTP request method uses Curl extension to retrieve the url.
+ *
+ * Requires the Curl extension to be installed.
+ *
+ * @package WordPress
+ * @subpackage HTTP
+ * @since 2.7
+ */
+class WP_Http_Curl {
+       /**
+        * Send a HTTP request to a URI using cURL extension.
+        *
+        * @access public
+        * @since 2.7
+        *
+        * @param string $url
+        * @param str|array $args Optional. Override the defaults.
+        * @return array 'headers', 'body', and 'response' keys.
+        */
+       function request($url, $args = array()) {
+               $defaults = array(
+                       'method' => 'GET', 'timeout' => 5,
+                       'redirection' => 5, 'httpversion' => '1.0',
+                       'blocking' => true,
+                       'headers' => array(), 'body' => null
+               );
+
+               $r = wp_parse_args( $args, $defaults );
+
+               if ( isset($r['headers']['User-Agent']) ) {
+                       $r['user-agent'] = $r['headers']['User-Agent'];
+                       unset($r['headers']['User-Agent']);
+               } else if( isset($r['headers']['user-agent']) ) {
+                       $r['user-agent'] = $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.
+               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 );
+               }
+
+               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 );
+               }
+
+               curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
+               curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 1 );
+               curl_setopt( $handle, CURLOPT_TIMEOUT, $r['timeout'] );
+               curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );
+
+               // 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 ( $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['blocking'] ) {
+                       curl_exec( $handle );
+                       curl_close( $handle );
+                       return array( 'headers' => array(), 'body' => '', 'response' => array('code', 'message') );
+               }
+
+               $theResponse = curl_exec( $handle );
+
+               if ( !empty($theResponse) ) {
+                       $headerLength = curl_getinfo($handle, CURLINFO_HEADER_SIZE);
+                       $theHeaders = trim( substr($theResponse, 0, $headerLength) );
+                       $theBody = substr( $theResponse, $headerLength );
+                       if ( false !== strrpos($theHeaders, "\r\n\r\n") ) {
+                               $headerParts = explode("\r\n\r\n", $theHeaders);
+                               $theHeaders = $headerParts[ count($headerParts) -1 ];
+                       }
+                       $theHeaders = WP_Http::processHeaders($theHeaders);
+               } else {
+                       if ( $curl_error = curl_error($handle) )
+                               return new WP_Error('http_request_failed', $curl_error);
+                       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() );
+                       $theBody = '';
+               }
+               $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);
+       }
+
+       /**
+        * Whether this class can be used for retrieving an URL.
+        *
+        * @static
+        * @since 2.7
+        *
+        * @return boolean False means this class can not be used, true means it can.
+        */
+       function test() {
+               if ( function_exists('curl_init') && function_exists('curl_exec') )
+                       return true;
+
+               return false;
+       }
+}
+
+/**
+ * Returns the initialized WP_Http Object
+ *
+ * @since 2.7
+ * @access private
+ *
+ * @return WP_Http HTTP Transport object.
+ */
+function &_wp_http_get_object() {
+       static $http;
+
+       if ( is_null($http) )
+               $http = new WP_Http();
+
+       return $http;
+}
+
+/**
+ * Retrieve the raw response from the HTTP request.
+ *
+ * The array structure is a little complex.
+ *
+ * <code>
+ * $res = array( 'headers' => array(), 'response' => array('code', 'message') );
+ * </code>
+ *
+ * All of the headers in $res['headers'] are with the name as the key and the
+ * value as the value. So to get the User-Agent, you would do the following.
+ *
+ * <code>
+ * $user_agent = $res['headers']['user-agent'];
+ * </code>
+ *
+ * The body is the raw response content and can be retrieved from $res['body'].
+ *
+ * This function is called first to make the request and there are other API
+ * functions to abstract out the above convoluted setup.
+ *
+ * @since 2.7.0
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return string The body of the response
+ */
+function wp_remote_request($url, $args = array()) {
+       $objFetchSite = _wp_http_get_object();
+       return $objFetchSite->request($url, $args);
+}
+
+/**
+ * Retrieve the raw response from the HTTP request using the GET method.
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ *
+ * @since 2.7
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return string The body of the response
+ */
+function wp_remote_get($url, $args = array()) {
+       $objFetchSite = _wp_http_get_object();
+
+       return $objFetchSite->get($url, $args);
+}
+
+/**
+ * Retrieve the raw response from the HTTP request using the POST method.
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ *
+ * @since 2.7
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return string The body of the response
+ */
+function wp_remote_post($url, $args = array()) {
+       $objFetchSite = _wp_http_get_object();
+       return $objFetchSite->post($url, $args);
+}
+
+/**
+ * Retrieve the raw response from the HTTP request using the HEAD method.
+ *
+ * @see wp_remote_request() For more information on the response array format.
+ *
+ * @since 2.7
+ *
+ * @param string $url Site URL to retrieve.
+ * @param array $args Optional. Override the defaults.
+ * @return string The body of the response
+ */
+function wp_remote_head($url, $args = array()) {
+       $objFetchSite = _wp_http_get_object();
+       return $objFetchSite->head($url, $args);
+}
+
+/**
+ * Retrieve only the headers from the raw response.
+ *
+ * @since 2.7
+ *
+ * @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']))
+               return array();
+
+       return $response['headers'];
+}
+
+/**
+ * Retrieve a single header by name from the raw response.
+ *
+ * @since 2.7
+ *
+ * @param array $response
+ * @param string $header Header name to retrieve value from.
+ * @return array The header value. Empty string on if incorrect parameter given.
+ */
+function wp_remote_retrieve_header(&$response, $header) {
+       if ( ! isset($response['headers']) || ! is_array($response['headers']))
+               return '';
+
+       if ( array_key_exists($header, $response['headers']) )
+               return $response['headers'][$header];
+
+       return '';
+}
+
+/**
+ * Retrieve only the response code from the raw response.
+ *
+ * Will return an empty array if incorrect parameter value is given.
+ *
+ * @since 2.7
+ *
+ * @param array $response HTTP response.
+ * @return array The keys 'code' and 'message' give information on the response.
+ */
+function wp_remote_retrieve_response_code(&$response) {
+       if ( ! isset($response['response']) || ! is_array($response['response']))
+               return '';
+
+       return $response['response']['code'];
+}
+
+/**
+ * Retrieve only the response message from the raw response.
+ *
+ * Will return an empty array if incorrect parameter value is given.
+ *
+ * @since 2.7
+ *
+ * @param array $response HTTP response.
+ * @return array The keys 'code' and 'message' give information on the response.
+ */
+function wp_remote_retrieve_response_message(&$response) {
+       if ( ! isset($response['response']) || ! is_array($response['response']))
+               return '';
+
+       return $response['response']['message'];
+}
+
+/**
+ * Retrieve only the body from the raw response.
+ *
+ * @since 2.7
+ *
+ * @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']) )
+               return '';
+
+       return $response['body'];
+}
+
+?>
diff --git a/wp-includes/images/audio.png b/wp-includes/images/audio.png
deleted file mode 100644 (file)
index 7b2a854..0000000
Binary files a/wp-includes/images/audio.png and /dev/null differ
diff --git a/wp-includes/images/css.png b/wp-includes/images/css.png
deleted file mode 100644 (file)
index 038e34d..0000000
Binary files a/wp-includes/images/css.png and /dev/null differ
diff --git a/wp-includes/images/default.png b/wp-includes/images/default.png
deleted file mode 100644 (file)
index c551227..0000000
Binary files a/wp-includes/images/default.png and /dev/null differ
diff --git a/wp-includes/images/doc.png b/wp-includes/images/doc.png
deleted file mode 100644 (file)
index e4e62a1..0000000
Binary files a/wp-includes/images/doc.png and /dev/null differ
diff --git a/wp-includes/images/exe.png b/wp-includes/images/exe.png
deleted file mode 100644 (file)
index d994265..0000000
Binary files a/wp-includes/images/exe.png and /dev/null differ
diff --git a/wp-includes/images/html.png b/wp-includes/images/html.png
deleted file mode 100644 (file)
index ed81af1..0000000
Binary files a/wp-includes/images/html.png and /dev/null differ
diff --git a/wp-includes/images/js.png b/wp-includes/images/js.png
deleted file mode 100644 (file)
index e0862d3..0000000
Binary files a/wp-includes/images/js.png and /dev/null differ
diff --git a/wp-includes/images/pdf.png b/wp-includes/images/pdf.png
deleted file mode 100644 (file)
index b4d5f9c..0000000
Binary files a/wp-includes/images/pdf.png and /dev/null differ
diff --git a/wp-includes/images/swf.png b/wp-includes/images/swf.png
deleted file mode 100644 (file)
index 156e3e4..0000000
Binary files a/wp-includes/images/swf.png and /dev/null differ
diff --git a/wp-includes/images/tar.png b/wp-includes/images/tar.png
deleted file mode 100644 (file)
index 0468ef8..0000000
Binary files a/wp-includes/images/tar.png and /dev/null differ
diff --git a/wp-includes/images/text.png b/wp-includes/images/text.png
deleted file mode 100644 (file)
index 10bcf5e..0000000
Binary files a/wp-includes/images/text.png and /dev/null differ
diff --git a/wp-includes/images/upload.png b/wp-includes/images/upload.png
new file mode 100644 (file)
index 0000000..74c6f12
Binary files /dev/null and b/wp-includes/images/upload.png differ
diff --git a/wp-includes/images/video.png b/wp-includes/images/video.png
deleted file mode 100644 (file)
index f822ac4..0000000
Binary files a/wp-includes/images/video.png and /dev/null differ
diff --git a/wp-includes/images/zip.png b/wp-includes/images/zip.png
deleted file mode 100644 (file)
index d1eaf1e..0000000
Binary files a/wp-includes/images/zip.png and /dev/null differ
index ee0f31858bb7c12667b6997e75af9aa57550c162..7e1d0aa871bfdec2ab342928fd9b6961b173657d 100644 (file)
@@ -1,8 +1,8 @@
 var autosaveLast = '';
 var autosavePeriodical;
 var autosaveOldMessage = '';
 var autosaveLast = '';
 var autosavePeriodical;
 var autosaveOldMessage = '';
-var autosaveDelayURL = null;
-var previewwin;
+var autosaveDelayPreview = false;
+var autosaveFirst = true;
 
 jQuery(function($) {
        autosaveLast = $('#post #title').val()+$('#post #content').val();
 
 jQuery(function($) {
        autosaveLast = $('#post #title').val()+$('#post #content').val();
@@ -10,16 +10,6 @@ jQuery(function($) {
 
        //Disable autosave after the form has been submitted
        $("#post").submit(function() { $.cancel(autosavePeriodical); });
 
        //Disable autosave after the form has been submitted
        $("#post").submit(function() { $.cancel(autosavePeriodical); });
-       
-       // Autosave when the preview button is clicked. 
-       $('#previewview a').click(function(e) {
-               autosave();
-               autosaveDelayURL = this.href;
-               previewwin = window.open('','_blank');
-
-               e.preventDefault();
-               return false;
-       });
 });
 
 function autosave_parse_response(response) {
 });
 
 function autosave_parse_response(response) {
@@ -41,11 +31,10 @@ function autosave_parse_response(response) {
                        });
                }
 
                        });
                }
 
-               // if no errors: add preview link and slug UI
+               // if no errors: add slug UI
                if ( !res.errors ) {
                        var postID = parseInt( res.responses[0].id );
                        if ( !isNaN(postID) && postID > 0 ) {
                if ( !res.errors ) {
                        var postID = parseInt( res.responses[0].id );
                        if ( !isNaN(postID) && postID > 0 ) {
-                               autosave_update_preview_link(postID);
                                autosave_update_slug(postID);
                        }
                }
                                autosave_update_slug(postID);
                        }
                }
@@ -69,10 +58,14 @@ function autosave_saved_new(response) {
                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
                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
+               if ( tempID < 0 && postID > 0 ) // update media buttons
                        jQuery('#media-buttons a').each(function(){
                                this.href = this.href.replace(tempID, postID);
                        });
                        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
        }
        } else {
                autosave_enable_buttons(); // re-enable disabled form buttons
        }
@@ -97,31 +90,6 @@ function autosave_update_post_ID( postID ) {
        }
 }
 
        }
 }
 
-function autosave_update_preview_link(post_id) {
-       // Add preview button if not already there
-       if ( !jQuery('#previewview > *').size() ) {
-               var post_type = jQuery('#post_type').val();
-               var previewText = 'page' == post_type ? autosaveL10n.previewPageText : autosaveL10n.previewPostText;
-               jQuery.post(autosaveL10n.requestFile, {
-                       action: "get-permalink",
-                       post_id: post_id,
-                       getpermalinknonce: jQuery('#getpermalinknonce').val()
-               }, function(permalink) {
-                       jQuery('#previewview').html('<a target="_blank" href="'+permalink+'" tabindex="4">'+previewText+'</a>');
-
-                       // Autosave when the preview button is clicked.  
-                       jQuery('#previewview a').click(function(e) {
-                               autosave();
-                               autosaveDelayURL = this.href;
-                               previewwin = window.open('','_blank');
-
-                               e.preventDefault();
-                               return false;
-                       });
-               });
-       }
-}
-
 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() ) {
 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() ) {
@@ -130,7 +98,7 @@ function autosave_update_slug(post_id) {
                        {
                                action: 'sample-permalink',
                                post_id: post_id,
                        {
                                action: 'sample-permalink',
                                post_id: post_id,
-                               new_title: jQuery('#title').val(), 
+                               new_title: jQuery('#title').val(),
                                samplepermalinknonce: jQuery('#samplepermalinknonce').val()
                        },
                        function(data) {
                                samplepermalinknonce: jQuery('#samplepermalinknonce').val()
                        },
                        function(data) {
@@ -146,15 +114,11 @@ function autosave_loading() {
 }
 
 function autosave_enable_buttons() {
 }
 
 function autosave_enable_buttons() {
-       jQuery("#submitpost :button:disabled, #submitpost :submit:disabled").attr('disabled', '');
-       if ( autosaveDelayURL ) {
-               previewwin.location = autosaveDelayURL;
-               autosaveDelayURL = null;
-       }
+       jQuery(".submitbox :button:disabled, .submitbox :submit:disabled").attr('disabled', '');
 }
 
 function autosave_disable_buttons() {
 }
 
 function autosave_disable_buttons() {
-       jQuery("#submitpost :button:enabled, #submitpost :submit:enabled").attr('disabled', 'disabled');
+       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.
 }
 
        setTimeout(autosave_enable_buttons, 5000); // Re-enable 5 sec later.  Just gives autosave a head start to avoid collisions.
 }
 
@@ -180,13 +144,13 @@ var autosave = function() {
                doAutoSave = false;
 
        /* Gotta do this up here so we can check the length when tinyMCE is in use */
                doAutoSave = false;
 
        /* Gotta do this up here so we can check the length when tinyMCE is in use */
-       if ( rich ) {           
+       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();
        }
                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();
        post_data["content"] = jQuery("#content").val();
        if ( jQuery('#post_name').val() )
                post_data["post_name"] = jQuery('#post_name').val();
@@ -215,6 +179,7 @@ var autosave = function() {
                post_data["excerpt"] = jQuery("#excerpt").val();
        if ( jQuery("#post_author").size() )
                post_data["post_author"] = jQuery("#post_author").val();
                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 ) {
 
        // Don't run while the TinyMCE spellcheck is on.  Why?  Who knows.
        if ( rich && tinyMCE.activeEditor.plugins.spellchecker && tinyMCE.activeEditor.plugins.spellchecker.active ) {
@@ -223,7 +188,7 @@ var autosave = function() {
 
        if(parseInt(post_data["post_ID"]) < 1) {
                post_data["temp_ID"] = post_data["post_ID"];
 
        if(parseInt(post_data["post_ID"]) < 1) {
                post_data["temp_ID"] = post_data["post_ID"];
-               var successCallback = autosave_saved_new;; // new post
+               var successCallback = autosave_saved_new; // new post
        } else {
                var successCallback = autosave_saved; // pre-existing post
        }
        } else {
                var successCallback = autosave_saved; // pre-existing post
        }
diff --git a/wp-includes/js/comment-reply.js b/wp-includes/js/comment-reply.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);
+       }
+}
diff --git a/wp-includes/js/hoverIntent.js b/wp-includes/js/hoverIntent.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
diff --git a/wp-includes/js/jquery/jquery.hotkeys.js b/wp-includes/js/jquery/jquery.hotkeys.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
diff --git a/wp-includes/js/jquery/jquery.table-hotkeys.js b/wp-includes/js/jquery/jquery.table-hotkeys.js
new file mode 100644 (file)
index 0000000..515c8ac
--- /dev/null
@@ -0,0 +1,93 @@
+(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);
index c38b92066739b1e82faf34cbca83fd436e46f175..2dbda4f5a08ce02f1e101fa7ae22b05964cf01d4 100644 (file)
@@ -1,2 +1,2 @@
-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={2s:{1o:3(E,F,H){6 G=C.8[E].n;1v(6 D 2r H){G.w[D]=G.w[D]||[];G.w[D].2q([F,H[D]])}},1n:3(D,F,E){6 H=D.w[F];5(!H){4}1v(6 G=0;G<H.2p;G++){5(D.a[H[G][0]]){H[G][1].u(D.c,E)}}}},o:{},f:3(D){5(C.8.o[D]){4 C.8.o[D]}6 E=C(\'<2o 2n="8-2m">\').1i(D).f({2l:"2k",12:"-1u",2j:"-1u",2i:"2h"}).2g("1t");C.8.o[D]=!!((!(/2f|2e/).h(E.f("2d"))||(/^[1-9]/).h(E.f("2c"))||(/^[1-9]/).h(E.f("2b"))||!(/1r/).h(E.f("2a"))||!(/29|28\\(0, 0, 0, 0\\)/).h(E.f("27"))));26{C("1t").1s(0).25(E.1s(0))}24(F){}4 C.8.o[D]},23:3(D){D.j="1g";D.1q=3(){4 7};5(D.v){D.v.1p="1r"}},22:3(D){D.j="21";D.1q=3(){4 d};5(D.v){D.v.1p=""}},20:3(G,E){6 D=/12/.h(E||"12")?"1Z":"1Y",F=7;5(G[D]>0){4 d}G[D]=1;F=G[D]>0?d:7;G[D]=0;4 F}};6 B=C.10.t;C.10.t=3(){C("*",2).1o(2).1X("t");4 B.u(2,1m)};3 A(E,F,G){6 D=C[E][F].1W||[];D=(W D=="V"?D.11(/,?\\s+/):D);4(C.1V(G,D)!=-1)}C.l=3(E,D){6 F=E.11(".")[0];E=E.11(".")[1];C.10[E]=3(J){6 H=(W J=="V"),I=1U.n.1T.1n(1m,1);5(H&&A(F,E,J)){6 G=C.Z(2[0],E);4(G?G[J].u(G,I):1S)}4 2.1R(3(){6 K=C.Z(2,E);5(H&&K&&C.1Q(K[J])){K[J].u(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.1h=F+"-"+E;2.a=C.1l({},C.l.p,C[F][E].p,H);2.c=C(I).g("m."+E,3(L,J,K){4 G.m(J,K)}).g("Y."+E,3(K,J){4 G.Y(J)}).g("t",3(){4 G.1j()});2.1k()};C[F][E].n=C.1l({},C.l.n,D)};C.l.n={1k:3(){},1j:3(){2.c.1N(2.e)},Y:3(D){4 2.a[D]},m:3(D,E){2.a[D]=E;5(D=="k"){2.c[E?"1i":"1M"](2.1h+"-k")}},1L:3(){2.m("k",7)},1K:3(){2.m("k",d)}};C.l.p={k:7};C.8.14={1J:3(){6 D=2;2.c.g("1I."+2.e,3(E){4 D.1e(E)});5(C.U.T){2.1f=2.c.X("j");2.c.X("j","1g")}2.1H=7},1G:3(){2.c.R("."+2.e);(C.U.T&&2.c.X("j",2.1f))},1e:3(F){(2.b&&2.i(F));2.r=F;6 E=2,G=(F.1F==1),D=(W 2.a.y=="V"?C(F.1E).1D(2.a.y):7);5(!G||D||!2.15(F)){4 d}2.q=!2.a.x;5(!2.q){2.1C=1B(3(){E.q=d},2.a.x)}5(2.P(F)&&2.N(F)){2.b=(2.M(F)!==7);5(!2.b){F.1A();4 d}}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.r,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.r.19-D.19),O.18(2.r.17-D.17))>=2.a.13)},N:3(D){4 2.q},M:3(D){},z:3(D){},16:3(D){},15:3(D){4 d}};C.8.14.p={y:1x,13:1,x:0}})(1w)',62,153,'||this|function|return|if|var|false|ui||options|_mouseStarted|element|true|widgetName|css|bind|test|mouseUp|unselectable|disabled|widget|setData|prototype|cssCache|defaults|_mouseDelayMet|_mouseDownEvent||remove|apply|style|plugins|delay|cancel|mouseDrag|||||||||||||mouseStart|mouseDelayMet|Math|mouseDistanceMet|_mouseUpDelegate|unbind|_mouseMoveDelegate|msie|browser|string|typeof|attr|getData|data|fn|split|top|distance|mouse|mouseCapture|mouseStop|pageY|abs|pageX|mouseup|mousemove|document|mouseMove|mouseDown|_mouseUnselectable|on|widgetBaseClass|addClass|destroy|init|extend|arguments|call|add|MozUserSelect|onselectstart|none|get|body|5000px|for|jQuery|null|max|button|preventDefault|setTimeout|_mouseDelayTimer|is|target|which|mouseDestroy|started|mousedown|mouseInit|disable|enable|removeClass|removeData|new|else|isFunction|each|undefined|slice|Array|inArray|getter|trigger|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|length|push|in|plugin'.split('|'),0,{}))
+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,{}))
 
 
diff --git a/wp-includes/js/jquery/ui.dialog.js b/wp-includes/js/jquery/ui.dialog.js
new file mode 100644 (file)
index 0000000..35742f1
--- /dev/null
@@ -0,0 +1 @@
+(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
diff --git a/wp-includes/js/jquery/ui.draggable.js b/wp-includes/js/jquery/ui.draggable.js
new file mode 100644 (file)
index 0000000..4ab9155
--- /dev/null
@@ -0,0 +1 @@
+(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
diff --git a/wp-includes/js/jquery/ui.resizable.js b/wp-includes/js/jquery/ui.resizable.js
new file mode 100644 (file)
index 0000000..423328e
--- /dev/null
@@ -0,0 +1 @@
+(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
index c3f9d06cdc9fb568afff5143c7235380d6daf736..f15f8b192bf7d3a4027ffea04b61d6bb7a3c927b 100644 (file)
@@ -1,2 +1 @@
-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}('(b(B){b A(E,D){9 C=B.2U.3W&&B.2U.3V<3U;5(E.2T&&!C){d E.2T(D)}5(E.2S){d!!(E.2S(D)&16)}1R(D=D.1g){5(D==E){d U}}d w}B.3T("m.q",B.2h(B.m.3S,{3R:b(){9 C=4.8;4.P={};4.g.27("m-q");4.2L();4.13=4.c.z?(/6|25/).18(4.c[0].u.f("3Q")):w;5(!(/(2R|1t|3P)/).18(4.g.f("W"))){4.g.f("W","2R")}4.a=4.g.a();4.3O()},3N:{},m:b(C){d{k:(C||4)["k"],r:(C||4)["r"]||B([]),W:(C||4)["W"],3M:(C||4)["1c"],8:4.8,g:4.g,u:(C||4)["i"],3L:C?C.g:O}},v:b(F,E,C,D){B.m.1m.15(4,F,[E,4.m(C)]);5(!D){4.g.3K(F=="1C"?F:"1C"+F,[E,4.m(C)],4.8[F])}},2g:b(E){9 C=(B.1O(4.8.c)?4.8.c.15(4.g):B(4.8.c,4.g)).1Y(".m-q-k");9 D=[];E=E||{};C.1y(b(){9 F=(B(4).2O(E.3J||"2N")||"").3I(E.2P||(/(.+)[-=3H](.+)/));5(F){D.1z((E.2Q||F[1])+"[]="+(E.2Q&&E.2P?F[1]:F[2]))}});d D.3G("&")},2f:b(C){9 D=(B.1O(4.8.c)?4.8.c.15(4.g):B(4.8.c,4.g)).1Y(".m-q-k");9 E=[];D.1y(b(){E.1z(B(4).2O(C||"2N"))});d E},2G:b(J){9 E=4.1c.6,D=E+4.s.n,I=4.1c.7,H=I+4.s.o;9 F=J.6,C=F+J.n,K=J.7,G=K+J.o;5(4.8.1p=="2M"||(4.8.1p=="1V"&&4.s[4.13?"n":"o"]>J[4.13?"n":"o"])){d(I+4.a.p.7>K&&I+4.a.p.7<G&&E+4.a.p.6>F&&E+4.a.p.6<C)}Z{d(F<E+(4.s.n/2)&&D-(4.s.n/2)<C&&K<I+(4.s.o/2)&&H-(4.s.o/2)<G)}},2u:b(J){9 E=4.1c.6,D=E+4.s.n,I=4.1c.7,H=I+4.s.o;9 F=J.6,C=F+J.n,K=J.7,G=K+J.o;5(4.8.1p=="2M"||(4.8.1p=="1V"&&4.s[4.13?"n":"o"]>J[4.13?"n":"o"])){5(!(I+4.a.p.7>K&&I+4.a.p.7<G&&E+4.a.p.6>F&&E+4.a.p.6<C)){d w}5(4.13){5(E+4.a.p.6>F&&E+4.a.p.6<F+J.n/2){d 2}5(E+4.a.p.6>F+J.n/2&&E+4.a.p.6<C){d 1}}Z{5(I+4.a.p.7>K&&I+4.a.p.7<K+J.o/2){d 2}5(I+4.a.p.7>K+J.o/2&&I+4.a.p.7<G){d 1}}}Z{5(!(F<E+(4.s.n/2)&&D-(4.s.n/2)<C&&K<I+(4.s.o/2)&&H-(4.s.o/2)<G)){d w}5(4.13){5(D>F&&E<F){d 2}5(E<C&&D>C){d 1}}Z{5(H>K&&I<K){d 1}5(I<G&&H>G){d 2}}}d w},2L:b(){4.28();4.1I()},28:b(){4.c=[];4.e=[4];9 D=4.c;9 C=4;9 F=[[B.1O(4.8.c)?4.8.c.15(4.g,O,{8:4.8,u:4.i}):B(4.8.c,4.g),4]];5(4.8.2a){Q(9 G=4.8.2a.z-1;G>=0;G--){9 I=B(4.8.2a[G]);Q(9 E=I.z-1;E>=0;E--){9 H=B.1f(I[E],"q");5(H&&!H.8.29){F.1z([B.1O(H.8.c)?H.8.c.15(H.g):B(H.8.c,H.g),H]);4.e.1z(H)}}}}Q(9 G=F.z-1;G>=0;G--){F[G][0].1y(b(){B.1f(4,"q-u",F[G][1]);D.1z({u:B(4),2K:F[G][1],n:0,o:0,6:0,7:0})})}},1I:b(D){5(4.t){9 C=4.t.a();4.a.l={7:C.7+4.1w.7,6:C.6+4.1w.6}}Q(9 F=4.c.z-1;F>=0;F--){5(4.c[F].2K!=4.1x&&4.1x&&4.c[F].u[0]!=4.i[0]){1L}9 E=4.8.2J?B(4.8.2J,4.c[F].u):4.c[F].u;5(!D){4.c[F].n=E.1v();4.c[F].o=E.1u()}9 G=E.a();4.c[F].6=G.6;4.c[F].7=G.7}Q(9 F=4.e.z-1;F>=0;F--){9 G=4.e[F].g.a();4.e[F].P.6=G.6;4.e[F].P.7=G.7;4.e[F].P.n=4.e[F].g.1v();4.e[F].P.o=4.e[F].g.1u()}},3F:b(){4.g.3E("m-q m-q-29").2I("q").3D(".q");4.3C();Q(9 C=4.c.z-1;C>=0;C--){4.c[C].u.2I("q-u")}},26:b(E){9 C=E||4,F=C.8;5(F.r.3B==3A){9 D=F.r;F.r={g:b(){d B("<2H></2H>").27(D)[0]},1q:b(G,H){H.f(G.a()).f({n:G.1v(),o:G.1u()})}}}C.r=B(F.r.g.15(C.g,C.i)).1o("T").f({W:"1t"});F.r.1q.15(C.g,C.i,C.r)},2s:b(F){Q(9 D=4.e.z-1;D>=0;D--){5(4.2G(4.e[D].P)){5(!4.e[D].P.1b){5(4.1x!=4.e[D]){9 I=3z;9 H=O;9 E=4.1c[4.e[D].13?"6":"7"];Q(9 C=4.c.z-1;C>=0;C--){5(!A(4.e[D].g[0],4.c[C].u[0])){1L}9 G=4.c[C][4.e[D].13?"6":"7"];5(1k.2F(G-E)<I){I=1k.2F(G-E);H=4.c[C]}}5(!H&&!4.8.2e){1L}5(4.r){4.r.1G()}5(4.e[D].8.r){4.e[D].26(4)}Z{4.r=O}4.1x=4.e[D];H?4.1J(F,H,O,U):4.1J(F,O,4.e[D].g,U);4.v("21",F);4.e[D].v("21",F,4)}4.e[D].v("1b",F,4);4.e[D].P.1b=1}}Z{5(4.e[D].P.1b){4.e[D].v("2k",F,4);4.e[D].P.1b=0}}}},3y:b(G,F){5(4.8.29||4.8.2t=="3x"){d w}4.28();9 E=O,D=4,C=B(G.1N).2D().1y(b(){5(B.1f(4,"q-u")==D){E=B(4);d w}});5(B.1f(G.1N,"q-u")==D){E=B(G.1N)}5(!E){d w}5(4.8.2E&&!F){9 H=w;B(4.8.2E,E).3w("*").3v().1y(b(){5(4==G.1N){H=U}});5(!H){d w}}4.i=E;d U},3u:b(H,F,C){9 J=4.8;4.1x=4;4.1I();4.k=3t J.k=="b"?B(J.k.3s(4.g[0],[H,4.i])):4.i.1W();5(!4.k.2D("T").z){4.k.1o((J.1o!="l"?J.1o:4.i[0].1g))}4.k.f({W:"1t",1H:"3r"}).27("m-q-k");4.V={6:(L(4.i.f("3q"),10)||0),7:(L(4.i.f("3p"),10)||0)};4.a=4.i.a();4.a={7:4.a.7-4.V.7,6:4.a.6-4.V.6};4.a.p={6:H.1d-4.a.6,7:H.1e-4.a.7};4.t=4.k.t();9 D=4.t.a();4.1w={7:(L(4.t.f("23"),10)||0),6:(L(4.t.f("24"),10)||0)};4.a.l={7:D.7+4.1w.7,6:D.6+4.1w.6};4.1j=4.22(H);4.1X={1r:4.i.1r()[0],l:4.i.l()[0]};4.s={n:4.k.1v(),o:4.k.1u()};5(J.r){4.26()}4.v("1l",H);4.s={n:4.k.1v(),o:4.k.1u()};5(J.12){5(J.12.6!=1M){4.a.p.6=J.12.6}5(J.12.25!=1M){4.a.p.6=4.s.n-J.12.25}5(J.12.7!=1M){4.a.p.7=J.12.7}5(J.12.2C!=1M){4.a.p.7=4.s.o-J.12.2C}}5(J.j){5(J.j=="l"){J.j=4.k[0].1g}5(J.j=="h"||J.j=="17"){4.j=[0-4.a.l.6,0-4.a.l.7,B(J.j=="h"?h:17).n()-4.a.l.6-4.s.n-4.V.6-(L(4.g.f("2B"),10)||0),(B(J.j=="h"?h:17).o()||h.T.1g.2z)-4.a.l.7-4.s.o-4.V.7-(L(4.g.f("2y"),10)||0)]}5(!(/^(h|17|l)$/).18(J.j)){9 G=B(J.j)[0];9 I=B(J.j).a();4.j=[I.6+(L(B(G).f("24"),10)||0)-4.a.l.6,I.7+(L(B(G).f("23"),10)||0)-4.a.l.7,I.6+1k.2A(G.3o,G.2b)-(L(B(G).f("24"),10)||0)-4.a.l.6-4.s.n-4.V.6-(L(4.i.f("2B"),10)||0),I.7+1k.2A(G.2z,G.2c)-(L(B(G).f("23"),10)||0)-4.a.l.7-4.s.o-4.V.7-(L(4.i.f("2y"),10)||0)]}}5(4.8.r!="1W"){4.i.f("2i","3n")}5(!C){Q(9 E=4.e.z-1;E>=0;E--){4.e[E].v("3m",H,4)}}5(B.m.14){B.m.14.3l=4}5(B.m.14&&!J.2n){B.m.14.3k(4,H)}4.2j=U;4.2w(H);d U},2v:b(D,E){5(!E){E=4.W}9 C=D=="1t"?1:-1;d{7:(E.7+4.a.l.7*C-(4.t[0]==h.T?0:4.t[0].N)*C+4.V.7*C),6:(E.6+4.a.l.6*C-(4.t[0]==h.T?0:4.t[0].M)*C+4.V.6*C)}},22:b(F){9 G=4.8;9 C={7:(F.1e-4.a.p.7-4.a.l.7+(4.t[0]==h.T?0:4.t[0].N)),6:(F.1d-4.a.p.6-4.a.l.6+(4.t[0]==h.T?0:4.t[0].M))};5(!4.1j){d C}5(4.j){5(C.6<4.j[0]){C.6=4.j[0]}5(C.7<4.j[1]){C.7=4.j[1]}5(C.6>4.j[2]){C.6=4.j[2]}5(C.7>4.j[3]){C.7=4.j[3]}}5(G.11){9 E=4.1j.7+1k.2x((C.7-4.1j.7)/G.11[1])*G.11[1];C.7=4.j?(!(E<4.j[1]||E>4.j[3])?E:(!(E<4.j[1])?E-G.11[1]:E+G.11[1])):E;9 D=4.1j.6+1k.2x((C.6-4.1j.6)/G.11[0])*G.11[0];C.6=4.j?(!(D<4.j[0]||D>4.j[2])?D:(!(D<4.j[0])?D-G.11[0]:D+G.11[0])):D}d C},2w:b(D){4.W=4.22(D);4.1c=4.2v("1t");Q(9 C=4.c.z-1;C>=0;C--){9 E=4.2u(4.c[C]);5(!E){1L}5(4.c[C].u[0]!=4.i[0]&&4.i[E==1?"3j":"1r"]()[0]!=4.c[C].u[0]&&!A(4.i[0],4.c[C].u[0])&&(4.8.2t=="3i-3h"?!A(4.g[0],4.c[C].u[0]):U)){4.2p=E==1?"2o":"3g";4.1J(D,4.c[C]);4.v("21",D);3f}}4.2s(D);4.v("1C",D);5(!4.8.1K||4.8.1K=="x"){4.k[0].2r.6=4.W.6+"2q"}5(!4.8.1K||4.8.1K=="y"){4.k[0].2r.7=4.W.7+"2q"}5(B.m.14){B.m.14.3e(4,D)}d w},1J:b(H,G,D,F){D?D.3d(4.i):G.u[4.2p=="2o"?"3c":"3b"](4.i);4.1s=4.1s?++4.1s:1;9 E=4,C=4.1s;17.3a(b(){5(C==E.1s){E.1I(!F)}},0);5(4.8.r){4.8.r.1q.15(4.g,4.i,4.r)}},39:b(E,D){5(B.m.14&&!4.8.2n){B.m.14.38(4,E)}5(4.8.1Z){9 C=4;9 F=C.i.a();5(C.r){C.r.2m({19:"37"},(L(4.8.1Z,10)||2l)-36)}B(4.k).2m({6:F.6-4.a.l.6-C.V.6+(4.t[0]==h.T?0:4.t[0].M),7:F.7-4.a.l.7-C.V.7+(4.t[0]==h.T?0:4.t[0].N)},L(4.8.1Z,10)||2l,b(){C.1H(E)})}Z{4.1H(E,D)}d w},1H:b(E,D){5(4.1X.1r!=4.i.1r().1Y(".m-q-k")[0]||4.1X.l!=4.i.l()[0]){4.v("1q",E,O,D)}5(!A(4.g[0],4.i[0])){4.v("1G",E,O,D);Q(9 C=4.e.z-1;C>=0;C--){5(A(4.e[C].g[0],4.i[0])){4.e[C].v("1q",E,4,D);4.e[C].v("35",E,4,D)}}}Q(9 C=4.e.z-1;C>=0;C--){4.e[C].v("34",E,4,D);5(4.e[C].P.1b){4.e[C].v("2k",E,4);4.e[C].P.1b=0}}4.2j=w;5(4.33){4.v("1n",E,O,D);d w}B(4.i).f("2i","");5(4.r){4.r.1G()}4.k.1G();4.k=O;4.v("1n",E,O,D);d U}}));B.2h(B.m.q,{32:"2g 2f",31:{k:"1W",1p:"1V",30:1,2Z:0,1h:U,Y:20,X:20,2Y:":2X",c:"> *",1a:2W,2e:U,1o:"l"}});B.m.1m.1F("q","1i",{1l:b(E,D){9 C=B("T");5(C.f("1i")){D.8.1U=C.f("1i")}C.f("1i",D.8.1i)},1n:b(D,C){5(C.8.1U){B("T").f("1i",C.8.1U)}}});B.m.1m.1F("q","1a",{1l:b(E,D){9 C=D.k;5(C.f("1a")){D.8.1T=C.f("1a")}C.f("1a",D.8.1a)},1n:b(D,C){5(C.8.1T){B(C.k).f("1a",C.8.1T)}}});B.m.1m.1F("q","19",{1l:b(E,D){9 C=D.k;5(C.f("19")){D.8.1S=C.f("19")}C.f("19",D.8.19)},1n:b(D,C){5(C.8.1S){B(C.k).f("19",C.8.1S)}}});B.m.1m.1F("q","1h",{1l:b(E,D){9 F=D.8;9 C=B(4).1f("q");C.S=b(G){2d{5(/1E|1h/.18(G.f("1D"))||(/1E|1h/).18(G.f("1D-y"))){d G}G=G.l()}1R(G[0].1g);d B(h)}(C.i);C.R=b(G){2d{5(/1E|1h/.18(G.f("1D"))||(/1E|1h/).18(G.f("1D-x"))){d G}G=G.l()}1R(G[0].1g);d B(h)}(C.i);5(C.S[0]!=h&&C.S[0].1B!="1A"){C.1Q=C.S.a()}5(C.R[0]!=h&&C.R[0].1B!="1A"){C.1P=C.R.a()}},1C:b(E,D){9 F=D.8;9 C=B(4).1f("q");5(C.S[0]!=h&&C.S[0].1B!="1A"){5((C.1Q.7+C.S[0].2c)-E.1e<F.Y){C.S[0].N=C.S[0].N+F.X}5(E.1e-C.1Q.7<F.Y){C.S[0].N=C.S[0].N-F.X}}Z{5(E.1e-B(h).N()<F.Y){B(h).N(B(h).N()-F.X)}5(B(17).o()-(E.1e-B(h).N())<F.Y){B(h).N(B(h).N()+F.X)}}5(C.R[0]!=h&&C.R[0].1B!="1A"){5((C.1P.6+C.R[0].2b)-E.1d<F.Y){C.R[0].M=C.R[0].M+F.X}5(E.1d-C.1P.6<F.Y){C.R[0].M=C.R[0].M-F.X}}Z{5(E.1d-B(h).M()<F.Y){B(h).M(B(h).M()-F.X)}5(B(17).n()-(E.1d-B(h).M())<F.Y){B(h).M(B(h).M()+F.X)}}}})})(2V)',62,245,'||||this|if|left|top|options|var|offset|function|items|return|containers|css|element|document|currentItem|containment|helper|parent|ui|width|height|click|sortable|placeholder|helperProportions|offsetParent|item|propagate|false|||length||||||||||||parseInt|scrollLeft|scrollTop|null|containerCache|for|overflowX|overflowY|body|true|margins|position|scrollSpeed|scrollSensitivity|else||grid|cursorAt|floating|ddmanager|call||window|test|opacity|zIndex|over|positionAbs|pageX|pageY|data|parentNode|scroll|cursor|originalPosition|Math|start|plugin|stop|appendTo|tolerance|update|prev|counter|absolute|outerHeight|outerWidth|offsetParentBorders|currentContainer|each|push|HTML|tagName|sort|overflow|auto|add|remove|clear|refreshPositions|rearrange|axis|continue|undefined|target|isFunction|overflowXOffset|overflowYOffset|while|_opacity|_zIndex|_cursor|guess|clone|domPosition|not|revert||change|generatePosition|borderTopWidth|borderLeftWidth|right|createPlaceholder|addClass|refreshItems|disabled|connectWith|offsetWidth|offsetHeight|do|dropOnEmpty|toArray|serialize|extend|visibility|dragging|out|500|animate|dropBehaviour|down|direction|px|style|contactContainers|type|intersectsWithEdge|convertPositionTo|mouseDrag|round|marginBottom|scrollHeight|max|marginRight|bottom|parents|handle|abs|intersectsWith|div|removeData|toleranceElement|instance|refresh|pointer|id|attr|expression|key|relative|compareDocumentPosition|contains|browser|jQuery|1000|input|cancel|delay|distance|defaults|getter|cancelHelperRemoval|deactivate|receive|50|hide|drop|mouseStop|setTimeout|after|before|append|drag|break|up|dynamic|semi|next|prepareOffsets|current|activate|hidden|scrollWidth|marginTop|marginLeft|both|apply|typeof|mouseStart|andSelf|find|static|mouseCapture|10000|String|constructor|mouseDestroy|unbind|removeClass|destroy|join|_|match|attribute|triggerHandler|sender|absolutePosition|plugins|mouseInit|fixed|float|init|mouse|widget|522|version|safari'.split('|'),0,{}))
-
+(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
index de954b051560e22825ec85e01237cacd6d4827df..137270e23943c6df9bb7ffcfb7e774e6f42c6d31 100644 (file)
@@ -1,2 +1,2 @@
-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.39("8.3",{38:4(){2.c.v+=".3";2.1e(1c)},37:4(B,C){5((/^7/).1Z(B)){2.16(C)}n{2.c[B]=C;2.1e()}},i:4(){f 2.$3.i},1E:4(B){f B.24&&B.24.13(/\\s/g,"23").13(/[^A-36-35-9\\-23:\\.]/g,"")||2.c.1Q+A.e(B)},8:4(C,B){f{c:2.c,34:C,1M:B}},1e:4(O){2.$h=A("1i:33(a[o])",2.l);2.$3=2.$h.1s(4(){f A("a",2)[0]});2.$b=A([]);6 P=2,D=2.c;2.$3.V(4(R,Q){5(Q.u&&Q.u.13("#","")){P.$b=P.$b.1b(Q.u)}n{5(A(Q).12("o")!="#"){A.e(Q,"o.3",Q.o);A.e(Q,"q.3",Q.o);6 T=P.1E(Q);Q.o="#"+T;6 S=A("#"+T);5(!S.i){S=A(D.1x).12("1f",T).m(D.18).32(P.$b[R-1]||P.l);S.e("1a.3",1c)}P.$b=P.$b.1b(S)}n{D.d.1U(R+1)}}});5(O){2.l.m(D.1w);2.$b.V(4(){6 Q=A(2);Q.m(D.18)});5(D.7===1p){5(1J.u){2.$3.V(4(S,Q){5(Q.u==1J.u){D.7=S;5(A.W.1g||A.W.31){6 R=A(1J.u),T=R.12("1f");R.12("1f","");1z(4(){R.12("1f",T)},30)}2Z(0,0);f p}})}n{5(D.Y){6 J=2Y(A.Y("8-3"+A.e(P.l)),10);5(J&&P.$3[J]){D.7=J}}n{5(P.$h.z("."+D.k).i){D.7=P.$h.Z(P.$h.z("."+D.k)[0])}}}}D.7=D.7===j||D.7!==1p?D.7:0;D.d=A.2X(D.d.2W(A.1s(2.$h.z("."+D.U),4(R,Q){f P.$h.Z(R)}))).1T();5(A.1r(D.7,D.d)!=-1){D.d.2V(A.1r(D.7,D.d),1)}2.$b.m(D.w);2.$h.r(D.k);5(D.7!==j){2.$b.t(D.7).1G().r(D.w);2.$h.t(D.7).m(D.k);6 K=4(){A(P.l).y("20",[j,P.8(P.$3[D.7],P.$b[D.7])],D.1G)};5(A.e(2.$3[D.7],"q.3")){2.q(D.7,K)}n{K()}}A(2U).15("2T",4(){P.$3.14(".3");P.$h=P.$3=P.$b=j})}2S(6 G=0,N;N=2.$h[G];G++){A(N)[A.1r(G,D.d)!=-1&&!A(N).11(D.k)?"m":"r"](D.U)}5(D.x===p){2.$3.1m("x.3")}6 C,I,B={"2R-2Q":0,1I:1},E="2P";5(D.X&&D.X.2O==2N){C=D.X[0]||B,I=D.X[1]||B}n{C=I=D.X||B}6 H={1q:"",2M:"",2L:""};5(!A.W.1g){H.1H=""}4 M(R,Q,S){Q.22(C,C.1I||E,4(){Q.m(D.w).1d(H);5(A.W.1g&&C.1H){Q[0].21.z=""}5(S){L(R,S,Q)}})}4 L(R,S,Q){5(I===B){S.1d("1q","1D")}S.22(I,I.1I||E,4(){S.r(D.w).1d(H);5(A.W.1g&&I.1H){S[0].21.z=""}A(P.l).y("20",[j,P.8(R,S[0])],D.1G)})}4 F(R,T,Q,S){T.m(D.k).2K().r(D.k);M(R,Q,S)}2.$3.14(".3").15(D.v,4(){6 T=A(2).2J("1i:t(0)"),Q=P.$b.z(":2I"),S=A(2.u);5((T.11(D.k)&&!D.1h)||T.11(D.U)||A(2).11(D.17)||A(P.l).y("2H",[j,P.8(2,S[0])],D.16)===p){2.1t();f p}P.c.7=P.$3.Z(2);5(D.1h){5(T.11(D.k)){P.c.7=j;T.r(D.k);P.$b.1F();M(2,Q);2.1t();f p}n{5(!Q.i){P.$b.1F();6 R=2;P.q(P.$3.Z(2),4(){T.m(D.k).m(D.1v);L(R,S)});2.1t();f p}}}5(D.Y){A.Y("8-3"+A.e(P.l),P.c.7,D.Y)}P.$b.1F();5(S.i){6 R=2;P.q(P.$3.Z(2),Q.i?4(){F(R,T,Q,S)}:4(){T.m(D.k);L(R,S)})}n{2G"1K 2F 2E: 2D 2C 2B."}5(A.W.1g){2.1t()}f p});5(!(/^1y/).1Z(D.v)){2.$3.15("1y.3",4(){f p})}},1b:4(E,D,C){5(C==1p){C=2.$3.i}6 G=2.c;6 I=A(G.1P.13(/#\\{o\\}/g,E).13(/#\\{1j\\}/g,D));I.e("1a.3",1c);6 H=E.2A("#")==0?E.13("#",""):2.1E(A("a:2z-2y",I)[0]);6 F=A("#"+H);5(!F.i){F=A(G.1x).12("1f",H).m(G.w).e("1a.3",1c)}F.m(G.18);5(C>=2.$h.i){I.1Y(2.l);F.1Y(2.l[0].2x)}n{I.1X(2.$h[C]);F.1X(2.$b[C])}G.d=A.1s(G.d,4(K,J){f K>=C?++K:K});2.1e();5(2.$3.i==1){I.m(G.k);F.r(G.w);6 B=A.e(2.$3[0],"q.3");5(B){2.q(C,B)}}2.l.y("2w",[j,2.8(2.$3[C],2.$b[C])],G.1b)},19:4(B){6 D=2.c,E=2.$h.t(B).19(),C=2.$b.t(B).19();5(E.11(D.k)&&2.$3.i>1){2.16(B+(B+1<2.$3.i?1:-1))}D.d=A.1s(A.1W(D.d,4(G,F){f G!=B}),4(G,F){f G>=B?--G:G});2.1e();2.l.y("2v",[j,2.8(E.1C("a")[0],C[0])],D.19)},1V:4(B){6 C=2.c;5(A.1r(B,C.d)==-1){f}6 D=2.$h.t(B).r(C.U);5(A.W.2u){D.1d("1q","2t-1D");1z(4(){D.1d("1q","1D")},0)}C.d=A.1W(C.d,4(F,E){f F!=B});2.l.y("2s",[j,2.8(2.$3[B],2.$b[B])],C.1V)},1S:4(C){6 B=2,D=2.c;5(C!=D.7){2.$h.t(C).m(D.U);D.d.1U(C);D.d.1T();2.l.y("2r",[j,2.8(2.$3[C],2.$b[C])],D.1S)}},16:4(B){5(2q B=="2p"){B=2.$3.Z(2.$3.z("[o$="+B+"]")[0])}2.$3.t(B).2o(2.c.v)},q:4(G,K){6 L=2,D=2.c,E=2.$3.t(G),J=E[0],H=K==1p||K===p,B=E.e("q.3");K=K||4(){};5(!B||!H&&A.e(J,"x.3")){K();f}6 M=4(N){6 O=A(N),P=O.1C("*:2n");f P.i&&P||O};6 C=4(){L.$3.z("."+D.17).r(D.17).V(4(){5(D.1l){M(2).2m().1o(M(2).e("1j.3"))}});L.1n=j};5(D.1l){6 I=M(J).1o();M(J).2l("<1B></1B>").1C("1B").e("1j.3",I).1o(D.1l)}6 F=A.1L({},D.1k,{1R:B,1A:4(O,N){A(J.u).1o(O);C();5(D.x){A.e(J,"x.3",1c)}A(L.l).y("2k",[j,L.8(L.$3[G],L.$b[G])],D.q);D.1k.1A&&D.1k.1A(O,N);K()}});5(2.1n){2.1n.2j();C()}E.m(D.17);1z(4(){L.1n=A.2i(F)},0)},1R:4(C,B){2.$3.t(C).1m("x.3").e("q.3",B)},1a:4(){6 B=2.c;2.l.14(".3").r(B.1w).1m("3");2.$3.V(4(){6 C=A.e(2,"o.3");5(C){2.o=C}6 D=A(2).14(".3");A.V(["o","q","x"],4(E,F){D.1m(F+".3")})});2.$h.1b(2.$b).V(4(){5(A.e(2,"1a.3")){A(2).19()}n{A(2).r([B.k,B.1v,B.U,B.18,B.w].2h(" "))}})}});A.8.3.2g={1h:p,v:"1y",d:[],Y:j,1l:"2f&#2e;",x:p,1Q:"8-3-",1k:{},X:j,1P:\'<1i><a o="#{o}"><1O>#{1j}</1O></a></1i>\',1x:"<1N></1N>",1w:"8-3-2d",k:"8-3-7",1v:"8-3-1h",U:"8-3-d",18:"8-3-1M",w:"8-3-2c",17:"8-3-2b"};A.8.3.2a="i";A.1L(A.8.3.29,{1u:j,28:4(C,F){F=F||p;6 B=2,E=2.c.7;4 G(){B.1u=27(4(){E=++E<B.$3.i?E:0;B.16(E)},C)}4 D(H){5(!H||H.26){25(B.1u)}}5(C){G();5(!F){2.$3.15(2.c.v,D)}n{2.$3.15(2.c.v,4(){D();E=B.c.7;G()})}}n{D();2.$3.14(2.c.v,D)}}})})(1K)',62,196,'||this|tabs|function|if|var|selected|ui|||panels|options|disabled|data|return||lis|length|null|selectedClass|element|addClass|else|href|false|load|removeClass||eq|hash|event|hideClass|cache|triggerHandler|filter|||||||||||||||||||||disabledClass|each|browser|fx|cookie|index||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|rotation|unselectClass|navClass|panelTemplate|click|setTimeout|success|em|find|block|tabId|stop|show|opacity|duration|location|jQuery|extend|panel|div|span|tabTemplate|idPrefix|url|disable|sort|push|enable|grep|insertBefore|appendTo|test|tabsshow|style|animate|_|title|clearInterval|clientX|setInterval|rotate|prototype|getter|loading|hide|nav|8230|Loading|defaults|join|ajax|abort|tabsload|wrapInner|parent|last|trigger|string|typeof|tabsdisable|tabsenable|inline|safari|tabsremove|tabsadd|parentNode|child|first|indexOf|identifier|fragment|Mismatching|Tabs|UI|throw|tabsselect|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,{}))
+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,{}))
 
 
index 90b0e7ef63368c0b2431604796834ec10fa4e482..da1405594918167c7521b364af5a7d801d0151b0 100644 (file)
@@ -387,3 +387,196 @@ function edInsertImage(myField) {
                edInsertContent(myField, myValue);
        }
 }
                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);
+
+};
index 75ce85c5c69e499447e5337943d7382332600fba..fccaf71cd48b3a1a51ef5dfcc7f8509bfc8a78dc 100644 (file)
@@ -35,6 +35,7 @@ function prepareMediaItem(fileObj, serverData) {
        jQuery('#media-item-' + fileObj.id + ' .bar').remove();
        jQuery('#media-item-' + fileObj.id + ' .progress').hide();
 
        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);
        // Old style: Append the HTML returned by the server -- thumbnail and form inputs
        if ( isNaN(serverData) || !serverData ) {
                jQuery('#media-item-' + fileObj.id).append(serverData);
@@ -42,7 +43,7 @@ function prepareMediaItem(fileObj, serverData) {
        }
        // New style: server data is just the attachment ID, fetch the thumbnail and form html from the server
        else {
        }
        // 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:1}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
+               jQuery('#media-item-' + fileObj.id).load('async-upload.php', {attachment_id:serverData, fetch:f}, function(){prepareMediaItemInit(fileObj);updateMediaForm()});
        }
 }
                
        }
 }
                
@@ -55,7 +56,7 @@ function prepareMediaItemInit(fileObj) {
        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 + ' .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(){window.scrollTo(0,this.parentNode.offsetTop);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
+       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(){
 
        // Bind AJAX to the new Delete button
        jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){
@@ -118,6 +119,7 @@ function deleteError(X, textStatus, errorThrown) {
 }
 
 function updateMediaForm() {
 }
 
 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();
        // 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();
@@ -204,6 +206,19 @@ function fileDialogComplete(num_files_queued) {
        }
 }
 
        }
 }
 
+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 ) {
 function uploadError(fileObj, error_code, message) {
        // first the file specific error
        if ( error_code == SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL ) {
@@ -233,3 +248,40 @@ function uploadError(fileObj, error_code, message) {
                wpQueueError(swfuploadL10n.security_error);
        }
 }
                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);
index 4d41612df38e663269d12377e97be761e67eeec9..dd3b78bbcfcda95ac77f4940db4b9d392b4dda09 100644 (file)
@@ -8,42 +8,45 @@
 
 var SWFUpload;
 if (typeof(SWFUpload) === "function") {
 
 var SWFUpload;
 if (typeof(SWFUpload) === "function") {
-       SWFUpload.prototype.initSettings = function (old_initSettings) {
-               return function (init_settings) {
-                       if (typeof(old_initSettings) === "function") {
-                               old_initSettings.call(this, init_settings);
+       SWFUpload.prototype.initSettings = function (oldInitSettings) {
+               return function () {
+                       if (typeof(oldInitSettings) === "function") {
+                               oldInitSettings.call(this);
                        }
                        
                        this.refreshCookies(false);     // The false parameter must be sent since SWFUpload has not initialzed at this point
                };
        }(SWFUpload.prototype.initSettings);
        
                        }
                        
                        this.refreshCookies(false);     // The false parameter must be sent since SWFUpload has not initialzed at this point
                };
        }(SWFUpload.prototype.initSettings);
        
-       // refreshes the post_params and updates SWFUpload.  The send_to_flash parameters is optional and defaults to True
-       SWFUpload.prototype.refreshCookies = function (send_to_flash) {
-               if (send_to_flash !== false) send_to_flash = true;
+       // refreshes the post_params and updates SWFUpload.  The sendToFlash parameters is optional and defaults to True
+       SWFUpload.prototype.refreshCookies = function (sendToFlash) {
+               if (sendToFlash === undefined) {
+                       sendToFlash = true;
+               }
+               sendToFlash = !!sendToFlash;
                
                // Get the post_params object
                
                // Get the post_params object
-               var post_params = this.getSetting("post_params");
+               var postParams = this.settings.post_params;
                
                // Get the cookies
                
                // Get the cookies
-               var i, cookie_array = document.cookie.split(';'), ca_length = cookie_array.length, c, eq_index, name, value;
-               for(i = 0; i < ca_length; i++) {
-                       c = cookie_array[i];
+               var i, cookieArray = document.cookie.split(';'), caLength = cookieArray.length, c, eqIndex, name, value;
+               for (i = 0; i < caLength; i++) {
+                       c = cookieArray[i];
                        
                        // Left Trim spaces
                        
                        // Left Trim spaces
-                       while (c.charAt(0) == " ") {
+                       while (c.charAt(0) === " ") {
                                c = c.substring(1, c.length);
                        }
                                c = c.substring(1, c.length);
                        }
-                       eq_index = c.indexOf("=");
-                       if (eq_index > 0) {
-                               name = c.substring(0, eq_index);
-                               value = c.substring(eq_index+1);
-                               post_params[name] = value;
+                       eqIndex = c.indexOf("=");
+                       if (eqIndex > 0) {
+                               name = c.substring(0, eqIndex);
+                               value = c.substring(eqIndex + 1);
+                               postParams[name] = value;
                        }
                }
                
                        }
                }
                
-               if (send_to_flash) {
-                       this.setPostParams(post_params);
+               if (sendToFlash) {
+                       this.setPostParams(postParams);
                }
        };
 
                }
        };
 
index 9752e282d265299b9963cbc8c1a2be8d90ac8068..b04d87acf4ad70554db770b32405256794dbe9f3 100644 (file)
@@ -2,9 +2,12 @@
        Queue Plug-in
        
        Features:
        Queue Plug-in
        
        Features:
-               cancelQueue method for cancelling the entire queue.
-               All queued files are uploaded when startUpload() is called.
-               If false is returned from uploadComplete then the queue upload is stopped.  If false is not returned (strict comparison) then the queue upload is continued.
+               *Adds a cancelQueue() method for cancelling the entire queue.
+               *All queued files are uploaded when startUpload() is called.
+               *If false is returned from uploadComplete then the queue upload is stopped.
+                If false is not returned (strict comparison) then the queue upload is continued.
+               *Adds a QueueComplete event that is fired when all the queued files have finished uploading.
+                Set the event handler with the queue_complete_handler setting.
                
        */
 
                
        */
 
@@ -12,47 +15,63 @@ var SWFUpload;
 if (typeof(SWFUpload) === "function") {
        SWFUpload.queue = {};
        
 if (typeof(SWFUpload) === "function") {
        SWFUpload.queue = {};
        
-       SWFUpload.prototype.initSettings = function (old_initSettings) {
-               return function (init_settings) {
-                       if (typeof(old_initSettings) === "function") {
-                               old_initSettings.call(this, init_settings);
+       SWFUpload.prototype.initSettings = (function (oldInitSettings) {
+               return function () {
+                       if (typeof(oldInitSettings) === "function") {
+                               oldInitSettings.call(this);
                        }
                        
                        this.customSettings.queue_cancelled_flag = false;
                        }
                        
                        this.customSettings.queue_cancelled_flag = false;
+                       this.customSettings.queue_upload_count = 0;
                        
                        
-                       this.addSetting("user_upload_complete_handler", init_settings.upload_complete_handler, SWFUpload.uploadComplete);
-                       this.uploadComplete_handler = SWFUpload.queue.uploadComplete;
+                       this.settings.user_upload_complete_handler = this.settings.upload_complete_handler;
+                       this.settings.upload_complete_handler = SWFUpload.queue.uploadCompleteHandler;
+                       
+                       this.settings.queue_complete_handler = this.settings.queue_complete_handler || null;
                };
                };
-       }(SWFUpload.prototype.initSettings);
+       })(SWFUpload.prototype.initSettings);
 
 
-       SWFUpload.prototype.cancelQueue = function () {
-               var stats = this.getStats();
+       SWFUpload.prototype.startUpload = function (fileID) {
                this.customSettings.queue_cancelled_flag = false;
                this.customSettings.queue_cancelled_flag = false;
+               this.callFlash("StartUpload", false, [fileID]);
+       };
 
 
-               if (stats.in_progress > 0) {
-                       this.customSettings.queue_cancelled_flag = true;
-               }
+       SWFUpload.prototype.cancelQueue = function () {
+               this.customSettings.queue_cancelled_flag = true;
+               this.stopUpload();
                
                
-               while(stats.files_queued > 0) {
+               var stats = this.getStats();
+               while (stats.files_queued > 0) {
                        this.cancelUpload();
                        stats = this.getStats();
                }
        };
        
                        this.cancelUpload();
                        stats = this.getStats();
                }
        };
        
-       SWFUpload.queue.uploadComplete = function (file) {
-               var user_upload_complete_handler = this.getSetting("user_upload_complete_handler");
-               var continue_upload = true;
+       SWFUpload.queue.uploadCompleteHandler = function (file) {
+               var user_upload_complete_handler = this.settings.user_upload_complete_handler;
+               var continueUpload;
+               
+               if (file.filestatus === SWFUpload.FILE_STATUS.COMPLETE) {
+                       this.customSettings.queue_upload_count++;
+               }
+
                if (typeof(user_upload_complete_handler) === "function") {
                if (typeof(user_upload_complete_handler) === "function") {
-                       continue_upload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+                       continueUpload = (user_upload_complete_handler.call(this, file) === false) ? false : true;
+               } else {
+                       continueUpload = true;
                }
                
                }
                
-               if (continue_upload) {
+               if (continueUpload) {
                        var stats = this.getStats();
                        if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
                                this.startUpload();
                        var stats = this.getStats();
                        if (stats.files_queued > 0 && this.customSettings.queue_cancelled_flag === false) {
                                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 {
                                this.customSettings.queue_cancelled_flag = false;
                        } else {
                                this.customSettings.queue_cancelled_flag = false;
+                               this.customSettings.queue_upload_count = 0;
                        }
                }
        };
                        }
                }
        };
-}
+}
\ No newline at end of file
diff --git a/wp-includes/js/swfupload/plugins/swfupload.swfobject.js b/wp-includes/js/swfupload/plugins/swfupload.swfobject.js
new file mode 100644 (file)
index 0000000..9d6c3d8
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+       SWFUpload.SWFObject Plugin
+
+       Summary:
+               This plugin uses SWFObject to embed SWFUpload dynamically in the page.  SWFObject provides accurate Flash Player detection and DOM Ready loading.
+               This plugin replaces the Graceful Degradation plugin.
+
+       Features:
+               * swfupload_load_failed_hander event
+               * swfupload_pre_load_handler event
+               * minimum_flash_version setting (default: "9.0.28")
+               * SWFUpload.onload event for early loading
+
+       Usage:
+               Provide handlers and settings as needed.  When using the SWFUpload.SWFObject plugin you should initialize SWFUploading
+               in SWFUpload.onload rather than in window.onload.  When initialized this way SWFUpload can load earlier preventing the UI flicker
+               that was seen using the Graceful Degradation plugin.
+
+               <script type="text/javascript">
+                       var swfu;
+                       SWFUpload.onload = function () {
+                               swfu = new SWFUpload({
+                                       minimum_flash_version: "9.0.28",
+                                       swfupload_pre_load_handler: swfuploadPreLoad,
+                                       swfupload_load_failed_handler: swfuploadLoadFailed
+                               });
+                       };
+               </script>
+               
+       Notes:
+               You must provide set minimum_flash_version setting to "8" if you are using SWFUpload for Flash Player 8.
+               The swfuploadLoadFailed event is only fired if the minimum version of Flash Player is not met.  Other issues such as missing SWF files, browser bugs
+                or corrupt Flash Player installations will not trigger this event.
+               The swfuploadPreLoad event is fired as soon as the minimum version of Flash Player is found.  It does not wait for SWFUpload to load and can
+                be used to prepare the SWFUploadUI and hide alternate content.
+               swfobject's onDomReady event is cross-browser safe but will default to the window.onload event when DOMReady is not supported by the browser.
+                Early DOM Loading is supported in major modern browsers but cannot be guaranteed for every browser ever made.
+*/
+
+
+/*     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}}}}}();
+
+       
+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 (oldInitSettings) {
+               return function () {
+                       if (typeof(oldInitSettings) === "function") {
+                               oldInitSettings.call(this);
+                       }
+
+                       this.ensureDefault = function (settingName, defaultValue) {
+                               this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
+                       };
+
+                       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 (oldLoadFlash) {
+               return function () {
+                       var hasFlash = swfobject.hasFlashPlayerVersion(this.settings.minimum_flash_version);
+                       
+                       if (hasFlash) {
+                               this.queueEvent("swfupload_pre_load_handler");
+                               if (typeof(oldLoadFlash) === "function") {
+                                       oldLoadFlash.call(this);
+                               }
+                       } else {
+                               this.queueEvent("swfupload_load_failed_handler");
+                       }
+               };
+               
+       }(SWFUpload.prototype.loadFlash);
+                       
+       SWFUpload.prototype.displayDebugInfo = function (oldDisplayDebugInfo) {
+               return function () {
+                       if (typeof(oldDisplayDebugInfo) === "function") {
+                               oldDisplayDebugInfo.call(this);
+                       }
+                       
+                       this.debug(
+                               [
+                                       "SWFUpload.SWFObject Plugin settings:", "\n",
+                                       "\t", "minimum_flash_version:                      ", this.settings.minimum_flash_version, "\n",
+                                       "\t", "swfupload_pre_load_handler assigned:     ", (typeof(this.settings.swfupload_pre_load_handler) === "function").toString(), "\n",
+                                       "\t", "swfupload_load_failed_handler assigned:     ", (typeof(this.settings.swfupload_load_failed_handler) === "function").toString(), "\n",
+                               ].join("")
+                       );
+               };      
+       }(SWFUpload.prototype.displayDebugInfo);
+}
index 583876f2a7dad9413de5f1be557809cdab5d2ace..849cf28e6bb59ece00d509b1eadd34ad5c3dbc62 100644 (file)
@@ -1,41 +1,32 @@
 /**
 /**
- * SWFUpload v2.0 by Jacob Roberts, Nov 2007, http://www.swfupload.org, http://linebyline.blogspot.com
- * -------- -------- -------- -------- -------- -------- -------- --------
- * SWFUpload is (c) 2006 Lars Huring and Mammon Media and is released under the MIT License:
+ * SWFUpload: http://www.swfupload.org, http://swfupload.googlecode.com
+ *
+ * mmSWFUpload 1.0: Flash upload dialog - http://profandesign.se/swfupload/,  http://www.vinterwebb.se/
+ *
+ * SWFUpload is (c) 2006-2007 Lars Huring, Olov Nilzén and Mammon Media and is released under the MIT License:
  * http://www.opensource.org/licenses/mit-license.php
  *
  * http://www.opensource.org/licenses/mit-license.php
  *
- * See Changelog.txt for version history
+ * SWFUpload 2 is (c) 2007-2008 Jake Roberts and is released under the MIT License:
+ * http://www.opensource.org/licenses/mit-license.php
  *
  *
- * Development Notes:
- *  * This version of SWFUpload requires Flash Player 9.0.28 and should autodetect the correct flash version.
- *  * In Linux Flash Player 9 setting the post file variable name does not work. It is always set to "Filedata".
- *  * There is a lot of repeated code that could be refactored to single functions.  Feel free.
- *  * It's dangerous to do "circular calls" between Flash and JavaScript. I've taken steps to try to work around issues
- *     by having the event calls pipe through setTimeout.  However you should still avoid calling in to Flash from
- *     within the event handler methods.  Especially the "startUpload" event since it cannot use the setTimeout hack.
  */
 
 
  */
 
 
-/* *********** */
-/* Constructor */
-/* *********** */
-
-var SWFUpload = function (init_settings) {
-       this.initSWFUpload(init_settings);
-};
-
-SWFUpload.prototype.initSWFUpload = function (init_settings) {
-       // Remove background flicker in IE (read this: http://misterpixel.blogspot.com/2006/09/forensic-analysis-of-ie6.html)
-       // This doesn't have anything to do with SWFUpload but can help your UI behave better in IE.
-       try {
-               document.execCommand('BackgroundImageCache', false, true);
-       } catch (ex1) {
-       }
+/* ******************* */
+/* Constructor & Init  */
+/* ******************* */
+var SWFUpload;
 
 
+if (SWFUpload == undefined) {
+       SWFUpload = function (settings) {
+               this.initSWFUpload(settings);
+       };
+}
 
 
+SWFUpload.prototype.initSWFUpload = function (settings) {
        try {
                this.customSettings = {};       // A container where developers can place their own settings associated with this instance.
        try {
                this.customSettings = {};       // A container where developers can place their own settings associated with this instance.
-               this.settings = {};
+               this.settings = settings;
                this.eventQueue = [];
                this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
                this.movieElement = null;
                this.eventQueue = [];
                this.movieName = "SWFUpload_" + SWFUpload.movieCount++;
                this.movieElement = null;
@@ -44,21 +35,21 @@ SWFUpload.prototype.initSWFUpload = function (init_settings) {
                SWFUpload.instances[this.movieName] = this;
 
                // Load the settings.  Load the Flash movie.
                SWFUpload.instances[this.movieName] = this;
 
                // Load the settings.  Load the Flash movie.
-               this.initSettings(init_settings);
+               this.initSettings();
                this.loadFlash();
                this.loadFlash();
-
                this.displayDebugInfo();
                this.displayDebugInfo();
-
-       } catch (ex2) {
-               this.debug(ex2);
+       } catch (ex) {
+               delete SWFUpload.instances[this.movieName];
+               throw ex;
        }
        }
-}
+};
 
 /* *************** */
 
 /* *************** */
-/* Static thingies */
+/* Static Members  */
 /* *************** */
 SWFUpload.instances = {};
 SWFUpload.movieCount = 0;
 /* *************** */
 SWFUpload.instances = {};
 SWFUpload.movieCount = 0;
+SWFUpload.version = "2.2.0 Beta 2";
 SWFUpload.QUEUE_ERROR = {
        QUEUE_LIMIT_EXCEEDED                    : -100,
        FILE_EXCEEDS_SIZE_LIMIT                 : -110,
 SWFUpload.QUEUE_ERROR = {
        QUEUE_LIMIT_EXCEEDED                    : -100,
        FILE_EXCEEDS_SIZE_LIMIT                 : -110,
@@ -84,910 +75,787 @@ SWFUpload.FILE_STATUS = {
        COMPLETE         : -4,
        CANCELLED        : -5
 };
        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"
+};
 
 
+/* ******************** */
+/* Instance Members  */
+/* ******************** */
 
 
-/* ***************** */
-/* Instance Thingies */
-/* ***************** */
-// init is a private method that ensures that all the object settings are set, getting a default value if one was not assigned.
-
-SWFUpload.prototype.initSettings = function (init_settings) {
+// Private: initSettings ensures that all the
+// settings are set, getting a default value if one was not assigned.
+SWFUpload.prototype.initSettings = function () {
+       this.ensureDefault = function (settingName, defaultValue) {
+               this.settings[settingName] = (this.settings[settingName] == undefined) ? defaultValue : this.settings[settingName];
+       };
+       
        // Upload backend settings
        // Upload backend settings
-       this.addSetting("upload_url",                           init_settings.upload_url,                               "");
-       this.addSetting("file_post_name",                       init_settings.file_post_name,                   "Filedata");
-       this.addSetting("post_params",                          init_settings.post_params,                              {});
-
+       this.ensureDefault("upload_url", "");
+       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", []);
+       
        // File Settings
        // File Settings
-       this.addSetting("file_types",                           init_settings.file_types,                               "*.*");
-       this.addSetting("file_types_description",       init_settings.file_types_description,   "All Files");
-       this.addSetting("file_size_limit",                      init_settings.file_size_limit,                  "1024");
-       this.addSetting("file_upload_limit",            init_settings.file_upload_limit,                "0");
-       this.addSetting("file_queue_limit",                     init_settings.file_queue_limit,                 "0");
+       this.ensureDefault("file_types", "*.*");
+       this.ensureDefault("file_types_description", "All Files");
+       this.ensureDefault("file_size_limit", 0);       // Default zero means "unlimited"
+       this.ensureDefault("file_upload_limit", 0);
+       this.ensureDefault("file_queue_limit", 0);
 
        // Flash Settings
 
        // Flash Settings
-       this.addSetting("flash_url",                            init_settings.flash_url,                                "swfupload.swf");
-       this.addSetting("flash_width",                          init_settings.flash_width,                              "1px");
-       this.addSetting("flash_height",                         init_settings.flash_height,                             "1px");
-       this.addSetting("flash_color",                          init_settings.flash_color,                              "#FFFFFF");
-
+       this.ensureDefault("flash_url", "swfupload.swf");
+       this.ensureDefault("prevent_swf_caching", true);
+       
+       // Button Settings
+       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", null);
+       this.ensureDefault("button_cursor", SWFUpload.CURSOR.ARROW);
+       this.ensureDefault("button_window_mode", SWFUpload.WINDOW_MODE.WINDOW);
+       
        // Debug Settings
        // Debug Settings
-       this.addSetting("debug_enabled", init_settings.debug,  false);
-
+       this.ensureDefault("debug", false);
+       this.settings.debug_enabled = this.settings.debug;      // Here to maintain v2 API
+       
        // Event Handlers
        // Event Handlers
-       this.flashReady_handler         = SWFUpload.flashReady; // This is a non-overrideable event handler
-       this.swfUploadLoaded_handler    = this.retrieveSetting(init_settings.swfupload_loaded_handler,      SWFUpload.swfUploadLoaded);
+       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.fileDialogStart_handler    = this.retrieveSetting(init_settings.file_dialog_start_handler,         SWFUpload.fileDialogStart);
-       this.fileQueued_handler                 = this.retrieveSetting(init_settings.file_queued_handler,                       SWFUpload.fileQueued);
-       this.fileQueueError_handler             = this.retrieveSetting(init_settings.file_queue_error_handler,          SWFUpload.fileQueueError);
-       this.fileDialogComplete_handler = this.retrieveSetting(init_settings.file_dialog_complete_handler,      SWFUpload.fileDialogComplete);
+       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.uploadStart_handler                = this.retrieveSetting(init_settings.upload_start_handler,                      SWFUpload.uploadStart);
-       this.uploadProgress_handler             = this.retrieveSetting(init_settings.upload_progress_handler,           SWFUpload.uploadProgress);
-       this.uploadError_handler                = this.retrieveSetting(init_settings.upload_error_handler,                      SWFUpload.uploadError);
-       this.uploadSuccess_handler              = this.retrieveSetting(init_settings.upload_success_handler,            SWFUpload.uploadSuccess);
-       this.uploadComplete_handler             = this.retrieveSetting(init_settings.upload_complete_handler,           SWFUpload.uploadComplete);
+       this.ensureDefault("debug_handler", this.debugMessage);
 
 
-       this.debug_handler                              = this.retrieveSetting(init_settings.debug_handler,                                     SWFUpload.debug);
+       this.ensureDefault("custom_settings", {});
 
        // Other settings
 
        // Other settings
-       this.customSettings = this.retrieveSetting(init_settings.custom_settings, {});
+       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);
+       }
+       
+       delete this.ensureDefault;
 };
 
 };
 
-// loadFlash is a private method that generates the HTML tag for the Flash
-// It then adds the flash to the "target" or to the body and stores a
-// reference to the flash element in "movieElement".
 SWFUpload.prototype.loadFlash = function () {
 SWFUpload.prototype.loadFlash = function () {
-       var html, target_element, container;
+       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) {
 
        // Make sure an element with the ID we are going to use doesn't already exist
        if (document.getElementById(this.movieName) !== null) {
-               return false;
+               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
        }
 
        // Get the body tag where we will be adding the flash movie
-       try {
-               target_element = document.getElementsByTagName("body")[0];
-               if (typeof(target_element) === "undefined" || target_element === null) {
-                       this.debug('Could not find the BODY element. SWFUpload failed to load.');
-                       return false;
-               }
-       } catch (ex) {
-               return false;
+       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");
        }
 
        // Append the container and load the flash
        container = document.createElement("div");
-       container.style.width = this.getSetting("flash_width");
-       container.style.height = this.getSetting("flash_height");
+       container.style.width = "1px";
+       container.style.height = "1px";
+       container.style.overflow = "hidden";
 
 
-       target_element.appendChild(container);
+       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)
 };
 
        container.innerHTML = this.getFlashHTML();      // Using innerHTML is non-standard but the only sensible way to dynamically add Flash in IE (and maybe other browsers)
 };
 
-// Generates the embed/object tags needed to embed the flash in to the document
-SWFUpload.prototype.getFlashHTML = function () {
-       var html = "";
+// Private: replaceWithFlash replaces the button_placeholder element with the flash movie.
+SWFUpload.prototype.replaceWithFlash = function () {
+       var targetElement, tempParent;
 
 
-       // Create Mozilla Embed HTML
-       if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
-               // Build the basic embed html
-               html = '<embed type="application/x-shockwave-flash" src="' + this.getSetting("flash_url") + '" width="' + this.getSetting("flash_width") + '" height="' + this.getSetting("flash_height") + '"';
-               html += ' id="' + this.movieName + '" name="' + this.movieName + '" ';
-               html += 'bgcolor="' + this.getSetting("flash_color") + '" quality="high" menu="false" flashvars="';
-
-               html += this.getFlashVars();
-
-               html += '" />';
-
-               // Create IE Object HTML
-       } else {
-
-               // Build the basic Object tag
-               html = '<object id="' + this.movieName + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="' + this.getSetting("flash_width") + '" height="' + this.getSetting("flash_height") + '">';
-               html += '<param name="movie" value="' + this.getSetting("flash_url") + '">';
+       // 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";
+       }
 
 
-               html += '<param name="bgcolor" value="' + this.getSetting("flash_color") + '" />';
-               html += '<param name="quality" value="high" />';
-               html += '<param name="menu" value="false" />';
+       // Get the element where we will be placing the flash movie
+       targetElement = document.getElementById(this.settings.button_placeholder_id);
 
 
-               html += '<param name="flashvars" value="' + this.getFlashVars() + '" />';
-               html += '</object>';
+       if (targetElement == undefined) {
+               throw "Could not find the placeholder element.";
        }
 
        }
 
-       return html;
+       // Append the container and load the flash
+       tempParent = document.createElement("div");
+       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);
+
 };
 
 };
 
-// This private method builds the parameter string that will be passed
-// to flash.
+// 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="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("");
+};
+
+// Private: getFlashVars builds the parameter string that will be passed
+// to flash in the flashvars param.
 SWFUpload.prototype.getFlashVars = function () {
        // Build a string from the post param object
 SWFUpload.prototype.getFlashVars = function () {
        // Build a string from the post param object
-       var param_string = this.buildParamString();
-
+       var paramString = this.buildParamString();
+       var httpSuccessString = this.settings.http_success.join(",");
+       
        // Build the parameter string
        // Build the parameter string
-       var html = "";
-       html += "movieName=" + encodeURIComponent(this.movieName);
-       html += "&uploadURL=" + encodeURIComponent(this.getSetting("upload_url"));
-       html += "&params=" + encodeURIComponent(param_string);
-       html += "&filePostName=" + encodeURIComponent(this.getSetting("file_post_name"));
-       html += "&fileTypes=" + encodeURIComponent(this.getSetting("file_types"));
-       html += "&fileTypesDescription=" + encodeURIComponent(this.getSetting("file_types_description"));
-       html += "&fileSizeLimit=" + encodeURIComponent(this.getSetting("file_size_limit"));
-       html += "&fileUploadLimit=" + encodeURIComponent(this.getSetting("file_upload_limit"));
-       html += "&fileQueueLimit=" + encodeURIComponent(this.getSetting("file_queue_limit"));
-       html += "&debugEnabled=" + encodeURIComponent(this.getSetting("debug_enabled"));
-
-       return html;
-};
-
+       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(httpSuccessString),
+                       "&amp;params=", encodeURIComponent(paramString),
+                       "&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("");
+};
+
+// Public: getMovieElement retrieves the DOM reference to the Flash element added by SWFUpload
+// The element is cached after the first lookup
 SWFUpload.prototype.getMovieElement = function () {
 SWFUpload.prototype.getMovieElement = function () {
-       if (typeof(this.movieElement) === "undefined" || this.movieElement === null) {
+       if (this.movieElement == undefined) {
                this.movieElement = document.getElementById(this.movieName);
                this.movieElement = document.getElementById(this.movieName);
-
-               // Fix IEs "Flash can't callback when in a form" issue (http://www.extremefx.com.ar/blog/fixing-flash-external-interface-inside-form-on-internet-explorer)
-               // Removed because Revision 6 always adds the flash to the body (inside a containing div)
-               // If you insist on adding the Flash file inside a Form then in IE you have to make you wait until the DOM is ready
-               // and run this code to make the form's ID available from the window object so Flash and JavaScript can communicate.
-               //if (typeof(window[this.movieName]) === "undefined" || window[this.moveName] !== this.movieElement) {
-               //      window[this.movieName] = this.movieElement;
-               //}
        }
 
        }
 
+       if (this.movieElement === null) {
+               throw "Could not find Flash element";
+       }
+       
        return this.movieElement;
 };
 
        return this.movieElement;
 };
 
+// Private: buildParamString takes the name/value pairs in the post_params setting object
+// and joins them up in to a string formatted "name=value&amp;name=value"
 SWFUpload.prototype.buildParamString = function () {
 SWFUpload.prototype.buildParamString = function () {
-       var post_params = this.getSetting("post_params");
-       var param_string_pairs = [];
-       var i, value, name;
-
-       // Retrieve the user defined parameters
-       if (typeof(post_params) === "object") {
-               for (name in post_params) {
-                       if (post_params.hasOwnProperty(name)) {
-                               if (typeof(post_params[name]) === "string") {
-                                       param_string_pairs.push(encodeURIComponent(name) + "=" + encodeURIComponent(post_params[name]));
-                               }
+       var postParams = this.settings.post_params; 
+       var paramStringPairs = [];
+
+       if (typeof(postParams) === "object") {
+               for (var name in postParams) {
+                       if (postParams.hasOwnProperty(name)) {
+                               paramStringPairs.push(encodeURIComponent(name.toString()) + "=" + encodeURIComponent(postParams[name].toString()));
                        }
                }
        }
 
                        }
                }
        }
 
-       return param_string_pairs.join("&");
+       return paramStringPairs.join("&amp;");
 };
 
 };
 
-// Saves a setting.     If the value given is undefined or null then the default_value is used.
-SWFUpload.prototype.addSetting = function (name, value, default_value) {
-       if (typeof(value) === "undefined" || value === null) {
-               this.settings[name] = default_value;
-       } else {
-               this.settings[name] = value;
+// 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.
+SWFUpload.prototype.destroy = function () {
+       try {
+               // Make sure Flash is done before we try to remove it
+               this.stopUpload();
+               
+               // Remove the SWFUpload DOM nodes
+               var movieElement = null;
+               try {
+                       movieElement = this.getMovieElement();
+               } catch (ex) {
+               }
+               
+               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);
+                               }
+                       }
+               }
+               
+               // Destroy references
+               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;
+               
+               delete window[this.movieName];
+               
+               return true;
+       } catch (ex1) {
+               return false;
        }
        }
-
-       return this.settings[name];
 };
 
 };
 
-// Gets a setting.     Returns empty string if not found.
-SWFUpload.prototype.getSetting = function (name) {
-       if (typeof(this.settings[name]) === "undefined") {
-               return "";
-       } else {
-               return this.settings[name];
+// Public: displayDebugInfo prints out settings and configuration
+// information about this SWFUpload instance.
+// This function (and any references to it) can be deleted when placing
+// SWFUpload in production.
+SWFUpload.prototype.displayDebugInfo = function () {
+       this.debug(
+               [
+                       "---SWFUpload Instance Info---\n",
+                       "Version: ", SWFUpload.version, "\n",
+                       "Movie Name: ", this.movieName, "\n",
+                       "Settings:\n",
+                       "\t", "upload_url:               ", this.settings.upload_url, "\n",
+                       "\t", "flash_url:                ", this.settings.flash_url, "\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", "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_types_description:   ", this.settings.file_types_description, "\n",
+                       "\t", "file_size_limit:          ", this.settings.file_size_limit, "\n",
+                       "\t", "file_upload_limit:        ", this.settings.file_upload_limit, "\n",
+                       "\t", "file_queue_limit:         ", this.settings.file_queue_limit, "\n",
+                       "\t", "debug:                    ", this.settings.debug.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_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_text:              ", this.settings.button_text.toString(), "\n",
+                       "\t", "button_text_style:        ", this.settings.button_text_style.toString(), "\n",
+                       "\t", "button_text_top_padding:  ", this.settings.button_text_top_padding.toString(), "\n",
+                       "\t", "button_text_left_padding: ", this.settings.button_text_left_padding.toString(), "\n",
+                       "\t", "button_action:            ", this.settings.button_action.toString(), "\n",
+                       "\t", "button_disabled:          ", this.settings.button_disabled.toString(), "\n",
+
+                       "\t", "custom_settings:          ", this.settings.custom_settings.toString(), "\n",
+                       "Event Handlers:\n",
+                       "\t", "swfupload_loaded_handler assigned:  ", (typeof this.settings.swfupload_loaded_handler === "function").toString(), "\n",
+                       "\t", "file_dialog_start_handler assigned: ", (typeof this.settings.file_dialog_start_handler === "function").toString(), "\n",
+                       "\t", "file_queued_handler assigned:       ", (typeof this.settings.file_queued_handler === "function").toString(), "\n",
+                       "\t", "file_queue_error_handler assigned:  ", (typeof this.settings.file_queue_error_handler === "function").toString(), "\n",
+                       "\t", "upload_start_handler assigned:      ", (typeof this.settings.upload_start_handler === "function").toString(), "\n",
+                       "\t", "upload_progress_handler assigned:   ", (typeof this.settings.upload_progress_handler === "function").toString(), "\n",
+                       "\t", "upload_error_handler assigned:      ", (typeof this.settings.upload_error_handler === "function").toString(), "\n",
+                       "\t", "upload_success_handler assigned:    ", (typeof this.settings.upload_success_handler === "function").toString(), "\n",
+                       "\t", "upload_complete_handler assigned:   ", (typeof this.settings.upload_complete_handler === "function").toString(), "\n",
+                       "\t", "debug_handler assigned:             ", (typeof this.settings.debug_handler === "function").toString(), "\n"
+               ].join("")
+       );
+};
+
+/* Note: addSetting and getSetting are no longer used by SWFUpload but are included
+       the maintain v2 API compatibility
+*/
+// Public: (Deprecated) addSetting adds a setting value. If the value given is undefined or null then the default_value is used.
+SWFUpload.prototype.addSetting = function (name, value, default_value) {
+    if (value == undefined) {
+        return (this.settings[name] = default_value);
+    } else {
+        return (this.settings[name] = value);
        }
 };
 
        }
 };
 
-// Gets a setting, if the setting is undefined then return the default value
-// This does not affect or use the interal setting object.
-SWFUpload.prototype.retrieveSetting = function (value, default_value) {
-       if (typeof(value) === "undefined" || value === null) {
-               return default_value;
-       } else {
-               return value;
+// Public: (Deprecated) getSetting gets a setting. Returns an empty string if the setting was not found.
+SWFUpload.prototype.getSetting = function (name) {
+    if (this.settings[name] != undefined) {
+        return this.settings[name];
        }
        }
-};
-
 
 
-// It loops through all the settings and displays
-// them in the debug Console.
-SWFUpload.prototype.displayDebugInfo = function () {
-       var key, debug_message = "";
-
-       debug_message += "----- SWFUPLOAD SETTINGS     ----\nID: " + this.moveName + "\n";
-
-       debug_message += this.outputObject(this.settings);
+    return "";
+};
 
 
-       debug_message += "----- SWFUPLOAD SETTINGS END ----\n";
-       debug_message += "\n";
 
 
-       this.debug(debug_message);
-};
-SWFUpload.prototype.outputObject = function (object, prefix) {
-       var output = "", key;
 
 
-       if (typeof(prefix) !== "string") {
-               prefix = "";
-       }
-       if (typeof(object) !== "object") {
-               return "";
-       }
+// Private: callFlash handles function calls made to the Flash element.
+// Calls are made with a setTimeout for some functions to work around
+// bugs in the ExternalInterface library.
+SWFUpload.prototype.callFlash = function (functionName, argumentArray) {
+       argumentArray = argumentArray || [];
+       
+       var movieElement = this.getMovieElement();
+       var returnValue;
 
 
-       for (key in object) {
-               if (object.hasOwnProperty(key)) {
-                       if (typeof(object[key]) === "object") {
-                               output += (prefix + key + ": { \n" + this.outputObject(object[key], "\t" + prefix) + prefix + "}" + "\n");
-                       } else {
-                               output += (prefix + key + ": " + object[key] + "\n");
-                       }
+       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;
        }
        }
-
-       return output;
 };
 
 };
 
+
 /* *****************************
        -- Flash control methods --
        Your UI should use these
        to operate SWFUpload
    ***************************** */
 
 /* *****************************
        -- Flash control methods --
        Your UI should use these
        to operate SWFUpload
    ***************************** */
 
+// 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
 SWFUpload.prototype.selectFile = function () {
 SWFUpload.prototype.selectFile = function () {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SelectFile) === "function") {
-               try {
-                       movie_element.SelectFile();
-               }
-               catch (ex) {
-                       this.debug("Could not call SelectFile: " + ex);
-               }
-       } else {
-               this.debug("Could not find Flash element");
-       }
-
+       this.callFlash("SelectFile");
 };
 
 };
 
+// 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
 SWFUpload.prototype.selectFiles = function () {
 SWFUpload.prototype.selectFiles = function () {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SelectFiles) === "function") {
-               try {
-                       movie_element.SelectFiles();
-               }
-               catch (ex) {
-                       this.debug("Could not call SelectFiles: " + ex);
-               }
-       } else {
-               this.debug("Could not find Flash element");
-       }
-
+       this.callFlash("SelectFiles");
 };
 
 
 };
 
 
-/* Start the upload.  If a file_id is specified that file is uploaded. Otherwise the first
- * file in the queue is uploaded.  If no files are in the queue then nothing happens.
- * This call uses setTimeout since Flash will be calling back in to JavaScript
- */
-SWFUpload.prototype.startUpload = function (file_id) {
-       var self = this;
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.StartUpload) === "function") {
-               setTimeout(
-                       function () {
-                               try {
-                                       movie_element.StartUpload(file_id);
-                               }
-                               catch (ex) {
-                                       self.debug("Could not call StartUpload: " + ex);
-                               }
-                       }, 0
-               );
-       } else {
-               this.debug("Could not find Flash element");
-       }
-
+// Public: startUpload starts uploading the first file in the queue unless
+// the optional parameter 'fileID' specifies the ID 
+SWFUpload.prototype.startUpload = function (fileID) {
+       this.callFlash("StartUpload", [fileID]);
 };
 
 };
 
-/* Cancels a the file upload.  You must specify a file_id */
-SWFUpload.prototype.cancelUpload = function (file_id) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.CancelUpload) === "function") {
-               try {
-                       movie_element.CancelUpload(file_id);
-               }
-               catch (ex) {
-                       this.debug("Could not call CancelUpload: " + ex);
-               }
-       } else {
-               this.debug("Could not find Flash element");
+// Public: cancelUpload cancels any queued file.  The fileID parameter may be the file ID or index.
+// If you do not specify a fileID the current uploading file or first file in the queue is cancelled.
+// If you do not want the uploadError event to trigger you can specify false for the triggerErrorEvent parameter.
+SWFUpload.prototype.cancelUpload = function (fileID, triggerErrorEvent) {
+       if (triggerErrorEvent !== false) {
+               triggerErrorEvent = true;
        }
        }
-
+       this.callFlash("CancelUpload", [fileID, triggerErrorEvent]);
 };
 
 };
 
-// Stops the current upload.  The file is re-queued.  If nothing is currently uploading then nothing happens.
+// Public: stopUpload stops the current upload and requeues the file at the beginning of the queue.
+// If nothing is currently uploading then nothing happens.
 SWFUpload.prototype.stopUpload = function () {
 SWFUpload.prototype.stopUpload = function () {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.StopUpload) === "function") {
-               try {
-                       movie_element.StopUpload();
-               }
-               catch (ex) {
-                       this.debug("Could not call StopUpload: " + ex);
-               }
-       } else {
-               this.debug("Could not find Flash element");
-       }
-
+       this.callFlash("StopUpload");
 };
 
 /* ************************
  * Settings methods
 };
 
 /* ************************
  * Settings methods
- *   These methods change the settings inside SWFUpload
- *   They shouldn't need to be called in a setTimeout since they
- *   should not call back from Flash to JavaScript (except perhaps in a Debug call)
- *   and some need to return data so setTimeout won't work.
- */
+ *   These methods change the SWFUpload settings.
+ *   SWFUpload settings should not be changed directly on the settings object
+ *   since many of the settings need to be passed to Flash in order to take
+ *   effect.
+ * *********************** */
 
 
-/* Gets the file statistics object.     It looks like this (where n = number):
-       {
-               files_queued: n,
-               complete_uploads: n,
-               upload_errors: n,
-               uploads_cancelled: n,
-               queue_errors: n
-       }
-*/
+// Public: getStats gets the file statistics object.
 SWFUpload.prototype.getStats = function () {
 SWFUpload.prototype.getStats = function () {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.GetStats) === "function") {
-               try {
-                       return movie_element.GetStats();
-               }
-               catch (ex) {
-                       this.debug("Could not call GetStats");
-               }
-       } else {
-               this.debug("Could not find Flash element");
-       }
+       return this.callFlash("GetStats");
 };
 };
-SWFUpload.prototype.setStats = function (stats_object) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetStats) === "function") {
-               try {
-                       movie_element.SetStats(stats_object);
-               }
-               catch (ex) {
-                       this.debug("Could not call SetStats");
-               }
-       } else {
-               this.debug("Could not find Flash element");
-       }
+
+// Public: setStats changes the SWFUpload statistics.  You shouldn't need to 
+// change the statistics but you can.  Changing the statistics does not
+// affect SWFUpload accept for the successful_uploads count which is used
+// by the upload_limit setting to determine how many files the user may upload.
+SWFUpload.prototype.setStats = function (statsObject) {
+       this.callFlash("SetStats", [statsObject]);
 };
 
 };
 
-SWFUpload.prototype.setCredentials = function(name, password) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetCredentials) === "function") {
-               try {
-                       return movie_element.SetCredentials(name, password);
-               }
-               catch (ex) {
-                       this.debug("Could not call SetCredentials");
-               }
+// Public: getFile retrieves a File object by ID or Index.  If the file is
+// not found then 'null' is returned.
+SWFUpload.prototype.getFile = function (fileID) {
+       if (typeof(fileID) === "number") {
+               return this.callFlash("GetFileByIndex", [fileID]);
        } else {
        } else {
-               this.debug("Could not find Flash element");
+               return this.callFlash("GetFile", [fileID]);
        }
 };
 
        }
 };
 
-SWFUpload.prototype.getFile = function (file_id) {
-       var movie_element = this.getMovieElement();
-                       if (typeof(file_id) === "number") {
-                               if (movie_element !== null && typeof(movie_element.GetFileByIndex) === "function") {
-                                       try {
-                                               return movie_element.GetFileByIndex(file_id);
-                                       }
-                                       catch (ex) {
-                                               this.debug("Could not call GetFileByIndex");
-                                       }
-                               } else {
-                                       this.debug("Could not find Flash element");
-                               }
-                       } else {
-                               if (movie_element !== null && typeof(movie_element.GetFile) === "function") {
-                                       try {
-                                               return movie_element.GetFile(file_id);
-                                       }
-                                       catch (ex) {
-                                               this.debug("Could not call GetFile");
-                                       }
-                               } else {
-                                       this.debug("Could not find Flash element");
-                               }
-                       }
+// Public: addFileParam sets a name/value pair that will be posted with the
+// file specified by the Files ID.  If the name already exists then the
+// exiting value will be overwritten.
+SWFUpload.prototype.addFileParam = function (fileID, name, value) {
+       return this.callFlash("AddFileParam", [fileID, name, value]);
 };
 
 };
 
-SWFUpload.prototype.addFileParam = function (file_id, name, value) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.AddFileParam) === "function") {
-               try {
-                       return movie_element.AddFileParam(file_id, name, value);
-               }
-               catch (ex) {
-                       this.debug("Could not call AddFileParam");
-               }
-       } else {
-               this.debug("Could not find Flash element");
-       }
+// Public: removeFileParam removes a previously set (by addFileParam) name/value
+// pair from the specified file.
+SWFUpload.prototype.removeFileParam = function (fileID, name) {
+       this.callFlash("RemoveFileParam", [fileID, name]);
 };
 
 };
 
-SWFUpload.prototype.removeFileParam = function (file_id, name) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.RemoveFileParam) === "function") {
-               try {
-                       return movie_element.RemoveFileParam(file_id, name);
-               }
-               catch (ex) {
-                       this.debug("Could not call AddFileParam");
-               }
-       } else {
-               this.debug("Could not find Flash element");
-       }
+// Public: setUploadUrl changes the upload_url setting.
+SWFUpload.prototype.setUploadURL = function (url) {
+       this.settings.upload_url = url.toString();
+       this.callFlash("SetUploadURL", [url]);
+};
 
 
+// Public: setPostParams changes the post_params setting
+SWFUpload.prototype.setPostParams = function (paramsObject) {
+       this.settings.post_params = paramsObject;
+       this.callFlash("SetPostParams", [paramsObject]);
 };
 
 };
 
-SWFUpload.prototype.setUploadURL = function (url) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetUploadURL) === "function") {
-               try {
-                       this.addSetting("upload_url", url);
-                       movie_element.SetUploadURL(this.getSetting("upload_url"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetUploadURL");
-               }
-       } else {
-               this.debug("Could not find Flash element in setUploadURL");
-       }
+// Public: addPostParam adds post name/value pair.  Each name can have only one value.
+SWFUpload.prototype.addPostParam = function (name, value) {
+       this.settings.post_params[name] = value;
+       this.callFlash("SetPostParams", [this.settings.post_params]);
 };
 
 };
 
-SWFUpload.prototype.setPostParams = function (param_object) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetPostParams) === "function") {
-               try {
-                       this.addSetting("post_params", param_object);
-                       movie_element.SetPostParams(this.getSetting("post_params"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetPostParams");
-               }
-       } else {
-               this.debug("Could not find Flash element in SetPostParams");
-       }
+// Public: removePostParam deletes post name/value pair.
+SWFUpload.prototype.removePostParam = function (name) {
+       delete this.settings.post_params[name];
+       this.callFlash("SetPostParams", [this.settings.post_params]);
 };
 
 };
 
+// Public: setFileTypes changes the file_types setting and the file_types_description setting
 SWFUpload.prototype.setFileTypes = function (types, description) {
 SWFUpload.prototype.setFileTypes = function (types, description) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetFileTypes) === "function") {
-               try {
-                       this.addSetting("file_types", types);
-                       this.addSetting("file_types_description", description);
-                       movie_element.SetFileTypes(this.getSetting("file_types"), this.getSetting("file_types_description"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetFileTypes");
-               }
-       } else {
-               this.debug("Could not find Flash element in SetFileTypes");
-       }
+       this.settings.file_types = types;
+       this.settings.file_types_description = description;
+       this.callFlash("SetFileTypes", [types, description]);
 };
 
 };
 
-SWFUpload.prototype.setFileSizeLimit = function (file_size_limit) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetFileSizeLimit) === "function") {
-               try {
-                       this.addSetting("file_size_limit", file_size_limit);
-                       movie_element.SetFileSizeLimit(this.getSetting("file_size_limit"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetFileSizeLimit");
-               }
-       } else {
-               this.debug("Could not find Flash element in SetFileSizeLimit");
-       }
+// Public: setFileSizeLimit changes the file_size_limit setting
+SWFUpload.prototype.setFileSizeLimit = function (fileSizeLimit) {
+       this.settings.file_size_limit = fileSizeLimit;
+       this.callFlash("SetFileSizeLimit", [fileSizeLimit]);
 };
 
 };
 
-SWFUpload.prototype.setFileUploadLimit = function (file_upload_limit) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetFileUploadLimit) === "function") {
-               try {
-                       this.addSetting("file_upload_limit", file_upload_limit);
-                       movie_element.SetFileUploadLimit(this.getSetting("file_upload_limit"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetFileUploadLimit");
-               }
-       } else {
-               this.debug("Could not find Flash element in SetFileUploadLimit");
-       }
+// Public: setFileUploadLimit changes the file_upload_limit setting
+SWFUpload.prototype.setFileUploadLimit = function (fileUploadLimit) {
+       this.settings.file_upload_limit = fileUploadLimit;
+       this.callFlash("SetFileUploadLimit", [fileUploadLimit]);
 };
 
 };
 
-SWFUpload.prototype.setFileQueueLimit = function (file_queue_limit) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetFileQueueLimit) === "function") {
-               try {
-                       this.addSetting("file_queue_limit", file_queue_limit);
-                       movie_element.SetFileQueueLimit(this.getSetting("file_queue_limit"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetFileQueueLimit");
-               }
-       } else {
-               this.debug("Could not find Flash element in SetFileQueueLimit");
-       }
+// Public: setFileQueueLimit changes the file_queue_limit setting
+SWFUpload.prototype.setFileQueueLimit = function (fileQueueLimit) {
+       this.settings.file_queue_limit = fileQueueLimit;
+       this.callFlash("SetFileQueueLimit", [fileQueueLimit]);
 };
 
 };
 
-SWFUpload.prototype.setFilePostName = function (file_post_name) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetFilePostName) === "function") {
-               try {
-                       this.addSetting("file_post_name", file_post_name);
-                       movie_element.SetFilePostName(this.getSetting("file_post_name"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetFilePostName");
-               }
-       } else {
-               this.debug("Could not find Flash element in SetFilePostName");
-       }
+// Public: setFilePostName changes the file_post_name setting
+SWFUpload.prototype.setFilePostName = function (filePostName) {
+       this.settings.file_post_name = filePostName;
+       this.callFlash("SetFilePostName", [filePostName]);
 };
 
 };
 
-SWFUpload.prototype.setDebugEnabled = function (debug_enabled) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.SetDebugEnabled) === "function") {
-               try {
-                       this.addSetting("debug_enabled", debug_enabled);
-                       movie_element.SetDebugEnabled(this.getSetting("debug_enabled"));
-               }
-               catch (ex) {
-                       this.debug("Could not call SetDebugEnabled");
-               }
-       } else {
-               this.debug("Could not find Flash element in SetDebugEnabled");
-       }
+// Public: setUseQueryString changes the use_query_string setting
+SWFUpload.prototype.setUseQueryString = function (useQueryString) {
+       this.settings.use_query_string = useQueryString;
+       this.callFlash("SetUseQueryString", [useQueryString]);
 };
 
 };
 
-/* *******************************
-       Internal Event Callers
-       Don't override these! These event callers ensure that your custom event handlers
-       are called safely and in order.
-******************************* */
+// Public: setRequeueOnError changes the requeue_on_error setting
+SWFUpload.prototype.setRequeueOnError = function (requeueOnError) {
+       this.settings.requeue_on_error = requeueOnError;
+       this.callFlash("SetRequeueOnError", [requeueOnError]);
+};
 
 
-/* This is the callback method that the Flash movie will call when it has been loaded and is ready to go.
-   Calling this or showUI() "manually" will bypass the Flash Detection built in to SWFUpload.
-   Use a ui_function setting if you want to control the UI loading after the flash has loaded.
-*/
-SWFUpload.prototype.flashReady = function () {
-       // Check that the movie element is loaded correctly with its ExternalInterface methods defined
-       var movie_element = this.getMovieElement();
-       if (movie_element === null || typeof(movie_element.StartUpload) !== "function") {
-               this.debug("ExternalInterface methods failed to initialize.");
-               return;
+// Public: setHTTPSuccess changes the http_success setting
+SWFUpload.prototype.setHTTPSuccess = function (http_status_codes) {
+       if (typeof http_status_codes === "string") {
+               http_status_codes = http_status_codes.replace(" ", "").split(",");
        }
        
        }
        
-       var self = this;
-       if (typeof(self.flashReady_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.flashReady_handler(); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("flashReady_handler event not defined");
-       }
+       this.settings.http_success = http_status_codes;
+       this.callFlash("SetHTTPSuccess", [http_status_codes]);
 };
 
 };
 
-/*
-       Event Queue.  Rather can call events directly from Flash they events are
-       are placed in a queue and then executed.  This ensures that each event is
-       executed in the order it was called which is not guarenteed when calling
-       setTimeout.  Out of order events was especially problematic in Safari.
-*/
-SWFUpload.prototype.executeNextEvent = function () {
-       var  f = this.eventQueue.shift();
-       if (typeof(f) === "function") {
-               f();
-       }
-}
 
 
-/* This is a chance to do something before the browse window opens */
-SWFUpload.prototype.fileDialogStart = function () {
-       var self = this;
-       if (typeof(self.fileDialogStart_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.fileDialogStart_handler(); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("fileDialogStart event not defined");
-       }
+// Public: setDebugEnabled changes the debug_enabled setting
+SWFUpload.prototype.setDebugEnabled = function (debugEnabled) {
+       this.settings.debug_enabled = debugEnabled;
+       this.callFlash("SetDebugEnabled", [debugEnabled]);
 };
 
 };
 
-
-/* Called when a file is successfully added to the queue. */
-SWFUpload.prototype.fileQueued = function (file) {
-       var self = this;
-       if (typeof(self.fileQueued_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.fileQueued_handler(file); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("fileQueued event not defined");
+// Public: setButtonImageURL loads a button image sprite
+SWFUpload.prototype.setButtonImageURL = function (buttonImageURL) {
+       if (buttonImageURL == undefined) {
+               buttonImageURL = "";
        }
        }
+       
+       this.settings.button_image_url = buttonImageURL;
+       this.callFlash("SetButtonImageURL", [buttonImageURL]);
 };
 
 };
 
-
-/* Handle errors that occur when an attempt to queue a file fails. */
-SWFUpload.prototype.fileQueueError = function (file, error_code, message) {
-       var self = this;
-       if (typeof(self.fileQueueError_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() {  self.fileQueueError_handler(file, error_code, message); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("fileQueueError event not defined");
+// Public: setButtonDimensions resizes the Flash Movie and button
+SWFUpload.prototype.setButtonDimensions = function (width, height) {
+       this.settings.button_width = width;
+       this.settings.button_height = height;
+       
+       var movie = this.getMovieElement();
+       if (movie != undefined) {
+               movie.style.width = width + "px";
+               movie.style.height = height + "px";
        }
        }
+       
+       this.callFlash("SetButtonDimensions", [width, height]);
 };
 };
-
-/* 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 (num_files_selected) {
-       var self = this;
-       if (typeof(self.fileDialogComplete_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.fileDialogComplete_handler(num_files_selected); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("fileDialogComplete event not defined");
-       }
+// Public: setButtonText Changes the text overlaid on the button
+SWFUpload.prototype.setButtonText = function (html) {
+       this.settings.button_text = html;
+       this.callFlash("SetButtonText", [html]);
 };
 };
-
-/* Gets called when a file upload is about to be started.  Return true to continue the upload. Return false to stop the upload.
-       If you return false then uploadError and uploadComplete are called (like normal).
-       
-       This is a good place to do any file validation you need.
-       */
-SWFUpload.prototype.uploadStart = function (file) {
-       var self = this;
-       if (typeof(self.fileDialogComplete_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.returnUploadStart(self.uploadStart_handler(file)); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("uploadStart event not defined");
-       }
+// Public: setButtonTextPadding changes the top and left padding of the text overlay
+SWFUpload.prototype.setButtonTextPadding = function (left, top) {
+       this.settings.button_text_top_padding = top;
+       this.settings.button_text_left_padding = left;
+       this.callFlash("SetButtonTextPadding", [left, top]);
 };
 
 };
 
-/* Note: Internal use only.  This function returns the result of uploadStart to
-       flash.  Since returning values in the normal way can result in Flash/JS circular
-       call issues we split up the call in a Timeout.  This is transparent from the API
-       point of view.
-*/
-SWFUpload.prototype.returnUploadStart = function (return_value) {
-       var movie_element = this.getMovieElement();
-       if (movie_element !== null && typeof(movie_element.ReturnUploadStart) === "function") {
-               try {
-                       movie_element.ReturnUploadStart(return_value);
-               }
-               catch (ex) {
-                       this.debug("Could not call ReturnUploadStart");
-               }
-       } else {
-               this.debug("Could not find Flash element in returnUploadStart");
-       }
+// Public: setButtonTextStyle changes the CSS used to style the HTML/Text overlaid on the button
+SWFUpload.prototype.setButtonTextStyle = function (css) {
+       this.settings.button_text_style = css;
+       this.callFlash("SetButtonTextStyle", [css]);
+};
+// Public: setButtonDisabled disables/enables the button
+SWFUpload.prototype.setButtonDisabled = function (isDisabled) {
+       this.settings.button_disabled = isDisabled;
+       this.callFlash("SetButtonDisabled", [isDisabled]);
+};
+// Public: setButtonAction sets the action that occurs when the button is clicked
+SWFUpload.prototype.setButtonAction = function (buttonAction) {
+       this.settings.button_action = buttonAction;
+       this.callFlash("SetButtonAction", [buttonAction]);
 };
 
 };
 
+// Public: setButtonCursor changes the mouse cursor displayed when hovering over the button
+SWFUpload.prototype.setButtonCursor = function (cursor) {
+       this.settings.button_cursor = cursor;
+       this.callFlash("SetButtonCursor", [cursor]);
+};
 
 
+/* *******************************
+       Flash Event Interfaces
+       These functions are used by Flash to trigger the various
+       events.
+       
+       All these functions a Private.
+       
+       Because the ExternalInterface library is buggy the event calls
+       are added to a queue and the queue then executed by a setTimeout.
+       This ensures that events are executed in a determinate order and that
+       the ExternalInterface bugs are avoided.
+******************************* */
 
 
-/* Called during upload as the file progresses. Use this event to update your UI. */
-SWFUpload.prototype.uploadProgress = function (file, bytes_complete, bytes_total) {
-       var self = this;
-       if (typeof(self.uploadProgress_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.uploadProgress_handler(file, bytes_complete, bytes_total); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("uploadProgress event not defined");
+SWFUpload.prototype.queueEvent = function (handlerName, argumentArray) {
+       // Warning: Don't call this.debug inside here or you'll create an infinite loop
+       
+       if (argumentArray == undefined) {
+               argumentArray = [];
+       } else if (!(argumentArray instanceof Array)) {
+               argumentArray = [argumentArray];
        }
        }
-};
-
-/* Called when an error occurs during an upload. Use error_code and the SWFUpload.UPLOAD_ERROR constants to determine
-   which error occurred. The uploadComplete event is called after an error code indicating that the next file is
-   ready for upload.  For files cancelled out of order the uploadComplete event will not be called. */
-SWFUpload.prototype.uploadError = function (file, error_code, message) {
+       
        var self = this;
        var self = this;
-       if (typeof(this.uploadError_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.uploadError_handler(file, error_code, message); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("uploadError event not defined");
-       }
-};
+       if (typeof this.settings[handlerName] === "function") {
+               // Queue the event
+               this.eventQueue.push(function () {
+                       this.settings[handlerName].apply(this, argumentArray);
+               });
+               
+               // Execute the next queued event
+               setTimeout(function () {
+                       self.executeNextEvent();
+               }, 0);
+               
+       } else if (this.settings[handlerName] !== null) {
+               throw "Event handler " + handlerName + " is unknown or is not a function";
+       }
+};
+
+// Private: Causes the next event in the queue to be executed.  Since events are queued using a setTimeout
+// we must queue them in order to garentee that they are executed in order.
+SWFUpload.prototype.executeNextEvent = function () {
+       // Warning: Don't call this.debug inside here or you'll create an infinite loop
 
 
-/* This gets called when a file finishes uploading and the server-side upload script has completed and returned a 200
-status code. Any text returned by the server is available in server_data.
-**NOTE: The upload script MUST return some text or the uploadSuccess and uploadComplete events will not fire and the
-upload will become 'stuck'. */
-SWFUpload.prototype.uploadSuccess = function (file, server_data) {
-       var self = this;
-       if (typeof(self.uploadSuccess_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.uploadSuccess_handler(file, server_data); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("uploadSuccess event not defined");
+       var  f = this.eventQueue ? this.eventQueue.shift() : null;
+       if (typeof(f) === "function") {
+               f.apply(this);
        }
 };
 
        }
 };
 
-/* uploadComplete is called when the file is uploaded or an error occurred and SWFUpload is ready to make the next upload.
-   If you want the next upload to start to automatically you can call startUpload() from this event. */
-SWFUpload.prototype.uploadComplete = function (file) {
-       var self = this;
-       if (typeof(self.uploadComplete_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.uploadComplete_handler(file); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.debug("uploadComplete event not defined");
-       }
-};
+// Private: unescapeFileParams is part of a workaround for a flash bug where objects passed through ExternalInterface cannot have
+// properties that contain characters that are not valid for JavaScript identifiers. To work around this
+// the Flash Component escapes the parameter names and we must unescape again before passing them along.
+SWFUpload.prototype.unescapeFilePostParams = function (file) {
+       var reg = /[$]([0-9a-f]{4})/i;
+       var unescapedPost = {};
+       var uk;
 
 
-/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
-   internal debug console.  You can override this event and have messages written where you want. */
-SWFUpload.prototype.debug = function (message) {
-       var self = this;
-       if (typeof(self.debug_handler) === "function") {
-               this.eventQueue[this.eventQueue.length] = function() { self.debug_handler(message); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       } else {
-               this.eventQueue[this.eventQueue.length] = function() { self.debugMessage(message); };
-               setTimeout(function () { self.executeNextEvent();}, 0);
-       }
-};
+       if (file != undefined) {
+               for (var k in file.post) {
+                       if (file.post.hasOwnProperty(k)) {
+                               uk = k;
+                               var match;
+                               while ((match = reg.exec(uk)) !== null) {
+                                       uk = uk.replace(match[0], String.fromCharCode(parseInt("0x" + match[1], 16)));
+                               }
+                               unescapedPost[uk] = file.post[k];
+                       }
+               }
 
 
+               file.post = unescapedPost;
+       }
 
 
-/* **********************************
-       Default Event Handlers.
-       These event handlers are used by default if an overriding handler is
-       not defined in the SWFUpload settings object.
-       
-       JS Note: even though these are defined on the SWFUpload object (rather than the prototype) they
-       are attached (read: copied) to a SWFUpload instance and 'this' is given the proper context.
-   ********************************** */
+       return file;
+};
 
 
-/* This is a special event handler that has no override in the settings.  Flash calls this when it has
-   been loaded by the browser and is ready for interaction.  You should not override it.  If you need
-   to do something with SWFUpload has loaded then use the swfupload_loaded_handler setting.
-*/
-SWFUpload.flashReady = function () {
-       try {
-               this.debug("Flash called back and is ready.");
+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.";
+       }
 
 
-               if (typeof(this.swfUploadLoaded_handler) === "function") {
-                       this.swfUploadLoaded_handler();
-               }
-       } catch (ex) {
-               this.debug(ex);
+       // Fix IE Flash/Form bug
+       if (window[this.movieName] == undefined) {
+               window[this.movieName] = movieElement;
        }
        }
+       
+       this.queueEvent("swfupload_loaded_handler");
 };
 
 };
 
-/* This is a chance to something immediately after SWFUpload has loaded.
-   Like, hide the default/degraded upload form and display the SWFUpload form. */
-SWFUpload.swfUploadLoaded = function () {
-};
 
 /* This is a chance to do something before the browse window opens */
 
 /* This is a chance to do something before the browse window opens */
-SWFUpload.fileDialogStart = function () {
+SWFUpload.prototype.fileDialogStart = function () {
+       this.queueEvent("file_dialog_start_handler");
 };
 
 
 /* Called when a file is successfully added to the queue. */
 };
 
 
 /* Called when a file is successfully added to the queue. */
-SWFUpload.fileQueued = function (file) {
+SWFUpload.prototype.fileQueued = function (file) {
+       file = this.unescapeFilePostParams(file);
+       this.queueEvent("file_queued_handler", file);
 };
 
 
 /* Handle errors that occur when an attempt to queue a file fails. */
 };
 
 
 /* Handle errors that occur when an attempt to queue a file fails. */
-SWFUpload.fileQueueError = function (file, error_code, message) {
-       try {
-               switch (error_code) {
-               case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT:
-                       this.debug("Error Code: File too big, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                       break;
-               case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE:
-                       this.debug("Error Code: Zero Byte File, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                       break;
-               case SWFUpload.QUEUE_ERROR.QUEUE_LIMIT_EXCEEDED:
-                       this.debug("Error Code: Upload limit reached, File name: " + file.name + ", File size: " + file.size + ", Message: " + message);
-                       break;
-               case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE:
-                       this.debug("Error Code: File extension is not allowed, Message: " + message);
-                       break;
-               default:
-                       this.debug("Error Code: Unhandled error occured. Errorcode: " + error_code);
-               }
-       } catch (ex) {
-               this.debug(ex);
-       }
+SWFUpload.prototype.fileQueueError = function (file, errorCode, message) {
+       file = this.unescapeFilePostParams(file);
+       this.queueEvent("file_queue_error_handler", [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.fileDialogComplete = function (num_files_selected) {
+SWFUpload.prototype.fileDialogComplete = function (numFilesSelected, numFilesQueued) {
+       this.queueEvent("file_dialog_complete_handler", [numFilesSelected, numFilesQueued]);
 };
 
 };
 
-/* Gets called when a file upload is about to be started.  Return true to continue the upload. Return false to stop the upload.
-       If you return false then the uploadError callback is called and then uploadComplete (like normal).
+SWFUpload.prototype.uploadStart = function (file) {
+       file = this.unescapeFilePostParams(file);
+       this.queueEvent("return_upload_start_handler", file);
+};
+
+SWFUpload.prototype.returnUploadStart = function (file) {
+       var returnValue;
+       if (typeof this.settings.upload_start_handler === "function") {
+               file = this.unescapeFilePostParams(file);
+               returnValue = this.settings.upload_start_handler.call(this, file);
+       } else if (this.settings.upload_start_handler != undefined) {
+               throw "upload_start_handler must be a function";
+       }
+
+       // Convert undefined to true so if nothing is returned from the upload_start_handler it is
+       // interpretted as 'true'.
+       if (returnValue === undefined) {
+               returnValue = true;
+       }
        
        
-       This is a good place to do any file validation you need.
+       returnValue = !!returnValue;
        
        
-       This is the only function that cannot be called on a setTimeout because it must return a value to Flash.
-       You SHOULD NOT make any calls in to Flash (e.i, changing settings, getting stats, etc).  Flash Player bugs prevent
-       calls in to Flash from working reliably.
-*/
-SWFUpload.uploadStart = function (file) {
-       return true;
+       this.callFlash("ReturnUploadStart", [returnValue]);
 };
 
 };
 
-// Called during upload as the file progresses
-SWFUpload.uploadProgress = function (file, bytes_complete, bytes_total) {
-       this.debug("File Progress: " + file.id + ", Bytes: " + bytes_complete + ". Total: " + bytes_total);
-};
 
 
-/* This gets called when a file finishes uploading and the upload script has completed and returned a 200 status code. Any text returned by the
-server is available in server_data.     The upload script must return some text or uploadSuccess will not fire (neither will uploadComplete). */
-SWFUpload.uploadSuccess = function (file, server_data) {
-       this.debug("Upload Success: " + file.id + ", Server: " + server_data);
+
+SWFUpload.prototype.uploadProgress = function (file, bytesComplete, bytesTotal) {
+       file = this.unescapeFilePostParams(file);
+       this.queueEvent("upload_progress_handler", [file, bytesComplete, bytesTotal]);
 };
 
 };
 
-/* This is called last.         The file is uploaded or an error occurred and SWFUpload is ready to make the next upload.
-       If you want to automatically start the next file just call startUpload from here.
-*/
-SWFUpload.uploadComplete = function (file) {
-       this.debug("Upload Complete: " + file.id);
+SWFUpload.prototype.uploadError = function (file, errorCode, message) {
+       file = this.unescapeFilePostParams(file);
+       this.queueEvent("upload_error_handler", [file, errorCode, message]);
 };
 
 };
 
-// Called by SWFUpload JavaScript and Flash functions when debug is enabled.
-// Override this method in your settings to call your own debug message handler
-SWFUpload.debug = function (message) {
-       if (this.getSetting("debug_enabled")) {
-               this.debugMessage(message);
-       }
+SWFUpload.prototype.uploadSuccess = function (file, serverData) {
+       file = this.unescapeFilePostParams(file);
+       this.queueEvent("upload_success_handler", [file, serverData]);
 };
 
 };
 
-/* Called when an upload occurs during upload.  For HTTP errors 'message' will contain the HTTP STATUS CODE */
-SWFUpload.uploadError = function (file, errcode, msg) {
-       try {
-               switch (errcode) {
-               case SWFUpload.UPLOAD_ERROR.SPECIFIED_FILE_ID_NOT_FOUND:
-                       this.debug("Error Code: File ID specified for upload was not found, Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.HTTP_ERROR:
-                       this.debug("Error Code: HTTP Error, File name: " + file.name + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.MISSING_UPLOAD_URL:
-                       this.debug("Error Code: No backend file, File name: " + file.name + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.IO_ERROR:
-                       this.debug("Error Code: IO Error, File name: " + file.name + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR:
-                       this.debug("Error Code: Security Error, File name: " + file.name + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED:
-                       this.debug("Error Code: Upload limit reached, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED:
-                       this.debug("Error Code: Upload Initialization exception, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED:
-                       this.debug("Error Code: uploadStart callback returned false, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED:
-                       this.debug("Error Code: The file upload was cancelled, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-                       break;
-               case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED:
-                       this.debug("Error Code: The file upload was stopped, File name: " + file.name + ", File size: " + file.size + ", Message: " + msg);
-                       break;
-               default:
-                       this.debug("Error Code: Unhandled error occured. Errorcode: " + errcode);
-               }
-       } catch (ex) {
-               this.debug(ex);
-       }
+SWFUpload.prototype.uploadComplete = function (file) {
+       file = this.unescapeFilePostParams(file);
+       this.queueEvent("upload_complete_handler", file);
 };
 
 };
 
+/* Called by SWFUpload JavaScript and Flash functions when debug is enabled. By default it writes messages to the
+   internal debug console.  You can override this event and have messages written where you want. */
+SWFUpload.prototype.debug = function (message) {
+       this.queueEvent("debug_handler", message);
+};
 
 
 /* **********************************
 
 
 /* **********************************
@@ -998,24 +866,32 @@ SWFUpload.uploadError = function (file, errcode, msg) {
 
        The console is automatically scrolled as messages appear.
        
 
        The console is automatically scrolled as messages appear.
        
-       You can override this console (to use FireBug's console for instance) by setting the debug event method to your own function
-       that handles the debug message
-   ********************************** */
+       If you are using your own debug handler or when you deploy to production and
+       have debug disabled you can remove these functions to reduce the file size
+       and complexity.
+********************************** */
+   
+// Private: debugMessage is the default debug_handler.  If you want to print debug messages
+// call the debug() function.  When overriding the function your own function should
+// check to see if the debug setting is true before outputting debug information.
 SWFUpload.prototype.debugMessage = function (message) {
 SWFUpload.prototype.debugMessage = function (message) {
-       var exception_message, exception_values;
-
-       if (typeof(message) === "object" && typeof(message.name) === "string" && typeof(message.message) === "string") {
-               exception_message = "";
-               exception_values = [];
-               for (var key in message) {
-                       exception_values.push(key + ": " + message[key]);
+       if (this.settings.debug) {
+               var exceptionMessage, exceptionValues = [];
+
+               // Check for an exception object and print it nicely
+               if (typeof message === "object" && typeof message.name === "string" && typeof message.message === "string") {
+                       for (var key in message) {
+                               if (message.hasOwnProperty(key)) {
+                                       exceptionValues.push(key + ": " + message[key]);
+                               }
+                       }
+                       exceptionMessage = exceptionValues.join("\n") || "";
+                       exceptionValues = exceptionMessage.split("\n");
+                       exceptionMessage = "EXCEPTION: " + exceptionValues.join("\nEXCEPTION: ");
+                       SWFUpload.Console.writeLine(exceptionMessage);
+               } else {
+                       SWFUpload.Console.writeLine(message);
                }
                }
-               exception_message = exception_values.join("\n");
-               exception_values = exception_message.split("\n");
-               exception_message = "EXCEPTION: " + exception_values.join("\nEXCEPTION: ");
-               SWFUpload.Console.writeLine(exception_message);
-       } else {
-               SWFUpload.Console.writeLine(message);
        }
 };
 
        }
 };
 
diff --git a/wp-includes/js/swfupload/swfupload.swf b/wp-includes/js/swfupload/swfupload.swf
new file mode 100644 (file)
index 0000000..a627b19
Binary files /dev/null and b/wp-includes/js/swfupload/swfupload.swf differ
index a7c4a4012a891ae9560c805a8f040eb4e9904426..eac043423e72e1435fdb09863b2a8250f8096137 100644 (file)
@@ -3,12 +3,12 @@
 /* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
 /* ----------------------------------------------------------------------------------------------------------------*/
 #TB_window {
 /* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
 /* ----------------------------------------------------------------------------------------------------------------*/
 #TB_window {
-       font: 12px Arial, Helvetica, sans-serif;
+       font: 12px "Lucida Grande", Verdana, Arial, sans-serif;
        color: #333333;
 }
 
 #TB_secondLine {
        color: #333333;
 }
 
 #TB_secondLine {
-       font: 10px Arial, Helvetica, sans-serif;
+       font: 10px "Lucida Grande", Verdana, Arial, sans-serif;
        color:#666666;
 }
 
        color:#666666;
 }
 
@@ -33,6 +33,7 @@
 .TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
 .TB_overlayBG {
        background-color:#000;
 .TB_overlayMacFFBGHack {background: url(macFFBgHack.png) repeat;}
 .TB_overlayBG {
        background-color:#000;
+       -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";
        filter:alpha(opacity=75);
        -moz-opacity: 0.75;
        opacity: 0.75;
        filter:alpha(opacity=75);
        -moz-opacity: 0.75;
        opacity: 0.75;
        z-index: 102;
        color:#000000;
        display:none;
        z-index: 102;
        color:#000000;
        display:none;
-       border: 4px solid #525252;
        text-align:left;
        top:50%;
        left:50%;
        text-align:left;
        top:50%;
        left:50%;
+       border: 1px solid #555;
+       -moz-box-shadow: rgba(0,0,0,1) 0 4px 30px;
+       -webkit-box-shadow: rgba(0,0,0,1) 0 4px 30px;
+       -khtml-box-shadow: rgba(0,0,0,1) 0 4px 30px;
+       box-shadow: rgba(0,0,0,1) 0 4px 30px;
 }
 
 * html #TB_window { /* ie6 hack */
 }
 
 * html #TB_window { /* ie6 hack */
@@ -120,7 +125,7 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
        top: 50%;
        left: 50%;
        background-color: #E8E8E8;
        top: 50%;
        left: 50%;
        background-color: #E8E8E8;
-       border: 4px solid #525252;
+       border: 1px solid #555;
        margin: -45px 0pt 0pt -125px;
        padding: 40px 15px 15px;
 }
        margin: -45px 0pt 0pt -125px;
        padding: 40px 15px 15px;
 }
index 5770c8b0a4f6cd2219c9a6d3e23e1cdaca53a8cf..f2873c91aa52dc372956fa48d5d97b882af19b31 100644 (file)
@@ -281,8 +281,9 @@ function tb_remove() {
 }
 
 function tb_position() {
 }
 
 function tb_position() {
+var isIE6 = typeof document.body.style.maxHeight === "undefined";
 jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
 jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
-       if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
+       if ( ! isIE6 ) { // take away IE6
                jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
        }
 }
                jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
        }
 }
diff --git a/wp-includes/js/tinymce/langs/wp-langs-en.js b/wp-includes/js/tinymce/langs/wp-langs-en.js
new file mode 100644 (file)
index 0000000..e464a8e
--- /dev/null
@@ -0,0 +1,431 @@
+tinyMCE.addI18n({en:{
+common:{
+edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
+apply:"Apply",
+insert:"Insert",
+update:"Update",
+cancel:"Cancel",
+close:"Close",
+browse:"Browse",
+class_name:"Class",
+not_set:"-- Not set --",
+clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.",
+clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
+popup_blocked:"Sorry, but we have noticed that your popup-blocker has disabled a window that provides application functionality. You will need to disable popup blocking on this site in order to fully utilize this tool.",
+invalid_data:"Error: Invalid values entered, these are marked in red.",
+more_colors:"More colors"
+},
+contextmenu:{
+align:"Alignment",
+left:"Left",
+center:"Center",
+right:"Right",
+full:"Full"
+},
+insertdatetime:{
+date_fmt:"%Y-%m-%d",
+time_fmt:"%H:%M:%S",
+insertdate_desc:"Insert date",
+inserttime_desc:"Insert time",
+months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
+months_short:"Jan_January_abbreviation,Feb_February_abbreviation,Mar_March_abbreviation,Apr_April_abbreviation,May_May_abbreviation,Jun_June_abbreviation,Jul_July_abbreviation,Aug_August_abbreviation,Sep_September_abbreviation,Oct_October_abbreviation,Nov_November_abbreviation,Dec_December_abbreviation",
+day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",
+day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat"
+},
+print:{
+print_desc:"Print"
+},
+preview:{
+preview_desc:"Preview"
+},
+directionality:{
+ltr_desc:"Direction left to right",
+rtl_desc:"Direction right to left"
+},
+layer:{
+insertlayer_desc:"Insert new layer",
+forward_desc:"Move forward",
+backward_desc:"Move backward",
+absolute_desc:"Toggle absolute positioning",
+content:"New layer..."
+},
+save:{
+save_desc:"Save",
+cancel_desc:"Cancel all changes"
+},
+nonbreaking:{
+nonbreaking_desc:"Insert non-breaking space character"
+},
+iespell:{
+iespell_desc:"Run spell checking",
+download:"ieSpell not detected. Do you want to install it now?"
+},
+advhr:{
+advhr_desc:"Horizontale rule"
+},
+emotions:{
+emotions_desc:"Emotions"
+},
+searchreplace:{
+search_desc:"Find",
+replace_desc:"Find/Replace"
+},
+advimage:{
+image_desc:"Insert/edit image"
+},
+advlink:{
+link_desc:"Insert/edit link"
+},
+xhtmlxtras:{
+cite_desc:"Citation",
+abbr_desc:"Abbreviation",
+acronym_desc:"Acronym",
+del_desc:"Deletion",
+ins_desc:"Insertion",
+attribs_desc:"Insert/Edit Attributes"
+},
+style:{
+desc:"Edit CSS Style"
+},
+paste:{
+paste_text_desc:"Paste as Plain Text",
+paste_word_desc:"Paste from Word",
+selectall_desc:"Select All"
+},
+paste_dlg:{
+text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
+text_linebreaks:"Keep linebreaks",
+word_title:"Use CTRL+V on your keyboard to paste the text into the window."
+},
+table:{
+desc:"Inserts a new table",
+row_before_desc:"Insert row before",
+row_after_desc:"Insert row after",
+delete_row_desc:"Delete row",
+col_before_desc:"Insert column before",
+col_after_desc:"Insert column after",
+delete_col_desc:"Remove column",
+split_cells_desc:"Split merged table cells",
+merge_cells_desc:"Merge table cells",
+row_desc:"Table row properties",
+cell_desc:"Table cell properties",
+props_desc:"Table properties",
+paste_row_before_desc:"Paste table row before",
+paste_row_after_desc:"Paste table row after",
+cut_row_desc:"Cut table row",
+copy_row_desc:"Copy table row",
+del:"Delete table",
+row:"Row",
+col:"Column",
+cell:"Cell"
+},
+autosave:{
+unload_msg:"The changes you made will be lost if you navigate away from this page."
+},
+fullscreen:{
+desc:"Toggle fullscreen mode (Alt+Shift+G)"
+},
+media:{
+desc:"Insert / edit embedded media",
+delta_width:"0",
+delta_height:"0",
+edit:"Edit embedded media"
+},
+fullpage:{
+desc:"Document properties"
+},
+template:{
+desc:"Insert predefined template content"
+},
+visualchars:{
+desc:"Visual control characters on/off."
+},
+spellchecker:{
+desc:"Toggle spellchecker (Alt+Shift+N)",
+menu:"Spellchecker settings",
+ignore_word:"Ignore word",
+ignore_words:"Ignore all",
+langs:"Languages",
+wait:"Please wait...",
+sug:"Suggestions",
+no_sug:"No suggestions",
+no_mpell:"No misspellings found."
+},
+pagebreak:{
+desc:"Insert page break."
+}}});
+
+tinyMCE.addI18n("en.advanced",{
+style_select:"Styles",
+font_size:"Font size",
+fontdefault:"Font family",
+block:"Format",
+paragraph:"Paragraph",
+div:"Div",
+address:"Address",
+pre:"Preformatted",
+h1:"Heading 1",
+h2:"Heading 2",
+h3:"Heading 3",
+h4:"Heading 4",
+h5:"Heading 5",
+h6:"Heading 6",
+blockquote:"Blockquote",
+code:"Code",
+samp:"Code sample",
+dt:"Definition term ",
+dd:"Definition description",
+bold_desc:"Bold (Ctrl / Alt+Shift + B)",
+italic_desc:"Italic (Ctrl / Alt+Shift + I)",
+underline_desc:"Underline",
+striketrough_desc:"Strikethrough (Alt+Shift+D)",
+justifyleft_desc:"Align left (Alt+Shift+L)",
+justifycenter_desc:"Align center (Alt+Shift+C)",
+justifyright_desc:"Align right (Alt+Shift+R)",
+justifyfull_desc:"Align full (Alt+Shift+J)",
+bullist_desc:"Unordered list (Alt+Shift+U)",
+numlist_desc:"Ordered list (Alt+Shift+O)",
+outdent_desc:"Outdent",
+indent_desc:"Indent",
+undo_desc:"Undo (Ctrl+Z)",
+redo_desc:"Redo (Ctrl+Y)",
+link_desc:"Insert/edit link (Alt+Shift+A)",
+link_delta_width:"0",
+link_delta_height:"0",
+unlink_desc:"Unlink (Alt+Shift+S)",
+image_desc:"Insert/edit image (Alt+Shift+M)",
+image_delta_width:"0",
+image_delta_height:"0",
+cleanup_desc:"Cleanup messy code",
+code_desc:"Edit HTML Source",
+sub_desc:"Subscript",
+sup_desc:"Superscript",
+hr_desc:"Insert horizontal ruler",
+removeformat_desc:"Remove formatting",
+forecolor_desc:"Select text color",
+backcolor_desc:"Select background color",
+charmap_desc:"Insert custom character",
+visualaid_desc:"Toggle guidelines/invisible elements",
+anchor_desc:"Insert/edit anchor",
+cut_desc:"Cut",
+copy_desc:"Copy",
+paste_desc:"Paste",
+image_props_desc:"Image properties",
+newdocument_desc:"New document",
+help_desc:"Help",
+blockquote_desc:"Blockquote (Alt+Shift+Q)",
+clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.",
+path:"Path",
+newdocument:"Are you sure you want to clear all contents?",
+toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",
+more_colors:"More colors",
+colorpicker_delta_width:"0",
+colorpicker_delta_height:"0"
+});
+
+tinyMCE.addI18n("en.advanced_dlg",{
+about_title:"About TinyMCE",
+about_general:"About",
+about_help:"Help",
+about_license:"License",
+about_plugins:"Plugins",
+about_plugin:"Plugin",
+about_author:"Author",
+about_version:"Version",
+about_loaded:"Loaded plugins",
+anchor_title:"Insert/edit anchor",
+anchor_name:"Anchor name",
+code_title:"HTML Source Editor",
+code_wordwrap:"Word wrap",
+colorpicker_title:"Select a color",
+colorpicker_picker_tab:"Picker",
+colorpicker_picker_title:"Color picker",
+colorpicker_palette_tab:"Palette",
+colorpicker_palette_title:"Palette colors",
+colorpicker_named_tab:"Named",
+colorpicker_named_title:"Named colors",
+colorpicker_color:"Color:",
+colorpicker_name:"Name:",
+charmap_title:"Select custom character",
+image_title:"Insert/edit image",
+image_src:"Image URL",
+image_alt:"Image description",
+image_list:"Image list",
+image_border:"Border",
+image_dimensions:"Dimensions",
+image_vspace:"Vertical space",
+image_hspace:"Horizontal space",
+image_align:"Alignment",
+image_align_baseline:"Baseline",
+image_align_top:"Top",
+image_align_middle:"Middle",
+image_align_bottom:"Bottom",
+image_align_texttop:"Text top",
+image_align_textbottom:"Text bottom",
+image_align_left:"Left",
+image_align_right:"Right",
+link_title:"Insert/edit link",
+link_url:"Link URL",
+link_target:"Target",
+link_target_same:"Open link in the same window",
+link_target_blank:"Open link in a new window",
+link_titlefield:"Title",
+link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
+link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
+link_list:"Link list"
+});
+
+tinyMCE.addI18n("en.media_dlg",{
+title:"Insert / edit embedded media",
+general:"General",
+advanced:"Advanced",
+file:"File/URL",
+list:"List",
+size:"Dimensions",
+preview:"Preview",
+constrain_proportions:"Constrain proportions",
+type:"Type",
+id:"Id",
+name:"Name",
+class_name:"Class",
+vspace:"V-Space",
+hspace:"H-Space",
+play:"Auto play",
+loop:"Loop",
+menu:"Show menu",
+quality:"Quality",
+scale:"Scale",
+align:"Align",
+salign:"SAlign",
+wmode:"WMode",
+bgcolor:"Background",
+base:"Base",
+flashvars:"Flashvars",
+liveconnect:"SWLiveConnect",
+autohref:"AutoHREF",
+cache:"Cache",
+hidden:"Hidden",
+controller:"Controller",
+kioskmode:"Kiosk mode",
+playeveryframe:"Play every frame",
+targetcache:"Target cache",
+correction:"No correction",
+enablejavascript:"Enable JavaScript",
+starttime:"Start time",
+endtime:"End time",
+href:"Href",
+qtsrcchokespeed:"Choke speed",
+target:"Target",
+volume:"Volume",
+autostart:"Auto start",
+enabled:"Enabled",
+fullscreen:"Fullscreen",
+invokeurls:"Invoke URLs",
+mute:"Mute",
+stretchtofit:"Stretch to fit",
+windowlessvideo:"Windowless video",
+balance:"Balance",
+baseurl:"Base URL",
+captioningid:"Captioning id",
+currentmarker:"Current marker",
+currentposition:"Current position",
+defaultframe:"Default frame",
+playcount:"Play count",
+rate:"Rate",
+uimode:"UI Mode",
+flash_options:"Flash options",
+qt_options:"Quicktime options",
+wmp_options:"Windows media player options",
+rmp_options:"Real media player options",
+shockwave_options:"Shockwave options",
+autogotourl:"Auto goto URL",
+center:"Center",
+imagestatus:"Image status",
+maintainaspect:"Maintain aspect",
+nojava:"No java",
+prefetch:"Prefetch",
+shuffle:"Shuffle",
+console:"Console",
+numloop:"Num loops",
+controls:"Controls",
+scriptcallbacks:"Script callbacks",
+swstretchstyle:"Stretch style",
+swstretchhalign:"Stretch H-Align",
+swstretchvalign:"Stretch V-Align",
+sound:"Sound",
+progress:"Progress",
+qtsrc:"QT Src",
+qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.",
+align_top:"Top",
+align_right:"Right",
+align_bottom:"Bottom",
+align_left:"Left",
+align_center:"Center",
+align_top_left:"Top left",
+align_top_right:"Top right",
+align_bottom_left:"Bottom left",
+align_bottom_right:"Bottom right",
+flv_options:"Flash video options",
+flv_scalemode:"Scale mode",
+flv_buffer:"Buffer",
+flv_startimage:"Start image",
+flv_starttime:"Start time",
+flv_defaultvolume:"Default volume",
+flv_hiddengui:"Hidden GUI",
+flv_autostart:"Auto start",
+flv_loop:"Loop",
+flv_showscalemodes:"Show scale modes",
+flv_smoothvideo:"Smooth video",
+flv_jscallback:"JS Callback"
+});
+
+tinyMCE.addI18n("en.wordpress",{
+wp_adv_desc:"Show/Hide Kitchen Sink (Alt+Shift+Z)",
+wp_more_desc:"Insert More tag (Alt+Shift+T)",
+wp_page_desc:"Insert Page break (Alt+Shift+P)",
+wp_help_desc:"Help (Alt+Shift+H)",
+wp_more_alt:"More...",
+wp_page_alt:"Next page...",
+add_media:"Add Media",
+add_image:"Add an Image",
+add_video:"Add Video",
+add_audio:"Add Audio",
+editgallery:"Edit Gallery",
+delgallery:"Delete Gallery"
+});
+
+tinyMCE.addI18n("en.wpeditimage",{
+edit_img:"Edit Image",
+del_img:"Delete Image",
+adv_settings:"Advanced Settings",
+none:"None",
+size:"Size",
+thumbnail:"Thumbnail",
+medium:"Medium",
+full_size:"Full Size",
+current_link:"Current Link",
+link_to_img:"Link to Image",
+link_help:"Enter a link URL or click above for presets.",
+adv_img_settings:"Advanced Image Settings",
+source:"Source",
+width:"Width",
+height:"Height",
+orig_size:"Original Size",
+css:"CSS Class",
+adv_link_settings:"Advanced Link Settings",
+link_rel:"Link Rel",
+height:"Height",
+orig_size:"Original Size",
+css:"CSS Class",
+s60:"60%",
+s70:"70%",
+s80:"80%",
+s90:"90%",
+s100:"100%",
+s110:"110%",
+s120:"120%",
+s130:"130%",
+img_title:"Edit Image Title",
+caption:"Edit Image Caption",
+alt:"Edit Alternate Text"
+});
index 75f10a7e6cd625550b6fb3095343bc9bf7d8d80c..af6d6d80e6affd1d190d12a83d4298c850d58d89 100644 (file)
@@ -1,5 +1,18 @@
 <?php
 
 <?php
 
+function mce_put_file( $path, $content ) {
+       if ( function_exists('file_put_contents') )
+               return @file_put_contents( $path, $content );
+
+       $newfile = false;
+       $fp = @fopen( $path, 'wb' );
+       if ($fp) {
+               $newfile = fwrite( $fp, $content );
+               fclose($fp);
+       }
+       return $newfile;
+}
+
 // escape text only if it needs translating
 function mce_escape($text) {
        global $language;
 // escape text only if it needs translating
 function mce_escape($text) {
        global $language;
@@ -8,7 +21,7 @@ function mce_escape($text) {
        else return js_escape($text);
 }
 
        else return js_escape($text);
 }
 
-$strings = 'tinyMCE.addI18n({' . $language . ':{
+$lang = 'tinyMCE.addI18n({' . $language . ':{
 common:{
 edit_confirm:"' . mce_escape( __('Do you want to use the WYSIWYG mode for this textarea?') ) . '",
 apply:"' . mce_escape( __('Apply') ) . '",
 common:{
 edit_confirm:"' . mce_escape( __('Do you want to use the WYSIWYG mode for this textarea?') ) . '",
 apply:"' . mce_escape( __('Apply') ) . '",
@@ -399,7 +412,9 @@ wp_page_alt:"' . mce_escape( __('Next page...') ) . '",
 add_media:"' . mce_escape( __('Add Media') ) . '",
 add_image:"' . mce_escape( __('Add an Image') ) . '",
 add_video:"' . mce_escape( __('Add Video') ) . '",
 add_media:"' . mce_escape( __('Add Media') ) . '",
 add_image:"' . mce_escape( __('Add an Image') ) . '",
 add_video:"' . mce_escape( __('Add Video') ) . '",
-add_audio:"' . mce_escape( __('Add Audio') ) . '"
+add_audio:"' . mce_escape( __('Add Audio') ) . '",
+editgallery:"' . mce_escape( __('Edit Gallery') ) . '",
+delgallery:"' . mce_escape( __('Delete Gallery') ) . '"
 });
 
 tinyMCE.addI18n("' . $language . '.wpeditimage",{
 });
 
 tinyMCE.addI18n("' . $language . '.wpeditimage",{
@@ -438,4 +453,3 @@ caption:"' . mce_escape( __('Edit Image Caption') ) . '",
 alt:"' . mce_escape( __('Edit Alternate Text') ) . '"
 });
 ';
 alt:"' . mce_escape( __('Edit Alternate Text') ) . '"
 });
 ';
-?>
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/plugins/autosave/readme.txt b/wp-includes/js/tinymce/plugins/autosave/readme.txt
deleted file mode 100644 (file)
index 4fdb78a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Check the TinyMCE documentation for details on this plugin.\r
index 1f0cc1bdad3b4c9d75bf37fcf649962d75f7ac99..fbcec59e875ee2f5dfa6d73dcc0909a35f3a19a4 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(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 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
index 3209e0678e99b452d65fcb0007a9b9fd90e7c98a..430f798c21ff6c30d1e99ff4c32385c5915db52e 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=311"></script>
+       <script type="text/javascript" src="../../tiny_mce.js?ver=3211"></script>
        <script type="text/javascript">
                function patchCallback(settings, key) {
                        if (settings[key])
        <script type="text/javascript">
                function patchCallback(settings, key) {
                        if (settings[key])
index 3649c8dfac1b0a731bb8540efc5ff9c679323573..5560b6b1894f2c466558cc9ca5921c9eed892642 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;},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);}}});t.windows=t.windows||{};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'){DOM.add(DOM.doc.body,'div',{id:'mceModalBlocker','class':(t.editor.settings.inlinepopups_skin||'clearlooks2')+'_modalBlocker',style:{left:vp.x,top:vp.y,zIndex:t.zIndex-1}});DOM.show('mceModalBlocker');}else DOM.setStyle('mceModalBlocker','z-index',t.zIndex-1);if(tinymce.isIE6||(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=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:{left:vp.x,top:vp.y,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);t.count--;if(t.count==0)DOM.remove('mceModalBlocker');if(!id&&win){t.parent(win);return;}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 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
index 8c25ceb1d38ba1ac2c5046919a9dfeb0bab19c72..4bd3a1bbe7009248e599bd3dac9ae86ecceaead1 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=311" />
+<link rel="stylesheet" type="text/css" href="skins/clearlooks2/window.css?ver=3211" />
 </head>
 <body>
 
 </head>
 <body>
 
index 4ee35492ee70e92b0cd0d50a1d0de62318a12711..b226b00d3e72e7d28c5202f5d03a848626865625 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|_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'};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(function(ed,o){var 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="'+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,'_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;});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(/_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};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});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='';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(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],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,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}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 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
index 0f0cfd6448b81ed229523999263604f6cad6d2d1..27439fe52c48897c9c1906893c216702ffd90f8f 100644 (file)
@@ -183,7 +183,7 @@ function insertMedia() {
        tinyMCEPopup.restoreSelection();
 
        if (!AutoValidator.validate(f)) {
        tinyMCEPopup.restoreSelection();
 
        if (!AutoValidator.validate(f)) {
-               alert(ed.getLang('invalid_data'));
+               tinyMCEPopup.alert(ed.getLang('invalid_data'));
                return false;
        }
 
                return false;
        }
 
@@ -359,7 +359,9 @@ function changedType(t) {
        d.getElementById('shockwave_options').style.display = 'none';
        d.getElementById('wmp_options').style.display = 'none';
        d.getElementById('rmp_options').style.display = 'none';
        d.getElementById('shockwave_options').style.display = 'none';
        d.getElementById('wmp_options').style.display = 'none';
        d.getElementById('rmp_options').style.display = 'none';
-       d.getElementById(t + '_options').style.display = 'block';
+
+       if (t)
+               d.getElementById(t + '_options').style.display = 'block';
 }
 
 function serializeParameters() {
 }
 
 function serializeParameters() {
@@ -600,7 +602,7 @@ function generatePreview(c) {
 
        // Avoid annoying warning about insecure items
        if (!tinymce.isIE || document.location.protocol != 'https:') {
 
        // Avoid annoying warning about insecure items
        if (!tinymce.isIE || document.location.protocol != 'https:') {
-               h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
+               h += '<object classid="' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
 
                for (n in pl) {
                        h += '<param name="' + n + '" value="' + pl[n] + '">';
 
                for (n in pl) {
                        h += '<param name="' + n + '" value="' + pl[n] + '">';
index a663cbef1aec31682293602b4ba5c6a6c4a055cf..a6a3344d0b886c415d9b65d87828e61524b00be9 100644 (file)
@@ -2,13 +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=311"></script>
-       <script type="text/javascript" src="js/media.js?ver=311"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
-       <script type="text/javascript" src="../../utils/validate.js?ver=311"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
-       <script type="text/javascript" src="../../utils/editable_selects.js?ver=311"></script>
-       <link href="css/media.css?ver=311" rel="stylesheet" type="text/css" />
+       <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" />
 </head>
 <body style="display: none">
        <base target="_self" />
 </head>
 <body style="display: none">
index 0db61aa4e6105b32fade171d79f3c1e77adfe8b6..b99dd17d497788e7d10425ae7d7f157aaa112a0a 100644 (file)
@@ -2,7 +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=311" rel="stylesheet" type="text/css" />
+<link href="css/blank.css?ver=3211" rel="stylesheet" type="text/css" />
 <base target="_self" />
 <script type="text/javascript">
 function init() {
 <base target="_self" />
 <script type="text/javascript">
 function init() {
index 4a35002b46e34c0ebbfd2cba8964c1ebb1c6b44a..eeeebd5bb7b4222835d63dec9a43e00ce6407831 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(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,...,\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]);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(new RegExp('<(!--)([^>]*)(--)>','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 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
index 010961594d29f7e54a737d6b79e974feae0e12c3..19cdbf4bd6ddec1612ebda2b4d05aab65cf94296 100644 (file)
@@ -2,8 +2,8 @@
 <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=311"></script>
-       <script type="text/javascript" src="js/pastetext.js?ver=311"></script>
+       <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" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
        <base target="_self" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
@@ -31,4 +31,4 @@
        </div>
 </form>
 </body> 
        </div>
 </form>
 </body> 
-</html>
\ No newline at end of file
+</html>
index 99c0348bbc404a2452fc8d00cbac60420586f9ed..8c74b399409cb28d4ef9e1b930f21efa77c80377 100644 (file)
@@ -2,9 +2,9 @@
 <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=311"></script>
-       <script type="text/javascript" src="js/pasteword.js?ver=311"></script>
-       <link href="css/pasteword.css?ver=311" rel="stylesheet" type="text/css" />
+       <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" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
        <base target="_self" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
index 332b0e70218adb5c54d24b4b6d8d381341bab6d1..4daac19ffac59a466fea3c141bad8e882ca225ca 100644 (file)
@@ -1 +1 @@
-(function(){var Event=tinymce.dom.Event,grep=tinymce.grep,each=tinymce.each,inArray=tinymce.inArray,isOldWebKit=tinymce.isOldWebKit;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;if(e.keyCode==46||e.keyCode==8){b=ed.getBody();h=b.innerHTML;if(b.childNodes.length==1&&!/<(img|hr)/.test(h)&&tinymce.trim(h.replace(/<[^>]+>/g,'')).length==0)ed.setContent('',{format:'raw'});}});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,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){if(e.keyCode==13&&(e.shiftKey||ed.settings.force_br_newlines&&ed.selection.getNode().nodeName!='LI')){t._insertBR(ed);Event.cancel(e);}});ed.addQueryValueHandler('FontSize',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontSize))return tinymce.inArray(t.namedFontSizes,v)+1;return ed.getDoc().queryCommandValue('FontSize');});ed.addQueryValueHandler('FontName',function(u,v){var e,v;if((e=ed.dom.getParent(ed.selection.getStart(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');if((e=ed.dom.getParent(ed.selection.getEnd(),'span'))&&(v=e.style.fontFamily))return v.replace(/, /g,',');return ed.getDoc().queryCommandValue('FontName');});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 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
diff --git a/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php b/wp-includes/js/tinymce/plugins/spellchecker/classes/EnchantSpell.php
new file mode 100644 (file)
index 0000000..59133c6
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/**
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ *
+ * This class was contributed by Michel Weimerskirch.
+ *
+ * @package MCManager.includes
+ * @author Moxiecode
+ * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
+ */
+
+class EnchantSpell extends SpellChecker {
+       /**
+        * Spellchecks an array of words.
+        *
+        * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
+        * @param Array $words Array of words to check.
+        * @return Array of misspelled words.
+        */
+       function &checkWords($lang, $words) {
+               $r = enchant_broker_init();
+               
+               if (enchant_broker_dict_exists($r,$lang)) {
+                       $d = enchant_broker_request_dict($r, $lang);
+                       
+                       $returnData = array();
+                       foreach($words as $key => $value) {
+                               $correct = enchant_dict_check($d, $value);
+                               if(!$correct) {
+                                       $returnData[] = trim($value);
+                               }
+                       }
+       
+                       return $returnData;
+                       enchant_broker_free_dict($d);
+               } else {
+
+               }
+               enchant_broker_free($r);
+       }
+
+       /**
+        * Returns suggestions for a specific word.
+        *
+        * @param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
+        * @param String $word Specific word to get suggestions for.
+        * @return Array of suggestions for the specified word.
+        */
+       function &getSuggestions($lang, $word) {
+               $r = enchant_broker_init();
+               $suggs = array();
+
+               if (enchant_broker_dict_exists($r,$lang)) {
+                       $d = enchant_broker_request_dict($r, $lang);
+                       $suggs = enchant_dict_suggest($d, $word);
+
+                       enchant_broker_free_dict($d);
+               } else {
+
+               }
+               enchant_broker_free($r);
+
+               return $suggs;
+       }
+}
+
+?>
\ No newline at end of file
index 00c9f9f4ed3b3bb030555c0c82c31b85e93e729a..446b96ac77ba6f459bd80cf36546e39caaeec600 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
+ * @package MCManager.includes
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
index 48af87379adcf53e17f676095e8fccbbd40f1dc0..3c6424d86e84d47e9ef0de3d6d84973e05ca42c8 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
+ * @package MCManager.includes
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
index 779e837227f52103bcf21e3d59b608769f0f5a6a..7d3102c75aa6b3ffeec5d9eb9a830ddc10dc87e1 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
+ * @package MCManager.includes
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
@@ -103,10 +104,10 @@ class PSpellShell extends SpellChecker {
                $this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
 
                if(preg_match("#win#i", php_uname()))
                $this->_tmpfile = tempnam($this->_config['PSpellShell.tmp'], "tinyspell");
 
                if(preg_match("#win#i", php_uname()))
-                       return $this->_config['PSpellShell.aspell'] . " -a --lang=". $lang . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1";
+                       return $this->_config['PSpellShell.aspell'] . " -a --lang=". escapeshellarg($lang) . " --encoding=utf-8 -H < " . $this->_tmpfile . " 2>&1";
 
 
-               return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". $lang;
+               return "cat ". $this->_tmpfile ." | " . $this->_config['PSpellShell.aspell'] . " -a --encoding=utf-8 -H --lang=". escapeshellarg($lang);
        }
 }
 
        }
 }
 
-?>
+?>
\ No newline at end of file
index ca7b14321be96d18f25fc78676193c9e13db9e3b..5d9205fe6e7236d0e072999313a227802caf068d 100644 (file)
@@ -2,6 +2,7 @@
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
 /**
  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
  *
+ * @package MCManager.includes
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
@@ -20,7 +21,7 @@ class SpellChecker {
         * Simple loopback function everything that gets in will be send back.
         *
         * @param $args.. Arguments.
         * Simple loopback function everything that gets in will be send back.
         *
         * @param $args.. Arguments.
-        * @return {Array} Array of all input arguments.
+        * @return {Array} Array of all input arguments. 
         */
        function &loopback(/* args.. */) {
                return func_get_args();
         */
        function &loopback(/* args.. */) {
                return func_get_args();
index a5185700829652bcf03848540d48a7e36785a767..fb15b8092cb65997bb94f38523ac031ecc02e4e7 100644 (file)
@@ -1,8 +1,15 @@
 <?php
 <?php
+/**
+ * config.php
+ * @package MCManager.includes
+ * @author Moxiecode
+ * @copyright Copyright Â© 2007, Moxiecode Systems AB, All rights reserved.
+ */
        // General settings
        $config['general.engine'] = 'GoogleSpell';
        //$config['general.engine'] = 'PSpell';
        //$config['general.engine'] = 'PSpellShell';
        // General settings
        $config['general.engine'] = 'GoogleSpell';
        //$config['general.engine'] = 'PSpell';
        //$config['general.engine'] = 'PSpellShell';
+       //$config['general.remote_rpc_url'] = 'http://some.other.site/some/url/rpc.php';
 
        // PSpell settings
        $config['PSpell.mode'] = PSPELL_FAST;
 
        // PSpell settings
        $config['PSpell.mode'] = PSPELL_FAST;
index 72c1a7a625c9d13253f42e1cf27dc1e7664144b6..a76239bbc88b869f31e73d3c31564224df85d99b 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 : tinymce.majorVersion + "." + tinymce.minorVersion
+                               version : "2.0.2"
                        };
                },
 
                        };
                },
 
                },
 
                _sendRPC : function(m, p, cb) {
                },
 
                _sendRPC : function(m, p, cb) {
-                       var t = this, url = t.editor.getParam("spellchecker_rpc_url", this.url+"/rpc.php");
+                       var t = this, url = t.editor.getParam("spellchecker_rpc_url", this.url+'/rpc.php');
 
                        if (url == '{backend}') {
                                t.editor.setProgressState(0);
 
                        if (url == '{backend}') {
                                t.editor.setProgressState(0);
 
        // Register plugin
        tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
 
        // Register plugin
        tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
-})();
\ No newline at end of file
+})();
index d7b74362e7069891a5f405173edf79037f63dcf5..d996c5ddd5c70112b995b4b80bbd41dafc0c4e5a 100644 (file)
@@ -1,7 +1,8 @@
 <?php
 /**
 <?php
 /**
- * $Id: rpc.php 354 2007-11-05 20:48:49Z spocke $
+ * $Id: rpc.php 822 2008-04-28 13:45:03Z spocke $
  *
  *
+ * @package MCManager.includes
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
  * @author Moxiecode
  * @copyright Copyright Â© 2004-2007, Moxiecode Systems AB, All rights reserved.
  */
@@ -51,6 +52,42 @@ if (!$raw) {
 if (!$raw)
        die('{"result":null,"id":null,"error":{"errstr":"Could not get raw post data.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
 
 if (!$raw)
        die('{"result":null,"id":null,"error":{"errstr":"Could not get raw post data.","errfile":"","errline":null,"errcontext":"","level":"FATAL"}}');
 
+// Passthrough request to remote server
+if (isset($config['general.remote_rpc_url'])) {
+       $url = parse_url($config['general.remote_rpc_url']);
+
+       // Setup request
+       $req = "POST " . $url["path"] . " HTTP/1.0\r\n";
+       $req .= "Connection: close\r\n";
+       $req .= "Host: " . $url['host'] . "\r\n";
+       $req .= "Content-Length: " . strlen($raw) . "\r\n";
+       $req .= "\r\n" . $raw;
+
+       if (!isset($url['port']) || !$url['port'])
+               $url['port'] = 80;
+
+       $errno = $errstr = "";
+
+       $socket = fsockopen($url['host'], intval($url['port']), $errno, $errstr, 30);
+       if ($socket) {
+               // Send request headers
+               fputs($socket, $req);
+
+               // Read response headers and data
+               $resp = "";
+               while (!feof($socket))
+                               $resp .= fgets($socket, 4096);
+
+               fclose($socket);
+
+               // Split response header/data
+               $resp = explode("\r\n\r\n", $resp);
+               echo $resp[1]; // Output body
+       }
+
+       die();
+}
+
 // Get JSON data
 $json = new Moxiecode_JSON();
 $input = $json->decode($raw);
 // Get JSON data
 $json = new Moxiecode_JSON();
 $input = $json->decode($raw);
index faff841500cc7f49e07393706aff160d7951a3b4..f5ce86158c9259724a31a75edf0f61e86bc7f3ac 100644 (file)
@@ -14,7 +14,7 @@
                        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')+'" />';
 
                        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 ( tinymce.util.Cookie.get('kitchenSink') == '1' )
+                       if ( getUserSetting('hidetb', '0') == '1' )
                                ed.settings.wordpress_adv_hidden = 0;
 
                        // Hides the specified toolbar and resizes the iframe
                                ed.settings.wordpress_adv_hidden = 0;
 
                        // Hides the specified toolbar and resizes the iframe
                                });
 
                        ed.addCommand('WP_Adv', function() {
                                });
 
                        ed.addCommand('WP_Adv', function() {
-                               var id = ed.controlManager.get(tbId).id, cm = ed.controlManager, cook = tinymce.util.Cookie, date;
-
-                               date = new Date();
-                               date.setTime(date.getTime()+(10*365*24*60*60*1000));
+                               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;
 
                                if (DOM.isHidden(id)) {
                                        cm.setActive('wp_adv', 1);
                                        DOM.show(id);
                                        t._resizeIframe(ed, tbId, -28);
                                        ed.settings.wordpress_adv_hidden = 0;
-                                       cook.set('kitchenSink', '1', date);
+                                       setUserSetting('hidetb', '1');
                                } else {
                                        cm.setActive('wp_adv', 0);
                                        DOM.hide(id);
                                        t._resizeIframe(ed, tbId, 28);
                                        ed.settings.wordpress_adv_hidden = 1;
                                } else {
                                        cm.setActive('wp_adv', 0);
                                        DOM.hide(id);
                                        t._resizeIframe(ed, tbId, 28);
                                        ed.settings.wordpress_adv_hidden = 1;
-                                       cook.set('kitchenSink', '0', date);
+                                       setUserSetting('hidetb', '0');
                                }
                        });
 
                                }
                        });
 
                do_align : function(n, a) {
                        var P, DL, DIV, cls, c, ed = tinyMCE.activeEditor;
 
                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');
                        P = ed.dom.getParent(n, 'p');
                        DL = ed.dom.getParent(n, 'dl');
                        DIV = ed.dom.getParent(n, 'div');
index 112f5db0f5214db4b91ad2e5e8cdf82f0c17ee00..26974d3400ad78e721e1061707fae46c0f2c928c 100644 (file)
@@ -6,19 +6,30 @@ html, body {
 }
 
 .submit input,
 }
 
 .submit input,
-.button {
+.button,
+.button-primary,
+.button-secondary,
+.button-highlighted {
        font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
        font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
-       padding: 3px 5px;
-       font-size: 12px;
-       line-height: 1.5em;
+       text-decoration: none;
+       font-size: 11px !important;
+       line-height: 16px;
+       padding: 2px 8px;
+       cursor: pointer;
        border-width: 1px;
        border-style: solid;
        border-width: 1px;
        border-style: solid;
-       -moz-border-radius: 3px;
-       -khtml-border-radius: 3px;
-       -webkit-border-radius: 3px;
-       border-radius: 3px;
-       cursor: pointer;
-       text-decoration: none;
+       -moz-border-radius: 11px;
+       -khtml-border-radius: 11px;
+       -webkit-border-radius: 11px;
+       border-radius: 11px;
+       -moz-box-sizing: content-box;
+       -webkit-box-sizing: content-box;
+       -khtml-box-sizing: content-box;
+       box-sizing: content-box;
+}
+
+a.button {
+       padding: 4px 8px;
 }
 
 textarea,
 }
 
 textarea,
@@ -77,8 +88,8 @@ th.label {
        overflow: hidden;
 }
 
        overflow: hidden;
 }
 
-#media-upload #img-edit {
-       border: 1px solid #c0c0c0;
+#img-edit {
+       border: 1px solid #dfdfdf;
        width: 623px;
        margin: 15px auto;
 }
        width: 623px;
        margin: 15px auto;
 }
@@ -89,11 +100,10 @@ th.label {
 }
 
 #img_demo_txt {
 }
 
 #img_demo_txt {
-       font-size: 6px;
-       line-height: 10px;
-       font-family: "Courier New",Courier,monotype;
-       color: #ccc;
-       background-color: #ccc;
+       font-size: 9px;
+       line-height: 13px;
+       font-family: Monaco,"Courier New",Courier,monospace;
+       color: #888;
 }
 
 #img_demo {
 }
 
 #img_demo {
@@ -121,6 +131,7 @@ th.label {
        border-top-width: 1px;
        display: block;
        float: left;
        border-top-width: 1px;
        display: block;
        float: left;
+       height: 28px;
        line-height: 28px;
        text-decoration: none;
        text-align: center;
        line-height: 28px;
        text-decoration: none;
        text-align: center;
@@ -237,3 +248,96 @@ td {
 #img_align_td {
        padding: 2px 0 8px;
 }
 #img_align_td {
        padding: 2px 0 8px;
 }
+
+#media-upload tr.align td.field {
+       text-align: center;
+}
+
+.describe td {
+       vertical-align: middle;
+}
+
+#media-upload .describe th.label {
+       padding-top: .5em;
+       text-align: left;
+}
+
+#media-upload .describe {
+       border-top-width: 1px;
+       border-top-style: solid;
+       padding: 5px;
+       width: 100%;
+       clear: both;
+       cursor: default;
+}
+
+form {
+       margin: 1em;
+}
+
+.describe input[type="text"],
+.describe textarea {
+       width: 460px;
+       border: 1px solid #dfdfdf;
+}
+
+
+.media-upload-form label,
+.media-upload-form legend {
+       font-weight: bold;
+       font-size: 13px;
+       color: #464646;
+}
+
+.align .field label {
+       display: inline;
+       padding: 0 0 0 28px;
+       margin: 0 1em 0 0;
+}
+.image-align-none-label {
+       background: url(../../../../../../wp-admin/images/align-none.png) no-repeat center left;
+}
+
+.image-align-left-label {
+       background: url(../../../../../../wp-admin/images/align-left.png) no-repeat center left;
+}
+
+.image-align-center-label {
+       background: url(../../../../../../wp-admin/images/align-center.png) no-repeat center left;
+}
+
+.image-align-right-label {
+       background: url(../../../../../../wp-admin/images/align-right.png) no-repeat center left;
+}
+
+div#media-upload-header {
+       margin: 0;
+       padding: 0 5px;
+       font-weight: bold;
+       position: relative;
+       border-bottom-width: 1px;
+       border-bottom-style: solid;
+       height: 2.5em;
+}
+
+body#media-upload ul#sidemenu {
+       font-weight: normal;
+       margin: 0 5px;
+       position: relative;
+       left: 0px;
+       bottom: -4px;
+}
+
+div#media-upload-error {
+       margin: 1em;
+       font-weight: bold;
+}
+
+* html #sidemenu li {
+       zoom: 100%;
+}
+
+* html #sidemenu a {
+       height: 27px;
+       line-height: 26px;
+}
index 55554d72720159901e4c37b5247b74b4f749d15b..5768e9f144c63c7f3814af7f1b3f25a855364c13 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=311g"></script>
-<script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
+<script type="text/javascript" src="js/editimage.js?ver=321"></script>
+<script type="text/javascript" src="../../utils/form_utils.js?ver=321"></script>
+
+<link rel="stylesheet" href="css/editimage.css?ver=321" type="text/css" media="all" />
 
 
-<link rel="stylesheet" href="css/editimage.css?ver=311g" type="text/css" media="all" />
-<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6.1" 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=311" type="text/css" media="all" />');
+       document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=321" type="text/css" media="all" />');
 </script>
 <base target="_self" />
 </head>
 </script>
 <base target="_self" />
 </head>
index d0ca4ed5a954dd094ac5025ed859f6f9e02d8ef1..f24d0bafae768e88baec9874c27bcaff445147bb 100644 (file)
 
                        // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
                        ed.addCommand('WP_EditImage', function() {
 
                        // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
                        ed.addCommand('WP_EditImage', function() {
-                               var el = ed.selection.getNode();
+                               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 ( ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 || el.nodeName != 'IMG' )
+                               if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 || el.nodeName != 'IMG' )
                                        return;
 
                                        return;
 
-                               tb_show('', url + '/editimage.html?ver=311g&TB_iframe=true');
+                               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' );
                        });
 
                                tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
                        });
 
 
                showButtons : function(n) {
                        var t = this, ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
 
                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 (ed.dom.getAttrib(n, 'class').indexOf('mceItem') != -1)
+                       if ( cls.indexOf('mceItem') != -1 || cls.indexOf('wpGallery') != -1 )
                                return;
 
                        vp = ed.dom.getViewPort(ed.getWin());
                                return;
 
                        vp = ed.dom.getViewPort(ed.getWin());
diff --git a/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js b/wp-includes/js/tinymce/plugins/wpgallery/editor_plugin.js
new file mode 100644 (file)
index 0000000..bdb6b7c
--- /dev/null
@@ -0,0 +1,174 @@
+\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
diff --git a/wp-includes/js/tinymce/plugins/wpgallery/img/delete.png b/wp-includes/js/tinymce/plugins/wpgallery/img/delete.png
new file mode 100644 (file)
index 0000000..d64d8a6
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wpgallery/img/delete.png differ
diff --git a/wp-includes/js/tinymce/plugins/wpgallery/img/edit.png b/wp-includes/js/tinymce/plugins/wpgallery/img/edit.png
new file mode 100644 (file)
index 0000000..41def51
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wpgallery/img/edit.png differ
diff --git a/wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png b/wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png
new file mode 100644 (file)
index 0000000..803ad63
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wpgallery/img/gallery.png differ
diff --git a/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif b/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif
new file mode 100644 (file)
index 0000000..3884865
Binary files /dev/null and b/wp-includes/js/tinymce/plugins/wpgallery/img/t.gif differ
index 6dc74ba7b817f96b6173a9249cbd814d22a7781c..23b51cbcdf9b9cd23dbc6f49dbf4655705fb00a9 100644 (file)
@@ -2,9 +2,9 @@
 <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=311"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
-       <script type="text/javascript" src="js/about.js?ver=311"></script>
+       <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>
 </head>
 <body id="about" style="display: none">
                <div class="tabs">
 </head>
 <body id="about" style="display: none">
                <div class="tabs">
index a97b7cec93b0306a972457623f8c09c0693427ad..f259c6394356c9d7f8c229d727381319e18ae11f 100644 (file)
@@ -2,8 +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=311"></script>
-       <script type="text/javascript" src="js/anchor.js?ver=311"></script>
+       <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" />
 </head>
 <body style="display: none">
        <base target="_self" />
 </head>
 <body style="display: none">
index 0d422ba724a63bb5855b7693568306d902f1a903..cb495d816cef05960bac7c17a6d49090afaeb39f 100644 (file)
@@ -3,8 +3,8 @@
 <head>
        <title>{#advanced_dlg.charmap_title}</title>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
 <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=311"></script>
-       <script type="text/javascript" src="js/charmap.js?ver=311"></script>
+       <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" />
 </head>
 <body id="charmap" style="display:none">
        <base target="_self" />
 </head>
 <body id="charmap" style="display:none">
index faaa8400923881be4741120af95544779a8e7256..d8ffcaa82c0306069e3baf205a1a60de696252bb 100644 (file)
@@ -2,9 +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=311"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
-       <script type="text/javascript" src="js/color_picker.js?ver=311"></script>
+       <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" />
 </head>
 <body id="colorpicker" style="display: none">
        <base target="_self" />
 </head>
 <body id="colorpicker" style="display: none">
index eea384f751aac2080c8f229e7a60f142f8c6cbdf..d72d5425f3ed2aac6d0a0b318c3abb056f4c7244 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',{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;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_font_sizes:"1,2,3,4,5,6,7",theme_advanced_more_colors:1,theme_advanced_row_height:23,theme_advanced_resize_horizontal:1,theme_advanced_resizing_use_cookie:1},ed.settings);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(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/skins/"+ed.settings.skin+"/ui.css"));if(s.skin_variant)DOM.loadCSS(ed.baseURI.toAbsolute(s.editor_css||"themes/advanced/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){Event.add(n.id+'_text','focus',t._importClasses,t);Event.add(n.id+'_text','mousedown',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,lo=["1 (8 pt)","2 (10 pt)","3 (12 pt)","4 (14 pt)","5 (18 pt)","6 (24 pt)","7 (36 pt)"],fz=[8,10,12,14,18,24,36];c=ed.controlManager.createListBox('fontsizeselect',{title:'advanced.font_size',cmd:'FontSize'});if(c){each(ed.getParam('theme_advanced_font_sizes',t.settings.theme_advanced_font_sizes,'hash'),function(v,k){c.add(k!=v?k:lo[parseInt(v)-1],v,{'style':'font-size:'+fz[v-1]+'pt','class':'mceFontSize'+v});});}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;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;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(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;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(c=cm.get('fontselect'))c.select(ed.queryCommandValue('FontName'));if(c=cm.get('fontsizeselect'))c.select(''+ed.queryCommandValue('FontSize'));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||(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(){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
index af3cbfdb94766fecc6ba9cf2eb278dafa7a00592..e8eac798723be4e73b15298115f0960ec42cb24b 100644 (file)
@@ -2,10 +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=311"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
-       <script type="text/javascript" src="js/image.js?ver=311"></script>
+       <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" />
 </head>
 <body id="image" style="display: none">
        <base target="_self" />
 </head>
 <body id="image" style="display: none">
index 277550fb5eb2342728cbf4d54655d2ce2af663ef..7fc8ba2a3f57b3963b1f29927bee14db1781f7f7 100644 (file)
@@ -7,7 +7,7 @@ function init() {
        ed = tinyMCEPopup.editor;
 
        // Give FF some time
        ed = tinyMCEPopup.editor;
 
        // Give FF some time
-       window.setTimeout('insertHelpIFrame();', 10);
+       window.setTimeout(insertHelpIFrame, 10);
 
        tcont = document.getElementById('plugintablecontainer');
        document.getElementById('plugins_tab').style.display = 'none';
 
        tcont = document.getElementById('plugintablecontainer');
        document.getElementById('plugins_tab').style.display = 'none';
index 63c843d2d011022a0e7cb8e3bbb3935761d42379..a5ad46f72765cc13f5c2cfc264cab00b31e506f8 100644 (file)
@@ -76,7 +76,7 @@ var ImageDialog = {
                        });
                } else
                        args.style = this.styleVal;
                        });
                } else
                        args.style = this.styleVal;
-               
+
                tinymce.extend(args, {
                        src : f.src.value,
                        alt : f.alt.value,
                tinymce.extend(args, {
                        src : f.src.value,
                        alt : f.alt.value,
index 7a4699b52011faff581d652f6b6ff3484cf07623..97b583351ff098cb544a6b37831464ef4215c2de 100644 (file)
@@ -2,11 +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=311"></script>
-       <script type="text/javascript" src="../../utils/mctabs.js?ver=311"></script>
-       <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
-       <script type="text/javascript" src="../../utils/validate.js?ver=311"></script>
-       <script type="text/javascript" src="js/link.js?ver=311"></script>
+       <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" />
 </head>
 <body id="link" style="display: none">
        <base target="_self" />
 </head>
 <body id="link" style="display: none">
index 497dda30c57eb2763f9d73ead25c7543f6e0e4a0..8b21c0260492035730d93940f6edf12a103a92de 100644 (file)
@@ -50,7 +50,7 @@ padding-bottom:2px;
 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;}
-a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);}
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
 a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
 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.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
 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;}
index ba8d30a5bd2ce002924042a505d65f8b29d3c10d..2c90d498cc31d04d154a8abc7fa5fee8ab57a51d 100644 (file)
@@ -37,7 +37,7 @@
 .defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px}
 .defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
 .defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}
 .defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px}
 .defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
 .defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}
-.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30)}
+.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
 .defaultSkin .mceButtonLabeled {width:auto}
 .defaultSkin .mceButtonLabeled span.mceIcon {float:left}
 .defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
 .defaultSkin .mceButtonLabeled {width:auto}
 .defaultSkin .mceButtonLabeled span.mceIcon {float:left}
 .defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
 .defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
 .defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
 .defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;}
 .defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
 .defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
 .defaultSkin .mceSplitButton span.mceAction {width:20px; background:url(../../img/icons.gif) 20px 20px;}
-.defaultSkin .mceSplitButton a.mceOpen {width:9px; border:1px solid #F0F0EE;}
-.defaultSkin .mceSplitButton span.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0;}
+.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}
+.defaultSkin .mceSplitButton span.mceOpen {display:none}
 .defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
 .defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
-.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {border:1px solid #0A246A;}
-.defaultSkin table.mceSplitButtonEnabled:hover span.mceOpen, .defaultSkin .mceSplitButtonHover span.mceOpen, .defaultSkin .mceSplitButtonSelected span.mceOpen {background-color:#B2BBD0}
-.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled span.mceOpen {opacity:0.3; filter:alpha(opacity=30)}
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;}
+.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
 .defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}
 .defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}
 
 .defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}
 .defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}
 
 .defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}
 
 /* Progress,Resize */
 .defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}
 
 /* Progress,Resize */
-.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF}
+.defaultSkin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=50)'; filter:alpha(opacity=50); background:#FFF}
 .defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
 .defaultSkin .mcePlaceHolder {border:1px dotted gray}
 
 .defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
 .defaultSkin .mcePlaceHolder {border:1px dotted gray}
 
index e630fa7c4fcc080381bdb180099ddf8bc9a28d0e..4f6188294b3fff2b103fa303b067dd867f05a9b7 100644 (file)
@@ -50,7 +50,7 @@ padding-bottom:2px;
 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;}
-a.browse span.disabled {border:1px solid white; -moz-opacity:0.3; opacity:0.3; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=30);}
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
 a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
 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.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
 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;}
index 8363da1d4a26422f372cc42f6a717ab40c7242b7..0f8d5c24b6112cb03496a07b7cff1c9f7be7ceae 100644 (file)
@@ -40,7 +40,7 @@
 .o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
 .o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
 .o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px}
 .o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
 .o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
 .o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px}
-.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30)}
+.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
 .o2k7Skin .mceButtonLabeled {width:auto}
 .o2k7Skin .mceButtonLabeled span.mceIcon {float:left}
 .o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
 .o2k7Skin .mceButtonLabeled {width:auto}
 .o2k7Skin .mceButtonLabeled span.mceIcon {float:left}
 .o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
 .o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}
 .o2k7Skin .mceSplitButton a.mceAction {width:22px}
 .o2k7Skin .mceSplitButton span.mceAction {width:22px; background:url(../../img/icons.gif) 20px 20px}
 .o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}
 .o2k7Skin .mceSplitButton a.mceAction {width:22px}
 .o2k7Skin .mceSplitButton span.mceAction {width:22px; background:url(../../img/icons.gif) 20px 20px}
-.o2k7Skin .mceSplitButton a.mceOpen {width:10px}
-.o2k7Skin .mceSplitButton span.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}
+.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}
+.o2k7Skin .mceSplitButton span.mceOpen {display:none}
 .o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}
 .o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}
-.o2k7Skin table.mceSplitButtonEnabled:hover span.mceOpen, .o2k7Skin .mceSplitButtonHover span.mceOpen, .o2k7Skin .mceSplitButtonSelected span.mceOpen {background-position:-44px -44px}
-.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; filter:alpha(opacity=30)}
+.o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px}
+.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
 .o2k7Skin .mceSplitButtonActive {background-position:0 -44px}
 
 /* ColorSplitButton */
 .o2k7Skin .mceSplitButtonActive {background-position:0 -44px}
 
 /* ColorSplitButton */
 .o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}
 
 /* Progress,Resize */
 .o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}
 
 /* Progress,Resize */
-.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; filter:alpha(opacity=50); background:#FFF}
+.o2k7Skin .mceBlocker {position:absolute; left:0; top:0; z-index:1000; opacity:0.5; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=50); background:#FFF}
 .o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
 .o2k7Skin .mcePlaceHolder {border:1px dotted gray}
 
 .o2k7Skin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(../default/img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
 .o2k7Skin .mcePlaceHolder {border:1px dotted gray}
 
index caa7dbbb26bf9cb32d7aeca2a295db8ca0d90d2a..81dbfe4180b40c32b0f1f489035ca101614e409d 100644 (file)
@@ -1,8 +1,8 @@
 /* Black */
 /* Black */
-.o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton span.mceOpen, .o2k7SkinBlack .mceListBox .mceOpen {background-image:url(img/button_bg_black.png)}
+.o2k7SkinBlack .mceToolbar .mceToolbarStart span, .o2k7SkinBlack .mceToolbar .mceToolbarEnd span, .o2k7SkinBlack .mceButton, .o2k7SkinBlack .mceSplitButton, .o2k7SkinBlack .mceSeparator, .o2k7SkinBlack .mceSplitButton a.mceOpen, .o2k7SkinBlack .mceListBox a.mceOpen {background-image:url(img/button_bg_black.png)}
 .o2k7SkinBlack table, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}
 .o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0}
 .o2k7SkinBlack table, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}
 .o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0}
-.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0}
+.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0}
 .o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;}
 .o2k7SkinBlack .mceExternalToolbar, .o2k7SkinBlack .mceListBox .mceText, .o2k7SkinBlack div.mceMenu, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceFirst td, .o2k7SkinBlack table.mceLayout, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack table.mceLayout tr.mceLast td, .o2k7SkinBlack .mceIframeContainer {border-color: #535353;}
-.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)}
-.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#FFE7A1}
\ No newline at end of file
+.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)}
+.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1}
\ No newline at end of file
index bf3c479712aef966f7998044b18260d830c725d1..e8ae844f4aeda9ca9e700665f4388071fc3459a3 100644 (file)
@@ -1,5 +1,5 @@
 /* Silver */
 /* Silver */
-.o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton span.mceOpen, .o2k7SkinSilver .mceListBox .mceOpen {background-image:url(img/button_bg_silver.png)}
+.o2k7SkinSilver .mceToolbar .mceToolbarStart span, .o2k7SkinSilver .mceButton, .o2k7SkinSilver .mceSplitButton, .o2k7SkinSilver .mceSeparator, .o2k7SkinSilver .mceSplitButton a.mceOpen, .o2k7SkinSilver .mceListBox a.mceOpen {background-image:url(img/button_bg_silver.png)}
 .o2k7SkinSilver table, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}
 .o2k7SkinSilver .mceListBox .mceText {background:#FFF}
 .o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb}
 .o2k7SkinSilver table, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}
 .o2k7SkinSilver .mceListBox .mceText {background:#FFF}
 .o2k7SkinSilver .mceExternalToolbar, .o2k7SkinSilver .mceListBox .mceText, .o2k7SkinSilver div.mceMenu, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceFirst td, .o2k7SkinSilver table.mceLayout, .o2k7SkinSilver .mceMenuItemTitle a, .o2k7SkinSilver table.mceLayout tr.mceLast td, .o2k7SkinSilver .mceIframeContainer {border-color: #bbb}
index 344d7e2df9f5608536163aa3f142c736047c8d53..7e86f0c17764d4af170ca61d657cdfb49693af87 100644 (file)
@@ -1,54 +1,50 @@
 /* Generic */
 body {
 font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
 /* Generic */
 body {
 font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
-/*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;*/
-background:#E4F2FD;
+background:#f1f1f1;
 padding:0;
 margin:8px 8px 0 8px;
 }
 
 padding:0;
 margin:8px 8px 0 8px;
 }
 
-html {background:#E4F2FD;}
+html {background:#f1f1f1;}
 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;}
 
 /* Forms */
 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;}
 
 /* Forms */
-fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+fieldset {margin:0; padding:4px; border:1px solid #dfdfdf; font-family:Verdana, Arial; font-size:10px;}
 legend {color:#2B6FB6; font-weight:bold;}
 label.msg {display:none;}
 label.invalid {color:#EE0000; display:inline;}
 input.invalid {border:1px solid #EE0000;}
 legend {color:#2B6FB6; font-weight:bold;}
 label.msg {display:none;}
 label.invalid {color:#EE0000; display:inline;}
 input.invalid {border:1px solid #EE0000;}
-input {background:#FFF; border:1px solid #CCC;}
+input {background:#FFF; border:1px solid #dfdfdf;}
 input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
 input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
-input, select, textarea {border:1px solid #808080;}
+input, select, textarea {border:1px solid #dfdfdf;}
 input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
 input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
 .input_noborder {border:0;}
 
 /* Buttons */
 input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
 input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
 .input_noborder {border:0;}
 
 /* Buttons */
-#insert, #cancel, input.mceButton, .updateButton {
-border: 1px solid #bbb; 
-margin:0; 
-padding:0 0 1px;
-font-weight:bold;
-font-size: 11px;
-width:94px; 
-height:24px;
-background:url(img/fade-butt.png) 0 0;
-cursor:pointer;
+#insert, #cancel, #apply, .mceActionPanel .button, input.mceButton, .updateButton {
+       border: 1px solid #bbb; 
+       margin:0; 
+       padding:0 0 1px;
+       font-weight:bold;
+       font-size: 11px;
+       width:94px; 
+       height:24px;
+       background:url(img/fade-butt.png) 0 0;
+       cursor:pointer;
+       -moz-border-radius: 3px;
+       -khtml-border-radius: 3px;
+       -webkit-border-radius: 3px;
+       border-radius: 3px;
 }
 #insert:hover, #cancel:hover, input.mceButton:hover, .updateButton:hover,
 #insert:focus, #cancel:focus, input.mceButton:focus, .updateButton:focus {
 }
 #insert:hover, #cancel:hover, input.mceButton:hover, .updateButton:hover,
 #insert:focus, #cancel:focus, input.mceButton:focus, .updateButton:focus {
-border: 1px solid #555;
-} 
+       border: 1px solid #555;
+}
 
 /* Browse */
 a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
 
 /* Browse */
 a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
index df9043959d056b3f744920eb13bd4ab56d3771f0..adb83cdbbff4a131ad3dcf553e739afc7f477881 100644 (file)
Binary files a/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png and b/wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png differ
index c12d3a5b9952ea14786297e7569238a76165cdc3..0053a53480c77aa1373d6362e1a1370f0a7bada4 100644 (file)
@@ -19,9 +19,25 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
 .wp_themeSkin table.mceToolbar, .wp_themeSkin tr.mceFirst .mceToolbar tr td, .wp_themeSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}
 .wp_themeSkin table.mceLayout {border:0;}
 .wp_themeSkin .mceIframeContainer {}
 .wp_themeSkin table.mceToolbar, .wp_themeSkin tr.mceFirst .mceToolbar tr td, .wp_themeSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}
 .wp_themeSkin table.mceLayout {border:0;}
 .wp_themeSkin .mceIframeContainer {}
-.wp_themeSkin .mceStatusbar {display:block; font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:9pt; line-height:16px; overflow:visible;height:20px;}
+.wp_themeSkin .mceStatusbar {
+       display: block;
+       font-family: 'MS Sans Serif',sans-serif,Verdana,Arial;
+       font-size: 9pt;
+       line-height: 16px;
+       overflow: visible;
+       height: 20px;
+       border-top-width: 1px;
+       border-top-style: solid;
+}
 .wp_themeSkin .mceStatusbar div {float:left; padding:2px;}
 .wp_themeSkin .mceStatusbar div {float:left; padding:2px;}
-.wp_themeSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize}
+.wp_themeSkin .mceStatusbar a.mceResize {
+       display: block;
+       float: right;
+       background: url(../../img/icons.gif) -800px 0;
+       width: 20px;
+       height: 20px;
+       cursor: se-resize
+}
 .wp_themeSkin .mceStatusbar a:hover {text-decoration:underline}
 .wp_themeSkin table.mceToolbar {margin: 0 2px 2px;}
 .wp_themeSkin #content_toolbar1 {margin-top: 2px;}
 .wp_themeSkin .mceStatusbar a:hover {text-decoration:underline}
 .wp_themeSkin table.mceToolbar {margin: 0 2px 2px;}
 .wp_themeSkin #content_toolbar1 {margin-top: 2px;}
@@ -38,8 +54,8 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
        padding: 1px 2px; 
        margin: 1px; 
        background-image: url(img/butt2.png);
        padding: 1px 2px; 
        margin: 1px; 
        background-image: url(img/butt2.png);
-       background-position: 2px 1px;
-       background-repeat: no-repeat;
+       background-position: left top;
+       background-repeat: repeat-x;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        -khtml-border-radius: 3px;
        -moz-border-radius: 3px;
        -webkit-border-radius: 3px;
        -khtml-border-radius: 3px;
@@ -48,10 +64,10 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
 .wp_themeSkin a.mceButton span, .wp_themeSkin a.mceButton img {}
 .wp_themeSkin .mceOldBoxModel a.mceButton span, .wp_themeSkin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
 .wp_themeSkin a.mceButtonEnabled:hover {
 .wp_themeSkin a.mceButton span, .wp_themeSkin a.mceButton img {}
 .wp_themeSkin .mceOldBoxModel a.mceButton span, .wp_themeSkin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
 .wp_themeSkin a.mceButtonEnabled:hover {
-       background-position:0 -20px;
+       background-position:0 -10px;
 }
 .wp_themeSkin a.mceButtonActive, .wp_themeSkin a.mceButtonSelected {
 }
 .wp_themeSkin a.mceButtonActive, .wp_themeSkin a.mceButtonSelected {
-       background-position:0 -20px;
+       background-image: inherit;
 }
 .wp_themeSkin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30);}
 .wp_themeSkin .mceButtonDisabled {}
 }
 .wp_themeSkin .mceButtonDisabled .mceIcon {opacity:0.3; filter:alpha(opacity=30);}
 .wp_themeSkin .mceButtonDisabled {}
@@ -74,7 +90,7 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
        text-decoration: none !important;
        width:70px;  
        background-image: url(img/butt2.png);
        text-decoration: none !important;
        width:70px;  
        background-image: url(img/butt2.png);
-       background-position: 1px 1px;
+       background-position: left top;
        background-repeat: repeat-x;
        font-family: Tahoma,Verdana,Arial,Helvetica; 
        font-size: 11px; 
        background-repeat: repeat-x;
        font-family: Tahoma,Verdana,Arial,Helvetica; 
        font-size: 11px; 
@@ -91,7 +107,7 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
        height: 20px; 
        border-collapse: separate;
        background-image: url(img/butt2.png);
        height: 20px; 
        border-collapse: separate;
        background-image: url(img/butt2.png);
-       background-position: 1px 1px;
+       background-position: left top;
        background-repeat: repeat-x;
        padding: 1px;
        border-left: 0 none !important;
        background-repeat: repeat-x;
        padding: 1px;
        border-left: 0 none !important;
@@ -131,7 +147,7 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
        height:20px;
        width:20px;
        background-image: url(img/butt2.png);
        height:20px;
        width:20px;
        background-image: url(img/butt2.png);
-       background-position: 1px 1px;
+       background-position: left top;
        background-repeat: repeat-x;
        padding: 1px 2px;
 }
        background-repeat: repeat-x;
        padding: 1px 2px;
 }
@@ -144,7 +160,7 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
        height:20px;
        border-collapse:separate;
        background-image: url(img/butt2.png);
        height:20px;
        border-collapse:separate;
        background-image: url(img/butt2.png);
-       background-position: 1px 1px;
+       background-position: left top;
        background-repeat: repeat-x;
        padding: 1px;
        border-left: 0 none !important;
        background-repeat: repeat-x;
        padding: 1px;
        border-left: 0 none !important;
@@ -199,7 +215,7 @@ border:0; margin:0; padding:0; white-space:nowrap; text-decoration:none; font-we
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px;}
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {}
 .wp_themeSkin a.mceMoreColors:hover {}
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px;}
 .wp_themeSkin .mceColorSplitMenu a.mceMoreColors:hover {}
 .wp_themeSkin a.mceMoreColors:hover {}
-.wp_themeSkin .mceColorPreview {position:absolute; top:15px; left:2px; width:16px; height:4px; overflow:hidden}
+.wp_themeSkin .mceColorPreview {margin: -4px 0 0 2px; width:16px; height:4px; overflow:hidden}
 
 /* Menu */
 .wp_themeSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000;}
 
 /* Menu */
 .wp_themeSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000;}
index 2c709c9e558293e9ecb309892d965ab3c203d63d..bf657eef0dff21d4bd200d64e0672dc04d3fdd0b 100644 (file)
@@ -2,8 +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=311"></script>
-       <script type="text/javascript" src="js/source_editor.js?ver=311"></script>
+       <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" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
        <base target="_self" />
 </head>
 <body onresize="resizeInputs();" style="display:none; overflow:hidden;">
index 1d2a80344387585f6cb289487ab893bc94fe82e5..55aba6e3b2231bfa572b506656573f989387f535 100644 (file)
@@ -1 +1 @@
-var tinymce={majorVersion:'3',minorVersion:'1.1',releaseDate:'2008-06-25',_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;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;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;base=base.substring(0,base.lastIndexOf('/'));base=base.split('/');items=path.split('/');if(base.length>=items.length){for(i=0;i<base.length;i++){if(i>=items.length||base[i]!=items[i]){bp=i+1;break;}}}if(base.length<items.length){for(i=0;i<items.length;i++){if(i>=base.length||base[i]!=items[i]){bp=i+1;break;}}}if(bp==1)return path;for(i=0;i<base.length-(bp-1);i++)out+="../";for(i=bp-1;i<items.length;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_]+)$/,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,w,h;e=t.get(e);p=t.getPos(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{x:p.x,y:p.y,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;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.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=/^([\w\\*]+)?(?:#([\w\\]+))?(?:\.([\w\\\.]+))?(?:\[\@([\w\\]+)([\^\$\*!]?=)([\w\\]+)\])?(?:\:([\w\\]+))?/i.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;if(a){for(k in a){if(a.hasOwnProperty(k)&&!is(a[k],'object'))t.setAttrib(e,k,''+a[k]);}if(a.style&&!is(a.style,'string')){each(a.style,function(v,n){t.setStyle(e,n,v);});}}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(t.settings.strict)n=n.toLowerCase();return this.run(e,function(e){var s=t.settings;switch(n){case"style":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;}v=e.getAttribute(n,2);if(!v){switch(n){case'class':v=e.className;break;default:if(isIE&&n==='name'&&e.nodeName==='A'){v=e.name;break;}v=e.attributes[n];v=v&&is(v.nodeValue)?v.nodeValue:v;}}switch(n){case'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);}break;}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='';break;case'hspace':if(v===-1)v='';break;case'maxlength':case'tabindex':if(v===32768||v===2147483647)v='';break;case'noshade':if(v===65535)return'noshade';break;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&&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.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(/<a( )([^>]+)\/>|<a\/>/gi,'<a$1$2></a>');if(s.keep_values){if(/<script|style/.test(h)){function trim(s){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(/<([\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;if(/&[^;]+;/.test(s)){e=this.doc.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue;}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.doc.getElementById(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;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;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';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;return t.isCollapsed()?'':wb+t.serializer.serialize(e,s)+wa;},setContent:function(h,s){var t=this,r=t.getRng(),d=t.win.document;s=s||{format:'html'};s.set=true;h=t.dom.processHTML(h);if(r.insertNode){if(tinymce.isGecko&&h.indexOf('<')==-1){r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h+'<span id="__caret">_</span>'));t.select(t.dom.get('__caret'));t.getRng().deleteContents();return;}try{if(d.queryCommandEnabled('InsertHTML'))return d.execCommand('InsertHTML',false,h);}catch(ex){r.deleteContents();r.insertNode(t.getRng().createContextualFragment(h));}}else{if(r.item){d.execCommand('Delete',false,null);r=t.getRng();}r.pasteHTML(h);}},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||s.isCollapsed;},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){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',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},s);t.dom=s.dom;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}]});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);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(!hc&&ru.padd)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);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;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(tinymce.dom.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.util.XHR.send({url:o.url,error:t.settings.error,success:function(co){t.eval(co);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(!tinymce.dom.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);}}});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;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']);DOM.add(n,'span',{'class':'mceIcon'+(s.icon?' mce_'+s.icon:'')});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(v){var t=this,e,fv;if(v!=t.selectedValue){e=DOM.get(t.id+'_text');t.selectedValue=v;each(t.items,function(o){if(o.value==v){DOM.setHTML(e,DOM.encode(o.title));fv=1;return false;}});if(!fv){DOM.setHTML(e,DOM.encode(t.settings.title));DOM.addClass(e,'mceTitle');e=0;return;}else DOM.removeClass(e,'mceTitle');}e=0;},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(v){var e=DOM.get(this.id),ol=e.options;v=''+(v||'');e.selectedIndex=0;each(ol,function(o,i){if(o.value==v){e.selectedIndex=i;return false;}});},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=e.target.options[e.target.selectedIndex].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'});},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;if(tinymce.EditorManager.settings){u=this.urls[n]+'/langs/'+tinymce.EditorManager.settings.language+'.js';s=tinymce.EditorManager.settings;if(s){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(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;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))new tinymce.Editor(v,s).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);new tinymce.Editor(v,s).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();new tinymce.Editor(v.id,s).render(1);}});break;}if(s.oninit){l=co=0;each(t.editors,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":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'},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)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)+((h+'').indexOf('%')==-1?(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{d.designMode='On';}catch(ex){}}if(isIE){b=t.getBody();DOM.hide(b);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,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;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){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,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+'.'+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;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(!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){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){if((e.keyCode>=33&&e.keyCode<=36)||(e.keyCode>=37&&e.keyCode<=40)||e.keyCode==13||e.keyCode==45||e.keyCode==46||e.keyCode==8||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(o.ctrl!=e.ctrlKey&&(!tinymce.isMac||o.ctrl==e.metaKey))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 convertToFonts(no){var n,f,nl,x,i,v,st;if(tinymce.isWebKit||!s.inline_styles)return;nl=t.dom.select('span',no);for(x=nl.length-1;x>=0;x--){n=nl[x];f=dom.create('font',{color:dom.toHex(dom.getStyle(n,'color')),face:dom.getStyle(n,'fontFamily'),style:dom.getAttrib(n,'style'),'class':dom.getAttrib(n,'class')});st=f.style;if(st.color||st.fontFamily){st.color=st.fontFamily='';dom.setAttrib(f,'mce_style','');}if(sl){i=inArray(sl,dom.getStyle(n,'fontSize'));if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));}}else if(cl){i=inArray(cl,dom.getAttrib(n,'class'));v=dom.getStyle(n,'fontSize');if(i==-1&&v.indexOf('pt')>0)i=inArray(fz,parseInt(v));if(i==-1)i=inArray(fzn,v);if(i!=-1){dom.setAttrib(f,'size',''+(i+1||1));f.style.fontSize='';}}if(f.color||f.face||f.size){f.style.fontFamily='';dom.setAttrib(f,'mce_style','');dom.replace(f,n,1);}f=n=null;}};t.onSetContent.add(function(ed,o){convertToFonts(ed.getBody());});t.onPreProcess.add(function(ed,o){var n,sp,nl,x;if(!s.inline_styles)return;if(o.get){nl=t.dom.select('font',o.node);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);}}});},_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;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 ed.getDoc().execCommand('FontName',false,v);},FontSize:function(u,v){var ed=this.editor,s=ed.settings,fz=tinymce.explode(s.font_size_style_values),fzc=tinymce.explode(s.font_size_classes),h,bm;each(ed.dom.select('font'),function(e){e.style.fontSize='';});ed.getDoc().execCommand('FontSize',false,v);if(s.inline_styles){each(ed.dom.select('font'),function(e){if(e.parentNode.nodeName=='FONT'&&e.size==e.parentNode.size){if(!bm)bm=ed.selection.getBookmark();ed.dom.remove(e,1);return;}if(v=e.size){if(fzc&&fzc.length>0)ed.dom.setAttrib(e,'class',fzc[parseInt(v)-1]);else ed.dom.setStyle(e,'fontSize',fz[parseInt(v)-1]);}});}ed.selection.moveToBookmark(bm);},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(isOpera||isWebKit){if(p=ed.dom.getParent(ed.selection.getNode(),'FONT'))v=p.size;return v;}return 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(!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())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(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);},HiliteColor:function(ui,val){var t=this,ed=t.editor,d=ed.getDoc();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;}else return!!ed.dom.getParent(ed.selection.getNode(),'BLOCKQUOTE');return this.queryStateInsertUnorderedList()||this.queryStateInsertOrderedList();},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(),dom.isBlock);eb=dom.getParent(s.getEnd(),dom.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(),dom.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);},_getSelectedBlocks:function(st,en){var ed=this.editor,dom=ed.dom,s=ed.selection,sb,eb,n,bl=[];sb=dom.getParent(st||s.getStart(),dom.isBlock);eb=dom.getParent(en||s.getEnd(),dom.isBlock);if(sb)bl.push(sb);if(sb&&eb&&sb!=eb){n=sb;while((n=n.nextSibling)&&n!=eb){if(dom.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;if(e&&e.keyCode==13)return true;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(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){}}}},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;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 />';if(isEmpty(aft))aft.innerHTML=isOpera?'&nbsp;':'<br />';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(aft):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+ch);}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){e=e.target;if(e&&e.parentNode&&e.nodeName=='BR'&&(n=t.getParentBlock(e))){Event.remove(b,'DOMNodeInserted',handler);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){s=s||{};s.menu_button=1;return this.createButton(id,s);},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){cb.call(s||this,confirm(this._decode(this.editor.getLang(t,t))));},alert:function(tx,cb,s){var t=this;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.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
diff --git a/wp-includes/js/tinymce/tiny_mce_config.php b/wp-includes/js/tinymce/tiny_mce_config.php
deleted file mode 100644 (file)
index 757d06b..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-<?php 
-// some code below is from:
-/**
- * $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $
- *
- * @author Moxiecode
- * @copyright Copyright Â© 2005-2006, Moxiecode Systems AB, All rights reserved.
- *
- * This file compresses the TinyMCE JavaScript using GZip.
- **/
-
-// Discard any buffers
-while ( @ob_end_clean() );
-
-@ require('../../../wp-load.php');
-
-function getFileContents($path) {
-
-       if ( function_exists('realpath') )
-               $path = realpath($path);
-
-       if ( ! $path || ! @is_file($path) )
-               return '';
-
-       if ( function_exists('file_get_contents') )
-               return @file_get_contents($path);
-
-       $content = '';
-       $fp = @fopen($path, 'r');
-       if ( ! $fp )
-               return '';
-
-       while ( ! feof($fp) )
-               $content .= fgets($fp);
-
-       fclose($fp);
-       return $content;
-}
-
-function putFileContents( $path, $content ) {
-       if ( function_exists('file_put_contents') )
-               return @file_put_contents( $path, $content );
-
-       $newfile = false;
-       $fp = @fopen( $path, 'wb' );
-       if ($fp) {
-               $newfile = fwrite( $fp, $content );
-               fclose($fp);
-       }
-       return $newfile;
-}
-
-// Set up init variables
-$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
-
-/*
-The following filter allows localization scripts to change the languages displayed in the spellchecker's drop-down menu.
-By default it uses Google's spellchecker API, but can be configured to use PSpell/ASpell if installed on the server.
-The + sign marks the default language. More information:
-http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker
-*/
-$mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv');
-
-$plugins = array( 'safari', 'inlinepopups', 'autosave', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage' );
-
-/* 
-The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'.
-It adds the plugin's name to TinyMCE's plugins init and the call to PluginManager to load the plugin. 
-The url should be absolute and should include the js file name to be loaded. Example: 
-array( 'myplugin' => 'http://my-site.com/wp-content/plugins/myfolder/mce_plugin.js' )
-If the plugin uses a button, it should be added with one of the "$mce_buttons" filters.
-*/
-$mce_external_plugins = apply_filters('mce_external_plugins', array());
-
-$ext_plugins = "\n";
-if ( ! empty($mce_external_plugins) ) {
-       
-       /*
-       The following filter loads external language files for TinyMCE plugins.
-       It takes an associative array 'plugin_name' => 'path', where path is the 
-       include path to the file. The language file should follow the same format as 
-       /tinymce/langs/wp-langs.php and should define a variable $strings that 
-       holds all translated strings. Example: 
-       $strings = 'tinyMCE.addI18n("' . $mce_locale . '.mypluginname_dlg",{tab_general:"General", ... })';
-       */
-       $mce_external_languages = apply_filters('mce_external_languages', array()); 
-       
-       $loaded_langs = array();
-       $strings = '';
-       
-       if ( ! empty($mce_external_languages) ) {
-               foreach ( $mce_external_languages as $name => $path ) {
-                       if ( is_file($path) && is_readable($path) ) { 
-                               include_once($path);
-                               $ext_plugins .= $strings;
-                               $loaded_langs[] = $name;
-                       }
-               }
-       }
-
-       foreach ( $mce_external_plugins as $name => $url ) {
-               
-               if ( is_ssl() ) $url = str_replace('http://', 'https://', $url);
-               
-               $plugins[] = '-' . $name;
-
-               if ( in_array($name, $loaded_langs) ) {
-                       $plugurl = dirname($url);
-                       $ext_plugins .= 'tinyMCEPreInit.load_ext("' . $plugurl . '", "' . $mce_locale . '");' . "\n";
-               }
-               $ext_plugins .= 'tinymce.PluginManager.load("' . $name . '", "' . $url . '");' . "\n";
-       }
-}
-$plugins = implode($plugins, ',');
-
-$mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));
-$mce_buttons = implode($mce_buttons, ',');
-
-$mce_buttons_2 = apply_filters('mce_buttons_2', array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|', 'media', 'charmap', '|', 'outdent', 'indent', '|', 'undo', 'redo', 'wp_help' ));
-$mce_buttons_2 = implode($mce_buttons_2, ',');
-
-$mce_buttons_3 = apply_filters('mce_buttons_3', array());
-$mce_buttons_3 = implode($mce_buttons_3, ',');
-       
-$mce_buttons_4 = apply_filters('mce_buttons_4', array());
-$mce_buttons_4 = implode($mce_buttons_4, ',');
-
-$no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
-
-// TinyMCE init settings
-$initArray = array (
-       'mode' => 'none',
-       'onpageload' => 'wpEditorInit',
-       'width' => '100%',
-       'theme' => 'advanced',
-       'skin' => 'wp_theme',
-       'theme_advanced_buttons1' => "$mce_buttons",
-       'theme_advanced_buttons2' => "$mce_buttons_2",
-       'theme_advanced_buttons3' => "$mce_buttons_3",
-       'theme_advanced_buttons4' => "$mce_buttons_4",
-       'language' => "$mce_locale",
-       'spellchecker_languages' => "$mce_spellchecker_languages",
-       'theme_advanced_toolbar_location' => 'top',
-       'theme_advanced_toolbar_align' => 'left',
-       'theme_advanced_statusbar_location' => 'bottom',
-       'theme_advanced_resizing' => true,
-       'theme_advanced_resize_horizontal' => false,
-       'dialog_type' => 'modal',
-       'relative_urls' => false,
-       'remove_script_host' => false,
-       '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' => false,
-       'tab_focus' => ':next',
-       'content_css' => "$mce_css",
-       'save_callback' => 'switchEditors.saveCallback',
-       'wpeditimage_disable_captions' => $no_captions,
-       'plugins' => "$plugins",
-       // pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init"
-       'disk_cache' => true,
-       'compress' => true,
-       'old_cache_max' => '1' // number of cache files to keep
-);
-
-// 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 (changed from action to filter)
-$initArray = apply_filters('tiny_mce_before_init', $initArray);
-
-// Setting "valid_elements", "invalid_elements" and "extended_valid_elements" can be done through "tiny_mce_before_init".
-// Best is to use the default cleanup by not specifying valid_elements, as TinyMCE contains full set of XHTML 1.0.
-
-// support for deprecated actions
-ob_start();
-do_action('mce_options');
-$mce_deprecated = ob_get_contents();
-ob_end_clean();
-
-$mce_deprecated = (string) $mce_deprecated;
-if ( strlen( $mce_deprecated ) < 10 || ! strpos( $mce_deprecated, ':' ) || ! strpos( $mce_deprecated, ',' ) )  
-       $mce_deprecated = '';
-
-// Settings for the gzip compression and cache
-$disk_cache = ( ! isset($initArray['disk_cache']) || false == $initArray['disk_cache'] ) ? false : true;
-$compress = ( ! isset($initArray['compress']) || false == $initArray['compress'] ) ? false : true;
-$old_cache_max = ( isset($initArray['old_cache_max']) ) ? (int) $initArray['old_cache_max'] : 0;
-
-$initArray['disk_cache'] = $initArray['compress'] = $initArray['old_cache_max'] = null;
-unset( $initArray['disk_cache'], $initArray['compress'], $initArray['old_cache_max'] );
-
-// Anybody still using IE5/5.5? It can't handle gzip compressed js well.
-if ( $msie = strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ) {
-       $ie_ver = (int) substr( $_SERVER['HTTP_USER_AGENT'] , $msie + 5, 3 );
-       if ( $ie_ver && $ie_ver < 6 ) $compress = false;
-}
-
-// Cache path, this is where the .gz files will be stored
-$cache_path = WP_CONTENT_DIR . '/uploads/js_cache'; 
-if ( $disk_cache && ! is_dir($cache_path) )
-       $disk_cache = wp_mkdir_p($cache_path);
-
-$cache_ext = '.js';
-$plugins = explode( ',', $initArray['plugins'] );
-$theme = ( 'simple' == $initArray['theme'] ) ? 'simple' : 'advanced';
-$language = ( isset($initArray['language']) && ! empty($initArray['language']) ) ? substr( $initArray['language'], 0, 2 ) : 'en';
-$cacheKey = $mce_options = ''; 
-
-// Check if browser supports gzip
-if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
-       if ( ( false !== strpos( strtolower($_SERVER['HTTP_ACCEPT_ENCODING']), 'gzip') || isset($_SERVER['---------------']) ) && function_exists('gzencode') && ! ini_get('zlib.output_compression') ) {
-               $cache_ext = '.gz';
-       }
-}
-
-// Setup cache info
-if ( $disk_cache ) {
-
-       $cacheKey = apply_filters('tiny_mce_version', '20080810');
-
-       foreach ( $initArray as $v )
-               $cacheKey .= $v;
-
-       if ( ! empty($mce_external_plugins) ) {
-               foreach ( $mce_external_plugins as $n => $v )
-                       $cacheKey .= $n;
-       }
-       
-       $cacheKey = md5( $cacheKey );
-       $cache_file = $cache_path . '/tinymce_' . $cacheKey . $cache_ext;
-}
-
-$expiresOffset = 864000; // 10 days
-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() + $expiresOffset ) . ' GMT' );
-
-// Use cached file if exists
-if ( $disk_cache && is_file($cache_file) && is_readable($cache_file) ) {
-
-       $mtime = gmdate("D, d M Y H:i:s", filemtime($cache_file)) . " GMT";
-       
-       if ( isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $_SERVER['HTTP_IF_MODIFIED_SINCE'] == $mtime ) {
-               header('HTTP/1.1 304 Not Modified');
-               exit;
-       }
-       header("Last-Modified: " . $mtime);
-       header("Cache-Control: must-revalidate", false);
-
-       $content = getFileContents( $cache_file );
-       
-       if ( '.gz' == $cache_ext )
-               header( 'Content-Encoding: gzip' );
-
-       echo $content;
-       exit;
-}
-
-foreach ( $initArray as $k => $v ) 
-    $mce_options .= $k . ':"' . $v . '",';
-
-if ( $mce_deprecated ) $mce_options .= $mce_deprecated;
-
-$mce_options = rtrim( trim($mce_options), '\n\r,' );
-
-$content = 'var tinyMCEPreInit = { settings : { themes : "' . $theme . '", plugins : "' . $initArray['plugins'] . '", languages : "' . $language . '", debug : false }, base : "' . $baseurl . '", suffix : "", query : "ver=311" };';
-
-// Load patch
-$content .= getFileContents( 'tiny_mce_ext.js' );
-
-// Add core
-$content .= getFileContents( 'tiny_mce.js' );
-
-// Patch loading functions
-$content .= 'tinyMCEPreInit.start();';
-
-// Add all languages (WP)
-include_once( dirname(__FILE__).'/langs/wp-langs.php' );
-$content .= $strings;
-
-// Add themes
-$content .= getFileContents( 'themes/' . $theme . '/editor_template.js' );
-
-// Add plugins
-foreach ( $plugins as $plugin ) 
-       $content .= getFileContents( 'plugins/' . $plugin . '/editor_plugin.js' );
-
-// Add external plugins and init 
-$content .= $ext_plugins . 'tinyMCE.init({' . $mce_options . '});';
-
-// Generate GZIP'd content
-if ( '.gz' == $cache_ext ) {
-       header('Content-Encoding: gzip');
-       $content = gzencode( $content, 9, FORCE_GZIP );
-}
-
-// Stream to client
-echo $content;
-
-// Write file
-if ( '' != $cacheKey && is_dir($cache_path) && is_readable($cache_path) ) {    
-
-       $old_cache = array();
-       $handle = opendir($cache_path);
-       while ( false !== ( $file = readdir($handle) ) ) {
-               if ( $file == '.' || $file == '..' ) continue;
-        $saved = filectime("$cache_path/$file");
-               if ( strpos($file, 'tinymce_') !== false && substr($file, -3) == $cache_ext ) $old_cache["$saved"] = $file;
-       }
-       closedir($handle);
-                       
-       krsort($old_cache);
-       if ( 1 >= $old_cache_max ) $del_cache = $old_cache;
-       else $del_cache = array_slice( $old_cache, ($old_cache_max - 1) );
-
-       foreach ( $del_cache as $key )
-               @unlink("$cache_path/$key");
-
-       putFileContents( $cache_file, $content );
-}
-
-?>
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/tiny_mce_ext.js b/wp-includes/js/tinymce/tiny_mce_ext.js
deleted file mode 100644 (file)
index cee045d..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-tinyMCEPreInit.start = function() {
-       var t = this, each = tinymce.each, s = t.settings, sl = tinymce.ScriptLoader, ln = s.languages, th = s.themes;
-
-       function load(u, sp) {
-               var o;
-
-               if (!sp)
-                       u = t.base + u;
-
-               o = {url : u, state : 2};
-               sl.queue.push(o);
-               sl.lookup[o.url] = o;
-       };
-
-       sl.markDone(t.base + '/langs/' + ln + '.js');
-
-       load('/themes/' + th + '/editor_template' + t.suffix + '.js');
-       sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '.js');
-       sl.markDone(t.base + '/themes/' + th + '/langs/' + ln + '_dlg.js');
-
-       each(s.plugins.split(','), function(n) {
-               if (n && n.charAt(0) != '-') {
-                       load('/plugins/' + n + '/editor_plugin' + t.suffix + '.js');
-
-                       sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '.js');
-                       sl.markDone(t.base + '/plugins/' + n + '/langs/' + ln + '_dlg.js');
-               }
-       });
-};
-tinyMCEPreInit.load_ext = function(url,lang) {
-       var sl = tinymce.ScriptLoader;
-
-       sl.markDone(url + '/langs/' + lang + '.js');
-       sl.markDone(url + '/langs/' + lang + '_dlg.js');
-};
index 6c8f73b67b53062e0a7ce577790fcc7b54384804..d5d88e2976230cf35a2ecc6d256cc4f290703a10 100644 (file)
@@ -21,10 +21,14 @@ tinyMCEPopup = {
                tinyMCE = w.tinyMCE;
                t.editor = tinymce.EditorManager.activeEditor;
                t.params = t.editor.windowManager.params;
                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);
 
                // Setup local DOM
                t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
-               t.dom.loadCSS(t.editor.settings.popup_css);
+
+               // 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 = [];
 
                // Setup on init listeners
                t.listeners = [];
@@ -127,6 +131,14 @@ tinyMCEPopup = {
                this.editor.execCallback('file_browser_callback', element_id, document.getElementById(element_id).value, type, window);
        },
 
                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;
 
        close : function() {
                var t = this;
 
@@ -160,18 +172,25 @@ tinyMCEPopup = {
        },*/
 
        _onDOMLoaded : function() {
        },*/
 
        _onDOMLoaded : function() {
-               var t = this, ti = document.title, bm, h;
+               var t = this, ti = document.title, bm, h, nv;
 
                // Translate page
 
                // Translate page
-               h = document.body.innerHTML;
+               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"')
+                       // 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.dir = t.editor.getParam('directionality','');
-               document.body.innerHTML = t.editor.translate(h);
-               document.title = ti = t.editor.translate(ti);
                document.body.style.display = '';
 
                // Restore selection in IE when focus is placed on a non textarea or input element of the type text
                document.body.style.display = '';
 
                // Restore selection in IE when focus is placed on a non textarea or input element of the type text
index 0bc5f5521fcbefa498e521ef74ffd6c01e921c02..eff18ff22dc649aea838886823bc73e6c4db38e8 100644 (file)
@@ -1,4 +1,7 @@
 /* This file contains the CSS data for the editable area(iframe) of TinyMCE */
 /* This file contains the CSS data for the editable area(iframe) of TinyMCE */
+html {
+       background-color: #fff;
+}
 
 .aligncenter,
 dl.aligncenter {
 
 .aligncenter,
 dl.aligncenter {
@@ -40,10 +43,15 @@ dl.aligncenter {
        margin: 0;
 }
 
        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 {
 body.mceContentBody {
-       background: #fff;
-       color: #000;
-       font: 13px/19px "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana,sans-serif;
+       font: 13px/19px Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
        padding: 0.6em;
        margin: 0;
 }
        padding: 0.6em;
        margin: 0;
 }
index 4ef08f018aa4e1be7b910d67a381cce8549f5cf6..d84410cccada50762273446744d4a58131859e99 100644 (file)
@@ -1,4 +1,12 @@
-<?php require_once('../../../wp-load.php');
+<?php
+/**
+ * @package TinyMCE
+ * @author Moxiecode
+ * @copyright Copyright Â© 2005-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+/** @ignore */
+require_once('../../../wp-load.php');
 header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 header('Content-Type: text/html; charset=' . get_bloginfo('charset'));
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -6,8 +14,8 @@ 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=311"></script>
-<?php 
+<script type="text/javascript" src="tiny_mce_popup.js?ver=321"></script>
+<?php
 wp_admin_css( 'global', true );
 wp_admin_css( 'wp-admin', true );
 ?>
 wp_admin_css( 'global', true );
 wp_admin_css( 'wp-admin', true );
 ?>
@@ -15,42 +23,46 @@ wp_admin_css( 'wp-admin', true );
        #wphead {
                font-size: 80%;
                border-top: 0;
        #wphead {
                font-size: 80%;
                border-top: 0;
-               color:#555;
-               background-color: #e4f2fd;
+               color: #555;
+               background-color: #f1f1f1;
        }
        #wphead h1 {
        }
        #wphead h1 {
-               font-size: 32px;
+               font-size: 24px;
                color: #555;
                margin: 0;
                padding: 10px;
        }
                color: #555;
                margin: 0;
                padding: 10px;
        }
-       #adminmenu {
-               padding-top: 2px;
-               padding-left: 15px;
-               background-color: #e4f2fd;
-               border-color: #C6D9E9;
+       #tabs {
+               padding: 15px 15px 3px;
+               background-color: #f1f1f1;
+               border-bottom: 1px solid #dfdfdf;
+       }
+       #tabs li {
+               display: inline;
        }
        }
-       #adminmenu a.current {
+       #tabs a.current {
                background-color: #fff;
                background-color: #fff;
-               border-color: #c6d9e9;
+               border-color: #dfdfdf;
                border-bottom-color: #fff;
                color: #d54e21;
        }
                border-bottom-color: #fff;
                color: #d54e21;
        }
-       #adminmenu a {
+       #tabs a {
                color: #2583AD;
                padding: 6px;
                color: #2583AD;
                padding: 6px;
-               border-width: 1px;
+               border-width: 1px 1px 0;
                border-style: solid solid none;
                border-style: solid solid none;
-               border-color: #E4F2FD;
+               border-color: #f1f1f1;
+               text-decoration: none;
        }
        }
-       #adminmenu a:hover {
+       #tabs a:hover {
                color: #d54e21;
        }
        .wrap h2 {
                color: #d54e21;
        }
        .wrap h2 {
-               border-bottom-color:#DADADA;
-               color:#666666;
-               margin: 12px 0;
+               border-bottom-color: #dfdfdf;
+               color: #555;
+               margin: 5px 0;
                padding: 0;
                padding: 0;
+               font-size: 18px;
        }
        #user_info {
                right: 5%;
        }
        #user_info {
                right: 5%;
@@ -58,15 +70,15 @@ wp_admin_css( 'wp-admin', true );
        }
        h3 {
                font-size: 1.1em;
        }
        h3 {
                font-size: 1.1em;
-               margin-top: 20px;
+               margin-top: 10px;
                margin-bottom: 0px;
        }
        #flipper {
                margin: 0;
                padding: 5px 20px 10px;
                background-color: #fff;
                margin-bottom: 0px;
        }
        #flipper {
                margin: 0;
                padding: 5px 20px 10px;
                background-color: #fff;
-               border-left: 1px solid #c6d9e9;
-               border-bottom: 1px solid #c6d9e9;
+               border-left: 1px solid #dfdfdf;
+               border-bottom: 1px solid #dfdfdf;
        }
        * html {
         overflow-x: hidden;
        }
        * html {
         overflow-x: hidden;
@@ -85,7 +97,7 @@ wp_admin_css( 'wp-admin', true );
        }
        .top .key {
                text-align: center;
        }
        .top .key {
                text-align: center;
-               width: 36px;
+               width: 5em;
        }
        .top .action {
                text-align: left;
        }
        .top .action {
                text-align: left;
@@ -118,7 +130,7 @@ wp_admin_css( 'wp-admin', true );
 </style>
 <?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
 <style type="text/css">
 </style>
 <?php if ( ('rtl' == $wp_locale->text_direction) ) : ?>
 <style type="text/css">
-       #wphead, #adminmenu {
+       #wphead, #tabs {
                padding-left: auto;
                padding-right: 15px;
        }
                padding-left: auto;
                padding-right: 15px;
        }
@@ -155,10 +167,10 @@ wp_admin_css( 'wp-admin', true );
 </script>
 </head>
 <body>
 </script>
 </head>
 <body>
-<div class="zerosize"></div>
+
 <div id="wphead"><h1><?php echo get_bloginfo('blogtitle'); ?></h1></div>
 
 <div id="wphead"><h1><?php echo get_bloginfo('blogtitle'); ?></h1></div>
 
-<ul id="adminmenu">
+<ul id="tabs">
        <li><a id="tab1" href="javascript:flipTab(1)" title="<?php _e('Basics of Rich Editing') ?>" accesskey="1" tabindex="1" class="current"><?php _e('Basics') ?></a></li>
        <li><a id="tab2" href="javascript:flipTab(2)" title="<?php _e('Advanced use of the Rich Editor') ?>" accesskey="2" tabindex="2"><?php _e('Advanced') ?></a></li>
        <li><a id="tab3" href="javascript:flipTab(3)" title="<?php _e('Hotkeys') ?>" accesskey="3" tabindex="3"><?php _e('Hotkeys') ?></a></li>
        <li><a id="tab1" href="javascript:flipTab(1)" title="<?php _e('Basics of Rich Editing') ?>" accesskey="1" tabindex="1" class="current"><?php _e('Basics') ?></a></li>
        <li><a id="tab2" href="javascript:flipTab(2)" title="<?php _e('Advanced use of the Rich Editor') ?>" accesskey="2" tabindex="2"><?php _e('Advanced') ?></a></li>
        <li><a id="tab3" href="javascript:flipTab(3)" title="<?php _e('Hotkeys') ?>" accesskey="3" tabindex="3"><?php _e('Hotkeys') ?></a></li>
@@ -204,7 +216,7 @@ wp_admin_css( 'wp-admin', true );
                        "<tr><th>6</th><td><?php _e('Header 6') ?></td><th>9</th><td><?php _e('Address') ?></td></tr>")
                </script>
        </table>
                        "<tr><th>6</th><td><?php _e('Header 6') ?></td><th>9</th><td><?php _e('Address') ?></td></tr>")
                </script>
        </table>
-       
+
        <p><?php _e('The following shortcuts use different access keys: Alt + Shift + letter.') ?></p>
        <table class="keys" width="100%" style="border: 0 none;">
                <tr class="top"><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th></tr>
        <p><?php _e('The following shortcuts use different access keys: Alt + Shift + letter.') ?></p>
        <table class="keys" width="100%" style="border: 0 none;">
                <tr class="top"><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th><th class="key center"><?php _e('Letter') ?></th><th class="left"><?php _e('Action') ?></th></tr>
index 95558536d2cc956f1c329c49855e0970a0b987c6..d941f2179ef0cf9949a551b9990e6ec2d25bd014 100644 (file)
@@ -1,4 +1,4 @@
-wpAjax = jQuery.extend( {
+var wpAjax = jQuery.extend( {
        unserialize: function( s ) {
                var r = {}; if ( !s ) { return r; }
                var q = s.split('?'); if ( q[1] ) { s = q[1]; }
        unserialize: function( s ) {
                var r = {}; if ( !s ) { return r; }
                var q = s.split('?'); if ( q[1] ) { s = q[1]; }
index a4d5df3230c260e1e8ce32b1a8293028e076882d..128cf157a2047ce8c33ef7e4f84f9eb7725b8004 100644 (file)
@@ -26,7 +26,7 @@ var wpList = {
                var c = [], cl;
                try {
                        cl = $(e).attr('class') || '';
                var c = [], cl;
                try {
                        cl = $(e).attr('class') || '';
-                       cl = cl.match(new RegExp(t+':[A-Za-z0-9:_=-]+'));
+                       cl = cl.match(new RegExp(t+':[\\S]+'));
                        if ( cl ) { c = cl[0].split(':'); }
                } catch(r) {}
                return c;
                        if ( cl ) { c = cl[0].split(':'); }
                } catch(r) {}
                return c;
@@ -175,6 +175,8 @@ var wpList = {
        },
 
        ajaxDim: function( e, s ) {
        },
 
        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' );
                var list = this; e = $(e); s = s || {};
                var cls = wpList.parseClass(e,'dim');
                s = wpList.pre.call( list, e, s, 'dim' );
index c7538b983b4002ad713f5fe06ef6e1ec74407821..634cd4931e7e922c9967ebd4394e66cc85fb2231 100644 (file)
@@ -24,9 +24,8 @@
  */
 
 /**
  */
 
 /**
- * You can override this in your my-hacks.php file
- * You can also override this in a plugin file. The
- * my-hacks.php is deprecated in its usage.
+ * You can override this in your my-hacks.php file You can also override this
+ * in a plugin file. The my-hacks.php is deprecated in its usage.
  *
  * @since 1.2.0
  */
  *
  * @since 1.2.0
  */
@@ -35,9 +34,10 @@ if (!defined('CUSTOM_TAGS'))
 
 if (!CUSTOM_TAGS) {
        /**
 
 if (!CUSTOM_TAGS) {
        /**
-        * Kses global for default allowable HTML tags
+        * Kses global for default allowable HTML tags.
+        *
+        * Can be override by using CUSTOM_TAGS constant.
         *
         *
-        * Can be override by using CUSTOM_TAGS constant
         * @global array $allowedposttags
         * @since 2.0.0
         */
         * @global array $allowedposttags
         * @since 2.0.0
         */
@@ -273,16 +273,17 @@ if (!CUSTOM_TAGS) {
                'u' => array(),
                'ul' => array (
                        'class' => array (),
                'u' => array(),
                'ul' => array (
                        'class' => array (),
-                       'style' => array (), 
+                       'style' => array (),
                        'type' => array ()),
                'ol' => array (
                        'class' => array (),
                        'start' => array (),
                        'type' => array ()),
                'ol' => array (
                        'class' => array (),
                        'start' => array (),
-                       'style' => array (), 
+                       'style' => array (),
                        'type' => array ()),
                'var' => array ());
                        'type' => array ()),
                'var' => array ());
+
        /**
        /**
-        * Kses allowed HTML elements
+        * Kses allowed HTML elements.
         *
         * @global array $allowedtags
         * @since 1.0.0
         *
         * @global array $allowedtags
         * @since 1.0.0
@@ -323,17 +324,17 @@ if (!CUSTOM_TAGS) {
 }
 
 /**
 }
 
 /**
- * wp_kses() - Filters content and keeps only allowable HTML elements.
+ * Filters content and keeps only allowable HTML elements.
  *
  *
- * This function makes sure that only the allowed HTML element names,
- * attribute names and attribute values plus only sane HTML entities
- * will occur in $string. You have to remove any slashes from PHP's
- * magic quotes before you call this function.
+ * This function makes sure that only the allowed HTML element names, attribute
+ * names and attribute values plus only sane HTML entities will occur in
+ * $string. You have to remove any slashes from PHP's magic quotes before you
+ * call this function.
  *
  *
- * The default allowed protocols are 'http', 'https', 'ftp', 'mailto',
- * 'news', 'irc', 'gopher', 'nntp', 'feed', and finally 'telnet. This
- * covers all common link protocols, except for 'javascript' which
- * should not be allowed for untrusted users.
+ * The default allowed protocols are 'http', 'https', 'ftp', 'mailto', 'news',
+ * 'irc', 'gopher', 'nntp', 'feed', and finally 'telnet. This covers all common
+ * link protocols, except for 'javascript' which should not be allowed for
+ * untrusted users.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -352,11 +353,10 @@ function wp_kses($string, $allowed_html, $allowed_protocols = array ('http', 'ht
 }
 
 /**
 }
 
 /**
- * wp_kses_hook() - You add any kses hooks here.
+ * You add any kses hooks here.
  *
  *
- * There is currently only one kses WordPress hook and it is
- * called here. All parameters are passed to the hooks and
- * expected to recieve a string.
+ * There is currently only one kses WordPress hook and it is called here. All
+ * parameters are passed to the hooks and expected to recieve a string.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -371,18 +371,18 @@ function wp_kses_hook($string, $allowed_html, $allowed_protocols) {
 }
 
 /**
 }
 
 /**
- * wp_kses_version() - This function returns kses' version number.
+ * This function returns kses' version number.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
- * @return string Version Number
+ * @return string KSES Version Number
  */
 function wp_kses_version() {
        return '0.2.2';
 }
 
 /**
  */
 function wp_kses_version() {
        return '0.2.2';
 }
 
 /**
- * wp_kses_split() - Searches for HTML tags, no matter how malformed
+ * Searches for HTML tags, no matter how malformed.
  *
  * It also matches stray ">" characters.
  *
  *
  * It also matches stray ">" characters.
  *
@@ -394,22 +394,26 @@ function wp_kses_version() {
  * @return string Content with fixed HTML tags
  */
 function wp_kses_split($string, $allowed_html, $allowed_protocols) {
  * @return string Content with fixed HTML tags
  */
 function wp_kses_split($string, $allowed_html, $allowed_protocols) {
-       return preg_replace('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%e',
-       "wp_kses_split2('\\1', \$allowed_html, ".'$allowed_protocols)', $string);
+       global $pass_allowed_html, $pass_allowed_protocols;
+       $pass_allowed_html = $allowed_html;
+       $pass_allowed_protocols = $allowed_protocols;
+       return preg_replace_callback('%((<!--.*?(-->|$))|(<[^>]*(>|$)|>))%',
+               create_function('$match', 'global $pass_allowed_html, $pass_allowed_protocols; return wp_kses_split2($match[1], $pass_allowed_html, $pass_allowed_protocols);'), $string);
 }
 
 /**
 }
 
 /**
- * wp_kses_split2() - Callback for wp_kses_split for fixing malformed HTML tags
+ * Callback for wp_kses_split for fixing malformed HTML tags.
  *
  *
- * This function does a lot of work. It rejects some very malformed things
- * like <:::>. It returns an empty string, if the element isn't allowed (look
- * ma, no strip_tags()!). Otherwise it splits the tag into an element and an
- * attribute list.
+ * This function does a lot of work. It rejects some very malformed things like
+ * <:::>. It returns an empty string, if the element isn't allowed (look ma, no
+ * strip_tags()!). Otherwise it splits the tag into an element and an attribute
+ * list.
  *
  * After the tag is split into an element and an attribute list, it is run
  *
  * After the tag is split into an element and an attribute list, it is run
- * through another filter which will remove illegal attributes and once
- * that is completed, will be returned.
+ * through another filter which will remove illegal attributes and once that is
+ * completed, will be returned.
  *
  *
+ * @access private
  * @since 1.0.0
  * @uses wp_kses_attr()
  *
  * @since 1.0.0
  * @uses wp_kses_attr()
  *
@@ -459,13 +463,13 @@ function wp_kses_split2($string, $allowed_html, $allowed_protocols) {
 }
 
 /**
 }
 
 /**
- * wp_kses_attr() - Removes all attributes, if none are allowed for this element
+ * Removes all attributes, if none are allowed for this element.
  *
  * If some are allowed it calls wp_kses_hair() to split them further, and then
  * it builds up new HTML code from the data that kses_hair() returns. It also
  *
  * If some are allowed it calls wp_kses_hair() to split them further, and then
  * it builds up new HTML code from the data that kses_hair() returns. It also
- * removes "<" and ">" characters, if there are any left. One more thing it
- * does is to check if the tag has a closing XHTML slash, and if it does, it
- * puts one in the returned code as well.
+ * removes "<" and ">" characters, if there are any left. One more thing it does
+ * is to check if the tag has a closing XHTML slash, and if it does, it puts one
+ * in the returned code as well.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -530,7 +534,7 @@ function wp_kses_attr($element, $attr, $allowed_html, $allowed_protocols) {
 }
 
 /**
 }
 
 /**
- * wp_kses_hair() - Builds an attribute list from string containing attributes.
+ * Builds an attribute list from string containing attributes.
  *
  * This function does a lot of work. It parses an attribute list into an array
  * with attribute data, and tries to do the right thing even if it gets weird
  *
  * This function does a lot of work. It parses an attribute list into an array
  * with attribute data, and tries to do the right thing even if it gets weird
@@ -550,6 +554,7 @@ function wp_kses_hair($attr, $allowed_protocols) {
        $attrarr = array ();
        $mode = 0;
        $attrname = '';
        $attrarr = array ();
        $mode = 0;
        $attrname = '';
+       $uris = array('xmlns', 'profile', 'href', 'src', 'cite', 'classid', 'codebase', 'data', 'usemap', 'longdesc', 'action');
 
        # Loop through the whole attribute list
 
 
        # Loop through the whole attribute list
 
@@ -594,7 +599,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
                                        # "value"
                                        {
                                if (preg_match('/^"([^"]*)"(\s+|$)/', $attr, $match))
                                        # "value"
                                        {
-                                       $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
+                                       $thisval = $match[1];
+                                       if ( in_array($attrname, $uris) )
+                                               $thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
 
                                        if(FALSE === array_key_exists($attrname, $attrarr)) {
                                                $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
 
                                        if(FALSE === array_key_exists($attrname, $attrarr)) {
                                                $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
@@ -608,7 +615,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
                                        # 'value'
                                        {
                                if (preg_match("/^'([^']*)'(\s+|$)/", $attr, $match))
                                        # 'value'
                                        {
-                                       $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
+                                       $thisval = $match[1];
+                                       if ( in_array($attrname, $uris) )
+                                               $thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
 
                                        if(FALSE === array_key_exists($attrname, $attrarr)) {
                                                $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
 
                                        if(FALSE === array_key_exists($attrname, $attrarr)) {
                                                $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname='$thisval'", 'vless' => 'n');
@@ -622,7 +631,9 @@ function wp_kses_hair($attr, $allowed_protocols) {
                                if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
                                        # value
                                        {
                                if (preg_match("%^([^\s\"']+)(\s+|$)%", $attr, $match))
                                        # value
                                        {
-                                       $thisval = wp_kses_bad_protocol($match[1], $allowed_protocols);
+                                       $thisval = $match[1];
+                                       if ( in_array($attrname, $uris) )
+                                               $thisval = wp_kses_bad_protocol($thisval, $allowed_protocols);
 
                                        if(FALSE === array_key_exists($attrname, $attrarr)) {
                                                $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
 
                                        if(FALSE === array_key_exists($attrname, $attrarr)) {
                                                $attrarr[$attrname] = array ('name' => $attrname, 'value' => $thisval, 'whole' => "$attrname=\"$thisval\"", 'vless' => 'n');
@@ -652,7 +663,7 @@ function wp_kses_hair($attr, $allowed_protocols) {
 }
 
 /**
 }
 
 /**
- * wp_kses_check_attr_val() - Performs different checks for attribute values.
+ * Performs different checks for attribute values.
  *
  * The currently implemented checks are "maxlen", "minlen", "maxval", "minval"
  * and "valueless" with even more checks to come soon.
  *
  * The currently implemented checks are "maxlen", "minlen", "maxval", "minval"
  * and "valueless" with even more checks to come soon.
@@ -724,12 +735,12 @@ function wp_kses_check_attr_val($value, $vless, $checkname, $checkvalue) {
 }
 
 /**
 }
 
 /**
- * wp_kses_bad_protocol() - Sanitize string from bad protocols
+ * Sanitize string from bad protocols.
  *
  *
- * This function removes all non-allowed protocols from the beginning
- * of $string. It ignores whitespace and the case of the letters, and
- * it does understand HTML entities. It does its work in a while loop,
- * so it won't be fooled by a string like "javascript:javascript:alert(57)".
+ * This function removes all non-allowed protocols from the beginning of
+ * $string. It ignores whitespace and the case of the letters, and it does
+ * understand HTML entities. It does its work in a while loop, so it won't be
+ * fooled by a string like "javascript:javascript:alert(57)".
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -751,7 +762,7 @@ function wp_kses_bad_protocol($string, $allowed_protocols) {
 }
 
 /**
 }
 
 /**
- * wp_kses_no_null() - Removes any NULL characters in $string.
+ * Removes any NULL characters in $string.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -766,11 +777,11 @@ function wp_kses_no_null($string) {
 }
 
 /**
 }
 
 /**
- * wp_kses_stripslashes() - Strips slashes from in front of quotes
+ * Strips slashes from in front of quotes.
  *
  *
- * This function changes the character sequence  \"  to just  "
- * It leaves all other slashes alone. It's really weird, but the
- * quoting from preg_replace(//e) seems to require this.
+ * This function changes the character sequence  \"  to just  ". It leaves all
+ * other slashes alone. It's really weird, but the quoting from
+ * preg_replace(//e) seems to require this.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -782,7 +793,7 @@ function wp_kses_stripslashes($string) {
 }
 
 /**
 }
 
 /**
- * wp_kses_array_lc() - Goes through an array and changes the keys to all lower case.
+ * Goes through an array and changes the keys to all lower case.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -792,11 +803,11 @@ function wp_kses_stripslashes($string) {
 function wp_kses_array_lc($inarray) {
        $outarray = array ();
 
 function wp_kses_array_lc($inarray) {
        $outarray = array ();
 
-       foreach ($inarray as $inkey => $inval) {
+       foreach ( (array) $inarray as $inkey => $inval) {
                $outkey = strtolower($inkey);
                $outarray[$outkey] = array ();
 
                $outkey = strtolower($inkey);
                $outarray[$outkey] = array ();
 
-               foreach ($inval as $inkey2 => $inval2) {
+               foreach ( (array) $inval as $inkey2 => $inval2) {
                        $outkey2 = strtolower($inkey2);
                        $outarray[$outkey][$outkey2] = $inval2;
                } # foreach $inval
                        $outkey2 = strtolower($inkey2);
                        $outarray[$outkey][$outkey2] = $inval2;
                } # foreach $inval
@@ -806,7 +817,7 @@ function wp_kses_array_lc($inarray) {
 }
 
 /**
 }
 
 /**
- * wp_kses_js_entities() - Removes the HTML JavaScript entities found in early versions of Netscape 4.
+ * Removes the HTML JavaScript entities found in early versions of Netscape 4.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -818,10 +829,10 @@ function wp_kses_js_entities($string) {
 }
 
 /**
 }
 
 /**
- * wp_kses_html_error() - Handles parsing errors in wp_kses_hair()
+ * Handles parsing errors in wp_kses_hair().
  *
  *
- * The general plan is to remove everything to and including some
- * whitespace, but it deals with quotes and apostrophes as well.
+ * The general plan is to remove everything to and including some whitespace,
+ * but it deals with quotes and apostrophes as well.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -833,10 +844,10 @@ function wp_kses_html_error($string) {
 }
 
 /**
 }
 
 /**
- * wp_kses_bad_protocol_once() - Sanitizes content from bad protocols and other characters
+ * Sanitizes content from bad protocols and other characters.
  *
  *
- * This function searches for URL protocols at the beginning of $string,
- * while handling whitespace and HTML entities.
+ * This function searches for URL protocols at the beginning of $string, while
+ * handling whitespace and HTML entities.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -850,26 +861,37 @@ function wp_kses_bad_protocol_once($string, $allowed_protocols) {
 
        $string2 = preg_split('/:|&#58;|&#x3a;/i', $string, 2);
        if ( isset($string2[1]) && !preg_match('%/\?%', $string2[0]) )
 
        $string2 = preg_split('/:|&#58;|&#x3a;/i', $string, 2);
        if ( isset($string2[1]) && !preg_match('%/\?%', $string2[0]) )
-               $string = wp_kses_bad_protocol_once2($string2[0], $allowed_protocols) . trim($string2[1]);
+               $string = wp_kses_bad_protocol_once2($string2[0]) . trim($string2[1]);
        else
        else
-               $string = preg_replace_callback('/^((&[^;]*;|[\sA-Za-z0-9])*)'.'(:|&#58;|&#[Xx]3[Aa];)\s*/', create_function('$matches', 'global $_kses_allowed_protocols; return wp_kses_bad_protocol_once2($matches[1], $_kses_allowed_protocols);'), $string);
+               $string = preg_replace_callback('/^((&[^;]*;|[\sA-Za-z0-9])*)'.'(:|&#58;|&#[Xx]3[Aa];)\s*/', 'wp_kses_bad_protocol_once2', $string);
 
        return $string;
 }
 
 /**
 
        return $string;
 }
 
 /**
- * wp_kses_bad_protocol_once2() - Callback for wp_kses_bad_protocol_once() regular expression.
+ * Callback for wp_kses_bad_protocol_once() regular expression.
  *
  * This function processes URL protocols, checks to see if they're in the
  * white-list or not, and returns different data depending on the answer.
  *
  *
  * This function processes URL protocols, checks to see if they're in the
  * white-list or not, and returns different data depending on the answer.
  *
+ * @access private
  * @since 1.0.0
  *
  * @since 1.0.0
  *
- * @param string $string Content to check for bad protocols
- * @param array $allowed_protocols Allowed protocols
+ * @param mixed $matches string or preg_replace_callback() matches array to check for bad protocols
  * @return string Sanitized content
  */
  * @return string Sanitized content
  */
-function wp_kses_bad_protocol_once2($string, $allowed_protocols) {
+function wp_kses_bad_protocol_once2($matches) {
+       global $_kses_allowed_protocols;
+
+       if ( is_array($matches) ) {
+               if ( ! isset($matches[1]) || empty($matches[1]) )
+                       return '';
+
+               $string = $matches[1];
+       } else {
+               $string = $matches;
+       }
+
        $string2 = wp_kses_decode_entities($string);
        $string2 = preg_replace('/\s/', '', $string2);
        $string2 = wp_kses_no_null($string2);
        $string2 = wp_kses_decode_entities($string);
        $string2 = preg_replace('/\s/', '', $string2);
        $string2 = wp_kses_no_null($string2);
@@ -878,7 +900,7 @@ function wp_kses_bad_protocol_once2($string, $allowed_protocols) {
        $string2 = strtolower($string2);
 
        $allowed = false;
        $string2 = strtolower($string2);
 
        $allowed = false;
-       foreach ($allowed_protocols as $one_protocol)
+       foreach ( (array) $_kses_allowed_protocols as $one_protocol)
                if (strtolower($one_protocol) == $string2) {
                        $allowed = true;
                        break;
                if (strtolower($one_protocol) == $string2) {
                        $allowed = true;
                        break;
@@ -891,11 +913,10 @@ function wp_kses_bad_protocol_once2($string, $allowed_protocols) {
 }
 
 /**
 }
 
 /**
- * wp_kses_normalize_entities() - Converts and fixes HTML entities
+ * Converts and fixes HTML entities.
  *
  *
- * This function normalizes HTML entities. It will convert "AT&T" to the
- * correct "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;"
- * and so on.
+ * This function normalizes HTML entities. It will convert "AT&T" to the correct
+ * "AT&amp;T", "&#00058;" to "&#58;", "&#XYZZY;" to "&amp;#XYZZY;" and so on.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -910,33 +931,70 @@ function wp_kses_normalize_entities($string) {
        # Change back the allowed entities in our entity whitelist
 
        $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
        # Change back the allowed entities in our entity whitelist
 
        $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
-       $string = preg_replace_callback('/&amp;#0*([0-9]{1,5});/', create_function('$matches', 'return wp_kses_normalize_entities2($matches[1]);'), $string);
-       $string = preg_replace('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);
+       $string = preg_replace_callback('/&amp;#0*([0-9]{1,5});/', 'wp_kses_normalize_entities2', $string);
+       $string = preg_replace_callback('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', 'wp_kses_normalize_entities3', $string);
 
        return $string;
 }
 
 /**
 
        return $string;
 }
 
 /**
- * wp_kses_normalize_entities2() - Callback for wp_kses_normalize_entities() regular expression
+ * Callback for wp_kses_normalize_entities() regular expression.
  *
  *
- * This function helps wp_kses_normalize_entities() to only accept 16 bit
- * values and nothing more for &#number; entities.
+ * This function helps wp_kses_normalize_entities() to only accept 16 bit values
+ * and nothing more for &#number; entities.
  *
  *
+ * @access private
  * @since 1.0.0
  *
  * @since 1.0.0
  *
- * @param int $i Number encoded entity
+ * @param array $matches preg_replace_callback() matches array
  * @return string Correctly encoded entity
  */
  * @return string Correctly encoded entity
  */
-function wp_kses_normalize_entities2($i) {
-       return (($i > 65535) ? "&amp;#$i;" : "&#$i;");
+function wp_kses_normalize_entities2($matches) {
+       if ( ! isset($matches[1]) || empty($matches[1]) )
+               return '';
+
+       $i = $matches[1];
+       return ( ( ! valid_unicode($i) ) || ($i > 65535) ? "&amp;#$i;" : "&#$i;" );
 }
 
 /**
 }
 
 /**
- * wp_kses_decode_entities() - Convert all entities to their character counterparts.
+ * Callback for wp_kses_normalize_entities() for regular expression.
+ *
+ * This function helps wp_kses_normalize_entities() to only accept valid Unicode
+ * numeric entities in hex form.
  *
  *
- * This function decodes numeric HTML entities (&#65; and &#x41;). It
- * doesn't do anything with other entities like &auml;, but we don't need
- * them in the URL protocol whitelisting system anyway.
+ * @access private
+ *
+ * @param array $matches preg_replace_callback() matches array
+ * @return string Correctly encoded entity
+ */
+function wp_kses_normalize_entities3($matches) {
+       if ( ! isset($matches[2]) || empty($matches[2]) )
+               return '';
+
+       $hexchars = $matches[2];
+       return ( ( ! valid_unicode(hexdec($hexchars)) ) ? "&amp;#x$hexchars;" : "&#x$hexchars;" );
+}
+
+/**
+ * Helper function to determine if a Unicode value is valid.
+ *
+ * @param int $i Unicode value
+ * @return bool true if the value was a valid Unicode number
+ */
+function valid_unicode($i) {
+       return ( $i == 0x9 || $i == 0xa || $i == 0xd ||
+                       ($i >= 0x20 && $i <= 0xd7ff) ||
+                       ($i >= 0xe000 && $i <= 0xfffd) ||
+                       ($i >= 0x10000 && $i <= 0x10ffff) );
+}
+
+/**
+ * Convert all entities to their character counterparts.
+ *
+ * This function decodes numeric HTML entities (&#65; and &#x41;). It doesn't do
+ * anything with other entities like &auml;, but we don't need them in the URL
+ * protocol whitelisting system anyway.
  *
  * @since 1.0.0
  *
  *
  * @since 1.0.0
  *
@@ -944,14 +1002,14 @@ function wp_kses_normalize_entities2($i) {
  * @return string Content after decoded entities
  */
 function wp_kses_decode_entities($string) {
  * @return string Content after decoded entities
  */
 function wp_kses_decode_entities($string) {
-       $string = preg_replace('/&#([0-9]+);/e', 'chr("\\1")', $string);
-       $string = preg_replace('/&#[Xx]([0-9A-Fa-f]+);/e', 'chr(hexdec("\\1"))', $string);
+       $string = preg_replace_callback('/&#([0-9]+);/', create_function('$match', 'return chr($match[1]);'), $string);
+       $string = preg_replace_callback('/&#[Xx]([0-9A-Fa-f]+);/', create_function('$match', 'return chr(hexdec($match[1]));'), $string);
 
        return $string;
 }
 
 /**
 
        return $string;
 }
 
 /**
- * wp_filter_kses() - Sanitize content with allowed HTML Kses rules
+ * Sanitize content with allowed HTML Kses rules.
  *
  * @since 1.0.0
  * @uses $allowedtags
  *
  * @since 1.0.0
  * @uses $allowedtags
@@ -965,10 +1023,10 @@ function wp_filter_kses($data) {
 }
 
 /**
 }
 
 /**
- * wp_filter_post_kses() - Sanitize content for allowed HTML tags for post content
+ * Sanitize content for allowed HTML tags for post content.
  *
  *
- * Post content refers to the page contents of the 'post' type and not
- * $_POST data from forms.
+ * Post content refers to the page contents of the 'post' type and not $_POST
+ * data from forms.
  *
  * @since 2.0.0
  * @uses $allowedposttags
  *
  * @since 2.0.0
  * @uses $allowedposttags
@@ -982,7 +1040,7 @@ function wp_filter_post_kses($data) {
 }
 
 /**
 }
 
 /**
- * wp_filter_nohtml_kses() - Strips all of the HTML in the content
+ * Strips all of the HTML in the content.
  *
  * @since 2.1.0
  *
  *
  * @since 2.1.0
  *
@@ -994,13 +1052,13 @@ function wp_filter_nohtml_kses($data) {
 }
 
 /**
 }
 
 /**
- * kses_init_filters() - Adds all Kses input form content filters
+ * Adds all Kses input form content filters.
+ *
+ * All hooks have default priority. The wp_filter_kses() function is added to
+ * the 'pre_comment_content' and 'title_save_pre' hooks.
  *
  *
- * All hooks have default priority. The wp_filter_kses() fucntion
- * is added to the 'pre_comment_content' and 'title_save_pre'
- * hooks. The wp_filter_post_kses() function is added to the
- * 'content_save_pre', 'excerpt_save_pre', and 'content_filtered_save_pre'
- * hooks.
+ * The wp_filter_post_kses() function is added to the 'content_save_pre',
+ * 'excerpt_save_pre', and 'content_filtered_save_pre' hooks.
  *
  * @since 2.0.0
  * @uses add_filter() See description for what functions are added to what hooks.
  *
  * @since 2.0.0
  * @uses add_filter() See description for what functions are added to what hooks.
@@ -1017,15 +1075,14 @@ function kses_init_filters() {
 }
 
 /**
 }
 
 /**
- * kses_remove_filters() - Removes all Kses input form content filters
+ * Removes all Kses input form content filters.
  *
  *
- * A quick procedural method to removing all of the filters
- * that kses uses for content in WordPress Loop.
+ * A quick procedural method to removing all of the filters that kses uses for
+ * content in WordPress Loop.
  *
  *
- * Does not remove the kses_init() function from 'init' hook
- * (priority is default). Also does not remove kses_init()
- * function from 'set_current_user' hook (priority is also
- * default).
+ * Does not remove the kses_init() function from 'init' hook (priority is
+ * default). Also does not remove kses_init() function from 'set_current_user'
+ * hook (priority is also default).
  *
  * @since 2.0.6
  */
  *
  * @since 2.0.6
  */
@@ -1041,15 +1098,15 @@ function kses_remove_filters() {
 }
 
 /**
 }
 
 /**
- * kses_init() - Sets up most of the Kses filters for input form content
+ * Sets up most of the Kses filters for input form content.
  *
  * If you remove the kses_init() function from 'init' hook and
  *
  * If you remove the kses_init() function from 'init' hook and
- * 'set_current_user' (priority is default), then none of the
- * Kses filter hooks will be added.
+ * 'set_current_user' (priority is default), then none of the Kses filter hooks
+ * will be added.
  *
  *
- * First removes all of the Kses filters in case the current user
- * does not need to have Kses filter the content. If the user does
- * not have unfiltered html capability, then Kses filters are added.
+ * First removes all of the Kses filters in case the current user does not need
+ * to have Kses filter the content. If the user does not have unfiltered html
+ * capability, then Kses filters are added.
  *
  * @uses kses_remove_filters() Removes the Kses filters
  * @uses kses_init_filters() Adds the Kses filters back if the user
  *
  * @uses kses_remove_filters() Removes the Kses filters
  * @uses kses_init_filters() Adds the Kses filters back if the user
index 35f89c58ebf5d5930db3f532bf772aafa2273ae7..ed03835b6626a0a1837ab79bebda822b42b067ff 100644 (file)
@@ -7,25 +7,23 @@
  */
 
 /**
  */
 
 /**
- * get_locale() - Gets the current locale
+ * Gets the current locale.
  *
  *
- * If the locale is set, then it will filter the locale
- * in the 'locale' filter hook and return the value.
+ * If the locale is set, then it will filter the locale in the 'locale' filter
+ * hook and return the value.
  *
  *
- * If the locale is not set already, then the WPLANG
- * constant is used if it is defined. Then it is filtered
- * through the 'locale' filter hook and the value for the
- * locale global set and the locale is returned.
+ * If the locale is not set already, then the WPLANG constant is used if it is
+ * defined. Then it is filtered through the 'locale' filter hook and the value
+ * for the locale global set and the locale is returned.
  *
  *
- * The process to get the locale should only be done once
- * but the locale will always be filtered using the
- * 'locale' hook.
+ * The process to get the locale should only be done once but the locale will
+ * always be filtered using the 'locale' hook.
  *
  * @since 1.5.0
  *
  * @since 1.5.0
- * @uses apply_filters() Calls 'locale' hook on locale value
- * @uses $locale Gets the locale stored in the global
+ * @uses apply_filters() Calls 'locale' hook on locale value.
+ * @uses $locale Gets the locale stored in the global.
  *
  *
- * @return string The locale of the blog or from the 'locale' hook
+ * @return string The locale of the blog or from the 'locale' hook.
  */
 function get_locale() {
        global $locale;
  */
 function get_locale() {
        global $locale;
@@ -46,40 +44,46 @@ function get_locale() {
 }
 
 /**
 }
 
 /**
- * translate() - Retrieve the translated text
+ * 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 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.
  *
  * @since 2.2.0
  *
  * If the domain is not set, the $text is just returned.
  *
  * @since 2.2.0
- * @uses $l10n Gets list of domain translated string (gettext_reader) objects
+ * @uses $l10n Gets list of domain translated string (gettext_reader) objects.
  * @uses apply_filters() Calls 'gettext' on domain translated text
  * @uses apply_filters() Calls 'gettext' on domain translated text
- *             with the untranslated text as second parameter
+ *             with the untranslated text as second parameter.
  *
  *
- * @param string $text Text to translate
- * @param string $domain Domain to retrieve the translated text
+ * @param string $text Text to translate.
+ * @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 string Translated text
  */
 function translate($text, $domain = 'default') {
        global $l10n;
 
        if (isset($l10n[$domain]))
-               return apply_filters('gettext', $l10n[$domain]->translate($text), $text);
+               return apply_filters('gettext', $l10n[$domain]->translate($text), $text, $domain);
        else
        else
-               return $text;
+               return apply_filters('gettext', $text, $text, $domain);
+}
+
+function before_last_bar( $string ) {
+       $last_bar = strrpos( $string, '|' );
+       if ( false == $last_bar )
+               return $string;
+       else
+               return substr( $string, 0, $last_bar );
 }
 
 /**
 }
 
 /**
- * translate_with_context() - Retrieve the translated text and strip context
+ * 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 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.
  *
  *
  * If the domain is not set, the $text is just returned.
  *
@@ -90,21 +94,13 @@ function translate($text, $domain = 'default') {
  * @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_with_context($text, $domain = 'default') {
-       $whole = translate($text, $domain);
-       $last_bar = strrpos($whole, '|');
-       if ( false == $last_bar ) {
-               return $whole;
-       } else {
-               return substr($whole, 0, $last_bar);
-       }
+function translate_with_context( $text, $domain = 'default' ) {
+       return before_last_bar( translate( $text, $domain ) );
+
 }
 
 /**
 }
 
 /**
- * __() - Retrieve a translated string
- *
- * __() is a convenience function which retrieves the translated
- * string from the translate().
+ * Retrieves the translated string from the translate().
  *
  * @see translate() An alias of translate()
  * @since 2.1.0
  *
  * @see translate() An alias of translate()
  * @since 2.1.0
@@ -117,12 +113,8 @@ function __($text, $domain = 'default') {
        return translate($text, $domain);
 }
 
        return translate($text, $domain);
 }
 
-// .
 /**
 /**
- * _e() - Display a translated string
- *
- * _e() is a convenience function which displays the returned
- * translated text from translate().
+ * Displays the returned translated text from translate().
  *
  * @see translate() Echos returned translate() string
  * @since 1.2.0
  *
  * @see translate() Echos returned translate() string
  * @since 1.2.0
@@ -135,20 +127,17 @@ function _e($text, $domain = 'default') {
 }
 
 /**
 }
 
 /**
- * _c() - Retrieve context translated string
+ * Retrieve context translated string.
  *
  *
- * 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.
  *
  *
- * In order to use the separate contexts, the _c() function
- * is used and the translatable string uses a pipe ('|')
- * which has the context the string is in.
+ * In order to use the separate contexts, the _c() function is used and the
+ * translatable string uses a pipe ('|') which has the context the string is in.
  *
  *
- * When the translated string is returned, it is everything
- * before the pipe, not including the pipe character. If
- * there is no pipe in the translated text then everything
- * is returned.
+ * When the translated string is returned, it is everything before the pipe, not
+ * including the pipe character. If there is no pipe in the translated text then
+ * everything is returned.
  *
  * @since 2.2.0
  *
  *
  * @since 2.2.0
  *
@@ -161,15 +150,15 @@ function _c($text, $domain = 'default') {
 }
 
 /**
 }
 
 /**
- * __ngettext() - 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 and either $plural or $single parameters returned.
+ * If the domain is not set in the $l10n list, then a comparsion will be made
+ * and either $plural or $single parameters returned.
  *
  *
- * If the domain does exist, then the parameters $single, $plural,
- * and $number will first be passed to the domain's ngettext method.
- * Then it will be passed to the 'ngettext' filter hook along with
- * the same parameters. The expected type will be a string.
+ * If the domain does exist, then the parameters $single, $plural, and $number
+ * will first be passed to the domain's ngettext method. Then it will be passed
+ * to the 'ngettext' filter hook along with the same parameters. The expected
+ * type will be a string.
  *
  * @since 1.2.0
  * @uses $l10n Gets list of domain translated string (gettext_reader) objects
  *
  * @since 1.2.0
  * @uses $l10n Gets list of domain translated string (gettext_reader) objects
@@ -196,7 +185,25 @@ function __ngettext($single, $plural, $number, $domain = 'default') {
 }
 
 /**
 }
 
 /**
- * __ngettext_noop() - register plural strings in POT file, but don't translate them
+ * @see __ngettext() An alias of __ngettext
+ *
+ */
+function _n() {
+       $args = func_get_args();
+       return call_user_func_array('__ngettext', $args);
+}
+
+/**
+ * @see _n() A version of _n(), which supports contexts --
+ * strips everything from the translation after the last bar
+ *
+ */
+function _nc( $single, $plural, $number, $domain = 'default' ) {
+       return before_last_bar( __ngettext( $single, $plural, $number, $domain ) );
+}
+
+/**
+ * Register plural strings in POT file, but don't translate them.
  *
  * Used when you want do keep structures with translatable plural strings and
  * use them later.
  *
  * Used when you want do keep structures with translatable plural strings and
  * use them later.
@@ -222,13 +229,22 @@ function __ngettext_noop($single, $plural, $number=1, $domain = 'default') {
 }
 
 /**
 }
 
 /**
- * load_textdomain() - Loads MO file into the list of domains
+ * @see __ngettext_noop() An alias of __ngettext_noop()
  *
  *
- * If the domain already exists, the inclusion will fail. If the
- * MO file is not readable, the inclusion will fail.
+ */
+function _n_noop() {
+       $args = func_get_args();
+       return call_user_func_array('__ngettext_noop', $args);
+}
+
+/**
+ * Loads MO file into the list of domains.
  *
  *
- * On success, the mofile will be placed in the $l10n global by
- * $domain and will be an gettext_reader object.
+ * 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.
  *
  * @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
@@ -260,10 +276,10 @@ function load_textdomain($domain, $mofile) {
 }
 
 /**
 }
 
 /**
- * load_default_textdomain() - Loads default translated strings based on locale
+ * Loads default translated strings based on locale.
  *
  *
- * Loads the .mo file in WP_LANG_DIR constant path from WordPress root.
- * The translated (.mo) file is named based off of the locale.
+ * Loads the .mo file in WP_LANG_DIR constant path from WordPress root. The
+ * translated (.mo) file is named based off of the locale.
  *
  * @since 1.5.0
  */
  *
  * @since 1.5.0
  */
@@ -276,11 +292,11 @@ function load_default_textdomain() {
 }
 
 /**
 }
 
 /**
- * load_plugin_textdomain() - Loads the plugin's translated strings
+ * 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.
+ * 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.
  *
  * @since 1.5.0
  *
  *
  * @since 1.5.0
  *
@@ -291,7 +307,7 @@ function load_default_textdomain() {
  */
 function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) {
        $locale = get_locale();
  */
 function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path = false) {
        $locale = get_locale();
-       
+
        if ( false !== $plugin_rel_path )
                $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/');
        else if ( false !== $abs_rel_path)
        if ( false !== $plugin_rel_path )
                $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/');
        else if ( false !== $abs_rel_path)
@@ -304,7 +320,7 @@ function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path
 }
 
 /**
 }
 
 /**
- * load_theme_textdomain() - Includes theme's translated strings for the theme
+ * Loads the theme's translated strings.
  *
  * If the current locale exists as a .mo file in the theme's root directory, it
  * will be included in the translated strings by the $domain.
  *
  * If the current locale exists as a .mo file in the theme's root directory, it
  * will be included in the translated strings by the $domain.
@@ -315,10 +331,12 @@ function load_plugin_textdomain($domain, $abs_rel_path = false, $plugin_rel_path
  *
  * @param string $domain Unique identifier for retrieving translated strings
  */
  *
  * @param string $domain Unique identifier for retrieving translated strings
  */
-function load_theme_textdomain($domain) {
+function load_theme_textdomain($domain, $path = false) {
        $locale = get_locale();
 
        $locale = get_locale();
 
-       $mofile = get_template_directory() . "/$locale.mo";
+       $path = ( empty( $path ) ) ? get_template_directory() : $path;
+
+       $mofile = "$path/$locale.mo";
        load_textdomain($domain, $mofile);
 }
 
        load_textdomain($domain, $mofile);
 }
 
index a1286a9cd0094fd77f16fa4ba060bf45b319f000..d716a9e3919142a7432dff1c30f484896124951a 100644 (file)
@@ -1,17 +1,34 @@
 <?php
 <?php
+/**
+ * WordPress Link Template Functions
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
 
 
-
+/**
+ * Display the permalink for the current post.
+ *
+ * @since 1.2.0
+ * @uses apply_filters() Calls 'the_permalink' filter on the permalink string.
+ */
 function the_permalink() {
        echo apply_filters('the_permalink', get_permalink());
 }
 
 function the_permalink() {
        echo apply_filters('the_permalink', get_permalink());
 }
 
-
 /**
 /**
- * Conditionally adds a trailing slash if the permalink structure
- * has a trailing slash, strips the trailing slash if not
- * @global object Uses $wp_rewrite
- * @param $string string a URL with or without a trailing slash
- * @param $type_of_url string the type of URL being considered (e.g. single, category, etc) for use in the filter
+ * Retrieve trailing slash string, if blog set for adding trailing slashes.
+ *
+ * Conditionally adds a trailing slash if the permalink structure has a trailing
+ * slash, strips the trailing slash if not. The string is passed through the
+ * 'user_trailingslashit' filter. Will remove trailing slash from string, if
+ * blog is not set to have them.
+ *
+ * @since 2.2.0
+ * @uses $wp_rewrite
+ *
+ * @param $string String a URL with or without a trailing slash.
+ * @param $type_of_url String the type of URL being considered (e.g. single, category, etc) for use in the filter.
  * @return string
  */
 function user_trailingslashit($string, $type_of_url = '') {
  * @return string
  */
 function user_trailingslashit($string, $type_of_url = '') {
@@ -27,7 +44,16 @@ function user_trailingslashit($string, $type_of_url = '') {
        return $string;
 }
 
        return $string;
 }
 
-
+/**
+ * Display permalink anchor for current post.
+ *
+ * The permalink mode title will use the post title for the 'a' element 'id'
+ * attribute. The id mode uses 'post-' with the post ID for the 'id' attribute.
+ *
+ * @since 0.71
+ *
+ * @param string $mode Permalink mode can be either 'title', 'id', or default, which is 'id'.
+ */
 function permalink_anchor($mode = 'id') {
        global $post;
        switch ( strtolower($mode) ) {
 function permalink_anchor($mode = 'id') {
        global $post;
        switch ( strtolower($mode) ) {
@@ -42,8 +68,16 @@ function permalink_anchor($mode = 'id') {
        }
 }
 
        }
 }
 
-
-function get_permalink($id = 0, $leavename=false) {
+/**
+ * Retrieve full permalink for current post or post ID.
+ *
+ * @since 1.0.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $leavename Optional, defaults to false. Whether to keep post name or page name.
+ * @return string
+ */
+function get_permalink($id = 0, $leavename = false) {
        $rewritecode = array(
                '%year%',
                '%monthnum%',
        $rewritecode = array(
                '%year%',
                '%monthnum%',
@@ -58,9 +92,12 @@ function get_permalink($id = 0, $leavename=false) {
                $leavename? '' : '%pagename%',
        );
 
                $leavename? '' : '%pagename%',
        );
 
-       $post = &get_post($id);
+       if ( is_object($id) && isset($id->filter) && 'sample' == $id->filter )
+               $post = $id;
+       else
+               $post = &get_post($id);
 
 
-       if ( empty($post->ID) ) return FALSE;
+       if ( empty($post->ID) ) return false;
 
        if ( $post->post_type == 'page' )
                return get_page_link($post->ID, $leavename);
 
        if ( $post->post_type == 'page' )
                return get_page_link($post->ID, $leavename);
@@ -75,17 +112,17 @@ function get_permalink($id = 0, $leavename=false) {
                $category = '';
                if ( strpos($permalink, '%category%') !== false ) {
                        $cats = get_the_category($post->ID);
                $category = '';
                if ( strpos($permalink, '%category%') !== false ) {
                        $cats = get_the_category($post->ID);
-                       if ( $cats )
+                       if ( $cats ) {
                                usort($cats, '_usort_terms_by_ID'); // order by ID
                                usort($cats, '_usort_terms_by_ID'); // order by ID
-                       $category = $cats[0]->slug;
-                       if ( $parent=$cats[0]->parent )
-                               $category = get_category_parents($parent, FALSE, '/', TRUE) . $category;
-
+                               $category = $cats[0]->slug;
+                               if ( $parent = $cats[0]->parent )
+                                       $category = get_category_parents($parent, false, '/', true) . $category;
+                       }
                        // show default category in permalinks, without
                        // having to assign it explicitly
                        if ( empty($category) ) {
                                $default_category = get_category( get_option( 'default_category' ) );
                        // show default category in permalinks, without
                        // having to assign it explicitly
                        if ( empty($category) ) {
                                $default_category = get_category( get_option( 'default_category' ) );
-                               $category = is_wp_error( $default_category ) ? '' : $default_category->slug; 
+                               $category = is_wp_error( $default_category ) ? '' : $default_category->slug;
                        }
                }
 
                        }
                }
 
@@ -112,19 +149,37 @@ function get_permalink($id = 0, $leavename=false) {
                );
                $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);
                $permalink = user_trailingslashit($permalink, 'single');
                );
                $permalink = get_option('home') . str_replace($rewritecode, $rewritereplace, $permalink);
                $permalink = user_trailingslashit($permalink, 'single');
-               return apply_filters('post_link', $permalink, $post);
+               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;
        } else { // if they're not using the fancy permalink option
                $permalink = get_option('home') . '/?p=' . $post->ID;
-               return apply_filters('post_link', $permalink, $post);
+               return apply_filters('post_link', $permalink, $post, $leavename);
        }
 }
 
        }
 }
 
-// get permalink from post ID
+/**
+ * Retrieve permalink from post ID.
+ *
+ * @since 1.0.0
+ *
+ * @param int $post_id Optional. Post ID.
+ * @param mixed $deprecated Not used.
+ * @return string
+ */
 function post_permalink($post_id = 0, $deprecated = '') {
        return get_permalink($post_id);
 }
 
 function post_permalink($post_id = 0, $deprecated = '') {
        return get_permalink($post_id);
 }
 
-// Respects page_on_front.  Use this one.
+/**
+ * Retrieve the permalink for current page or page ID.
+ *
+ * Respects page_on_front. Use this one.
+ *
+ * @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.
+ * @return string
+ */
 function get_page_link($id = false, $leavename = false) {
        global $post;
 
 function get_page_link($id = false, $leavename = false) {
        global $post;
 
@@ -140,7 +195,18 @@ function get_page_link($id = false, $leavename = false) {
        return apply_filters('page_link', $link, $id);
 }
 
        return apply_filters('page_link', $link, $id);
 }
 
-// Ignores page_on_front.  Internal use only.
+/**
+ * Retrieve the page permalink.
+ *
+ * Ignores page_on_front. Internal use only.
+ *
+ * @since 2.1.0
+ * @access private
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $leavename Optional. Leave name.
+ * @return string
+ */
 function _get_page_link( $id = false, $leavename = false ) {
        global $post, $wp_rewrite;
 
 function _get_page_link( $id = false, $leavename = false ) {
        global $post, $wp_rewrite;
 
@@ -163,6 +229,16 @@ function _get_page_link( $id = false, $leavename = false ) {
        return apply_filters( '_get_page_link', $link, $id );
 }
 
        return apply_filters( '_get_page_link', $link, $id );
 }
 
+/**
+ * Retrieve permalink for attachment.
+ *
+ * This can be used in the WordPress Loop or outside of it.
+ *
+ * @since 2.0.0
+ *
+ * @param int $id Optional. Post ID.
+ * @return string
+ */
 function get_attachment_link($id = false) {
        global $post, $wp_rewrite;
 
 function get_attachment_link($id = false) {
        global $post, $wp_rewrite;
 
@@ -194,6 +270,14 @@ function get_attachment_link($id = false) {
        return apply_filters('attachment_link', $link, $id);
 }
 
        return apply_filters('attachment_link', $link, $id);
 }
 
+/**
+ * Retrieve the permalink for the year archives.
+ *
+ * @since 1.5.0
+ *
+ * @param int|bool $year False for current year or year for permalink.
+ * @return string
+ */
 function get_year_link($year) {
        global $wp_rewrite;
        if ( !$year )
 function get_year_link($year) {
        global $wp_rewrite;
        if ( !$year )
@@ -207,6 +291,15 @@ function get_year_link($year) {
        }
 }
 
        }
 }
 
+/**
+ * Retrieve the permalink for the month archives with year.
+ *
+ * @since 1.0.0
+ *
+ * @param bool|int $year False for current year. Integer of year.
+ * @param bool|int $month False for current month. Integer of month.
+ * @return string
+ */
 function get_month_link($year, $month) {
        global $wp_rewrite;
        if ( !$year )
 function get_month_link($year, $month) {
        global $wp_rewrite;
        if ( !$year )
@@ -223,6 +316,16 @@ function get_month_link($year, $month) {
        }
 }
 
        }
 }
 
+/**
+ * Retrieve the permalink for the day archives with year and month.
+ *
+ * @since 1.0.0
+ *
+ * @param bool|int $year False for current year. Integer of year.
+ * @param bool|int $month False for current month. Integer of month.
+ * @param bool|int $day False for current day. Integer of day.
+ * @return string
+ */
 function get_day_link($year, $month, $day) {
        global $wp_rewrite;
        if ( !$year )
 function get_day_link($year, $month, $day) {
        global $wp_rewrite;
        if ( !$year )
@@ -243,6 +346,14 @@ function get_day_link($year, $month, $day) {
        }
 }
 
        }
 }
 
+/**
+ * Retrieve the permalink for the feed type.
+ *
+ * @since 1.5.0
+ *
+ * @param string $feed Optional, defaults to default feed. Feed type.
+ * @return string
+ */
 function get_feed_link($feed = '') {
        global $wp_rewrite;
 
 function get_feed_link($feed = '') {
        global $wp_rewrite;
 
@@ -272,6 +383,15 @@ function get_feed_link($feed = '') {
        return apply_filters('feed_link', $output, $feed);
 }
 
        return apply_filters('feed_link', $output, $feed);
 }
 
+/**
+ * Retrieve the permalink for the post comments feed.
+ *
+ * @since 2.2.0
+ *
+ * @param int $post_id Optional. Post ID.
+ * @param string $feed Optional. Feed type.
+ * @return string
+ */
 function get_post_comments_feed_link($post_id = '', $feed = '') {
        global $id;
 
 function get_post_comments_feed_link($post_id = '', $feed = '') {
        global $id;
 
@@ -297,19 +417,21 @@ function get_post_comments_feed_link($post_id = '', $feed = '') {
        return apply_filters('post_comments_feed_link', $url);
 }
 
        return apply_filters('post_comments_feed_link', $url);
 }
 
-/** post_comments_feed_link() - Output the comment feed link for a post.
+/**
+ * Display the comment feed link for a post.
  *
  *
- * Prints out the comment feed link for a post.  Link text is placed in the
- * anchor.  If no link text is specified, default text is used.  If no post ID
- * is specified, the current post is used.
+ * Prints out the comment feed link for a post. Link text is placed in the
+ * anchor. If no link text is specified, default text is used. If no post ID is
+ * specified, the current post is used.
  *
  * @package WordPress
  * @subpackage Feed
  *
  * @package WordPress
  * @subpackage Feed
- * @since 2.5
+ * @since 2.5.0
  *
  *
- * @param string Descriptive text
- * @param int Optional post ID.  Default to current post.
- * @return string Link to the comment feed for the current post
+ * @param string $link_text Descriptive text.
+ * @param int $post_id Optional post ID.  Default to current post.
+ * @param string $feed Optional. Feed format.
+ * @return string Link to the comment feed for the current post.
 */
 function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
        $url = get_post_comments_feed_link($post_id, $feed);
 */
 function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
        $url = get_post_comments_feed_link($post_id, $feed);
@@ -319,6 +441,20 @@ function post_comments_feed_link( $link_text = '', $post_id = '', $feed = '' ) {
        echo "<a href='$url'>$link_text</a>";
 }
 
        echo "<a href='$url'>$link_text</a>";
 }
 
+/**
+ * Retrieve the feed link for a given author.
+ *
+ * Returns a link to the feed for all posts by a given author. A specific feed
+ * can be requested or left blank to get the default feed.
+ *
+ * @package WordPress
+ * @subpackage Feed
+ * @since 2.5.0
+ *
+ * @param int $author_id ID of an author.
+ * @param string $feed Optional. Feed type.
+ * @return string Link to the feed for the author specified by $author_id.
+*/
 function get_author_feed_link( $author_id, $feed = '' ) {
        $author_id = (int) $author_id;
        $permalink_structure = get_option('permalink_structure');
 function get_author_feed_link( $author_id, $feed = '' ) {
        $author_id = (int) $author_id;
        $permalink_structure = get_option('permalink_structure');
@@ -327,29 +463,35 @@ 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=rss2&amp;author=' . $author_id;
+               $link = get_option('home') . "?feed=$feed&amp;author=" . $author_id;
        } else {
                $link = get_author_posts_url($author_id);
        } else {
                $link = get_author_posts_url($author_id);
-               $link = trailingslashit($link) . user_trailingslashit('feed', 'feed');
+               if ( $feed == get_default_feed() )
+                       $feed_link = 'feed';
+               else
+                       $feed_link = "feed/$feed";
+
+               $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed');
        }
 
        }
 
-       $link = apply_filters('author_feed_link', $link);
+       $link = apply_filters('author_feed_link', $link, $feed);
 
        return $link;
 }
 
 
        return $link;
 }
 
-/** get_category_feed_link() - Get the feed link for a given category
+/**
+ * Retrieve the feed link for a category.
  *
  *
- * Returns a link to the feed for all post in a given category.  A specific feed can be requested
- * or left blank to get the default feed.
+ * Returns a link to the feed for all post in a given category. A specific feed
+ * can be requested or left blank to get the default feed.
  *
  * @package WordPress
  * @subpackage Feed
  *
  * @package WordPress
  * @subpackage Feed
- * @since 2.5
+ * @since 2.5.0
  *
  *
- * @param int $cat_id ID of a category
- * @param string $feed Feed type
- * @return string Link to the feed for the category specified by $cat_id
+ * @param int $cat_id ID of a category.
+ * @param string $feed Optional. Feed type.
+ * @return string Link to the feed for the category specified by $cat_id.
 */
 function get_category_feed_link($cat_id, $feed = '') {
        $cat_id = (int) $cat_id;
 */
 function get_category_feed_link($cat_id, $feed = '') {
        $cat_id = (int) $cat_id;
@@ -381,6 +523,15 @@ function get_category_feed_link($cat_id, $feed = '') {
        return $link;
 }
 
        return $link;
 }
 
+/**
+ * Retrieve permalink for feed of tag.
+ *
+ * @since 2.3.0
+ *
+ * @param int $tag_id Tag ID.
+ * @param string $feed Optional. Feed type.
+ * @return string
+ */
 function get_tag_feed_link($tag_id, $feed = '') {
        $tag_id = (int) $tag_id;
 
 function get_tag_feed_link($tag_id, $feed = '') {
        $tag_id = (int) $tag_id;
 
@@ -410,6 +561,57 @@ function get_tag_feed_link($tag_id, $feed = '') {
        return $link;
 }
 
        return $link;
 }
 
+/**
+ * Retrieve edit tag link.
+ *
+ * @since 2.7.0
+ *
+ * @param int $tag_id Tag ID
+ * @return string
+ */
+function get_edit_tag_link( $tag_id = 0 ) {
+       $tag = get_term($tag_id, 'post_tag');
+
+       if ( !current_user_can('manage_categories') )
+               return;
+
+       $location = admin_url('edit-tags.php?action=edit&amp;tag_ID=') . $tag->term_id;
+       return apply_filters( 'get_edit_tag_link', $location );
+}
+
+/**
+ * Display or retrieve edit tag link with formatting.
+ *
+ * @since 2.7.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|object $tag Tag object or ID
+ * @return string|null HTML content, if $echo is set to false.
+ */
+function edit_tag_link( $link = '', $before = '', $after = '', $tag = null ) {
+       $tag = get_term($tag, 'post_tag');
+
+       if ( !current_user_can('manage_categories') )
+               return;
+
+       if ( empty($link) )
+               $link = __('Edit This');
+
+       $link = '<a href="' . get_edit_tag_link( $tag->term_id ) . '" title="' . __( 'Edit tag' ) . '">' . $link . '</a>';
+       echo $before . apply_filters( 'edit_tag_link', $link, $tag->term_id ) . $after;
+}
+
+/**
+ * Retrieve the permalink for the feed of the search results.
+ *
+ * @since 2.5.0
+ *
+ * @param string $search_query Optional. Search query.
+ * @param string $feed Optional. Feed type.
+ * @return string
+ */
 function get_search_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
                $search = attribute_escape(get_search_query());
 function get_search_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
                $search = attribute_escape(get_search_query());
@@ -426,6 +628,15 @@ function get_search_feed_link($search_query = '', $feed = '') {
        return $link;
 }
 
        return $link;
 }
 
+/**
+ * Retrieve the permalink for the comments feed of the search results.
+ *
+ * @since 2.5.0
+ *
+ * @param string $search_query Optional. Search query.
+ * @param string $feed Optional. Feed type.
+ * @return string
+ */
 function get_search_comments_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
                $search = attribute_escape(get_search_query());
 function get_search_comments_feed_link($search_query = '', $feed = '') {
        if ( empty($search_query) )
                $search = attribute_escape(get_search_query());
@@ -442,6 +653,18 @@ function get_search_comments_feed_link($search_query = '', $feed = '') {
        return $link;
 }
 
        return $link;
 }
 
+/**
+ * Retrieve edit posts link for post.
+ *
+ * Can be used within the WordPress loop or outside of it. Can be used with
+ * pages, posts, attachments, and revisions.
+ *
+ * @since 2.3.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param string $context Optional, default to display. How to write the '&', defaults to '&amp;'.
+ * @return string
+ */
 function get_edit_post_link( $id = 0, $context = 'display' ) {
        if ( !$post = &get_post( $id ) )
                return;
 function get_edit_post_link( $id = 0, $context = 'display' ) {
        if ( !$post = &get_post( $id ) )
                return;
@@ -478,10 +701,19 @@ function get_edit_post_link( $id = 0, $context = 'display' ) {
                $var  = 'post';
                break;
        endswitch;
                $var  = 'post';
                break;
        endswitch;
-       
+
        return apply_filters( 'get_edit_post_link', admin_url("$file.php?{$action}$var=$post->ID"), $post->ID, $context );
 }
 
        return apply_filters( 'get_edit_post_link', admin_url("$file.php?{$action}$var=$post->ID"), $post->ID, $context );
 }
 
+/**
+ * Retrieve edit posts 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.
+ */
 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
        global $post;
 
 function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
        global $post;
 
@@ -493,10 +725,18 @@ function edit_post_link( $link = 'Edit This', $before = '', $after = '' ) {
                        return;
        }
 
                        return;
        }
 
-       $link = '<a href="' . get_edit_post_link( $post->ID ) . '" title="' . __( 'Edit post' ) . '">' . $link . '</a>';
+       $link = '<a class="post-edit-link" href="' . get_edit_post_link( $post->ID ) . '" title="' . attribute_escape( __( '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;
 }
 
+/**
+ * Retrieve edit comment link.
+ *
+ * @since 2.3.0
+ *
+ * @param int $comment_id Optional. Comment ID.
+ * @return string
+ */
 function get_edit_comment_link( $comment_id = 0 ) {
        $comment = &get_comment( $comment_id );
        $post = &get_post( $comment->comment_post_ID );
 function get_edit_comment_link( $comment_id = 0 ) {
        $comment = &get_comment( $comment_id );
        $post = &get_post( $comment->comment_post_ID );
@@ -513,6 +753,16 @@ function get_edit_comment_link( $comment_id = 0 ) {
        return apply_filters( 'get_edit_comment_link', $location );
 }
 
        return apply_filters( 'get_edit_comment_link', $location );
 }
 
+/**
+ * Display or retrieve edit comment link with formatting.
+ *
+ * @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.
+ * @return string|null HTML content, if $echo is set to false.
+ */
 function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
        global $comment, $post;
 
 function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
        global $comment, $post;
 
@@ -525,20 +775,91 @@ function edit_comment_link( $link = 'Edit This', $before = '', $after = '' ) {
                        return;
        }
 
                        return;
        }
 
-       $link = '<a href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>';
+       $link = '<a class="comment-edit-link" href="' . get_edit_comment_link( $comment->comment_ID ) . '" title="' . __( 'Edit comment' ) . '">' . $link . '</a>';
        echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
 }
 
        echo $before . apply_filters( 'edit_comment_link', $link, $comment->comment_ID ) . $after;
 }
 
+/**
+ * Display edit bookmark (literally a URL external to blog) link.
+ *
+ * @since 2.7.0
+ *
+ * @param int $link Optional. Bookmark ID.
+ * @return string
+ */
+function get_edit_bookmark_link( $link = 0 ) {
+       $link = get_bookmark( $link );
+
+       if ( !current_user_can('manage_links') )
+               return;
+
+       $location = admin_url('link.php?action=edit&amp;link_id=') . $link->link_id;
+       return apply_filters( 'get_edit_bookmark_link', $location, $link->link_id );
+}
+
+/**
+ * Display edit bookmark (literally a URL external to blog) link anchor content.
+ *
+ * @since 2.7.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 $bookmark Optional. Bookmark ID.
+ */
+function edit_bookmark_link( $link = '', $before = '', $after = '', $bookmark = null ) {
+       $bookmark = get_bookmark($bookmark);
+
+       if ( !current_user_can('manage_links') )
+               return;
+
+       if ( empty($link) )
+               $link = __('Edit This');
+
+       $link = '<a href="' . get_edit_bookmark_link( $link ) . '" title="' . __( 'Edit link' ) . '">' . $link . '</a>';
+       echo $before . apply_filters( 'edit_bookmark_link', $link, $bookmark->link_id ) . $after;
+}
+
 // Navigation links
 
 // Navigation links
 
+/**
+ * Retrieve previous post link that is adjacent to current post.
+ *
+ * @since 1.5.0
+ *
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ * @return string
+ */
 function get_previous_post($in_same_cat = false, $excluded_categories = '') {
        return get_adjacent_post($in_same_cat, $excluded_categories);
 }
 
 function get_previous_post($in_same_cat = false, $excluded_categories = '') {
        return get_adjacent_post($in_same_cat, $excluded_categories);
 }
 
+/**
+ * Retrieve next post link that is adjacent to current post.
+ *
+ * @since 1.5.0
+ *
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ * @return string
+ */
 function get_next_post($in_same_cat = false, $excluded_categories = '') {
        return get_adjacent_post($in_same_cat, $excluded_categories, false);
 }
 
 function get_next_post($in_same_cat = false, $excluded_categories = '') {
        return get_adjacent_post($in_same_cat, $excluded_categories, false);
 }
 
+/**
+ * Retrieve adjacent post link.
+ *
+ * Can either be next or previous post link.
+ *
+ * @since 2.5.0
+ *
+ * @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. Whether to retrieve previous post.
+ * @return string
+ */
 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;
 
@@ -554,7 +875,7 @@ function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $pre
 
                if ( $in_same_cat ) {
                        $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
 
                if ( $in_same_cat ) {
                        $cat_array = wp_get_object_terms($post->ID, 'category', 'fields=ids');
-                       $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode($cat_array, ',') . ')';
+                       $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
                }
 
                $posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";
                }
 
                $posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";
@@ -582,14 +903,47 @@ function get_adjacent_post($in_same_cat = false, $excluded_categories = '', $pre
        return $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
 }
 
        return $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
 }
 
+/**
+ * Display previous post link that is adjacent to the current post.
+ *
+ * @since 1.5.0
+ *
+ * @param string $format Optional. Link anchor format.
+ * @param string $link Optional. Link permalink format.
+ * @param bool $in_same_cat Optional. Whether link should be in same category.
+ * @param string $excluded_categories Optional. Excluded categories IDs.
+ */
 function previous_post_link($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
        adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
 }
 
 function previous_post_link($format='&laquo; %link', $link='%title', $in_same_cat = false, $excluded_categories = '') {
        adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, true);
 }
 
+/**
+ * Display next post link that is adjacent to the current post.
+ *
+ * @since 1.5.0
+ *
+ * @param string $format Optional. Link anchor format.
+ * @param string $link Optional. Link permalink 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_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
        adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
 }
 
 function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat = false, $excluded_categories = '') {
        adjacent_post_link($format, $link, $in_same_cat, $excluded_categories, false);
 }
 
+/**
+ * Display adjacent post link.
+ *
+ * Can be either next post link or previous.
+ *
+ * @since 2.5.0
+ *
+ * @param string $format Link anchor format.
+ * @param string $link Link permalink 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.
+ */
 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
        if ( $previous && is_attachment() )
                $post = & get_post($GLOBALS['post']->post_parent);
 function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true) {
        if ( $previous && is_attachment() )
                $post = & get_post($GLOBALS['post']->post_parent);
@@ -605,8 +959,11 @@ function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_cate
                $title = $previous ? __('Previous Post') : __('Next Post');
 
        $title = apply_filters('the_title', $title, $post);
                $title = $previous ? __('Previous Post') : __('Next Post');
 
        $title = apply_filters('the_title', $title, $post);
+       $date = mysql2date(get_option('date_format'), $post->post_date);
+
        $string = '<a href="'.get_permalink($post).'">';
        $link = str_replace('%title', $title, $link);
        $string = '<a href="'.get_permalink($post).'">';
        $link = str_replace('%title', $title, $link);
+       $link = str_replace('%date', $date, $link);
        $link = $string . $link . '</a>';
 
        $format = str_replace('%link', $link, $format);
        $link = $string . $link . '</a>';
 
        $format = str_replace('%link', $link, $format);
@@ -615,6 +972,14 @@ function adjacent_post_link($format, $link, $in_same_cat = false, $excluded_cate
        echo apply_filters( "{$adjacent}_post_link", $format, $link );
 }
 
        echo apply_filters( "{$adjacent}_post_link", $format, $link );
 }
 
+/**
+ * Retrieve get links for page numbers.
+ *
+ * @since 1.5.0
+ *
+ * @param int $pagenum Optional. Page ID.
+ * @return string
+ */
 function get_pagenum_link($pagenum = 1) {
        global $wp_rewrite;
 
 function get_pagenum_link($pagenum = 1) {
        global $wp_rewrite;
 
@@ -669,6 +1034,16 @@ function get_pagenum_link($pagenum = 1) {
        return $result;
 }
 
        return $result;
 }
 
+/**
+ * Retrieve next posts pages link.
+ *
+ * Backported from 2.1.3 to 2.0.10.
+ *
+ * @since 2.0.10
+ *
+ * @param int $max_page Optional. Max pages.
+ * @return string
+ */
 function get_next_posts_page_link($max_page = 0) {
        global $paged;
 
 function get_next_posts_page_link($max_page = 0) {
        global $paged;
 
@@ -681,25 +1056,74 @@ function get_next_posts_page_link($max_page = 0) {
        }
 }
 
        }
 }
 
-function next_posts($max_page = 0) {
-       echo clean_url(get_next_posts_page_link($max_page));
+/**
+ * Display or return the next posts pages link.
+ *
+ * @since 0.71
+ *
+ * @param int $max_page Optional. Max pages.
+ * @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 ) );
+
+       if ( $echo )
+               echo $output;
+       else
+               return $output;
 }
 
 }
 
-function next_posts_link($label='Next Page &raquo;', $max_page=0) {
+/**
+ * Return the next posts pages link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Content for link text.
+ * @param int $max_page Optional. Max pages.
+ * @return string|null
+ */
+function get_next_posts_link( $label = 'Next Page &raquo;', $max_page = 0 ) {
        global $paged, $wp_query;
        global $paged, $wp_query;
+
        if ( !$max_page ) {
                $max_page = $wp_query->max_num_pages;
        }
        if ( !$max_page ) {
                $max_page = $wp_query->max_num_pages;
        }
+
        if ( !$paged )
                $paged = 1;
        if ( !$paged )
                $paged = 1;
+
        $nextpage = intval($paged) + 1;
        $nextpage = intval($paged) + 1;
-       if ( (! is_single()) && (empty($paged) || $nextpage <= $max_page) ) {
-               echo '<a href="';
-               next_posts($max_page);
-               echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+
+       if ( !is_single() && ( empty($paged) || $nextpage <= $max_page) ) {
+               $attr = apply_filters( 'next_posts_link_attributes', '' );
+               return '<a href="' . next_posts( $max_page, false ) . "\" $attr>". preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
        }
 }
 
        }
 }
 
+/**
+ * Display the next posts pages link.
+ *
+ * @since 0.71
+ * @uses get_next_posts_link()
+ *
+ * @param string $label Content for link text.
+ * @param int $max_page Optional. Max pages.
+ */
+function next_posts_link( $label = 'Next Page &raquo;', $max_page = 0 ) {
+       echo get_next_posts_link( $label, $max_page );
+}
+
+/**
+ * Retrieve previous post pages link.
+ *
+ * Will only return string, if not on a single page or post.
+ *
+ * Backported to 2.0.10 from 2.1.3.
+ *
+ * @since 2.0.10
+ *
+ * @return string|null
+ */
 function get_previous_posts_page_link() {
        global $paged;
 
 function get_previous_posts_page_link() {
        global $paged;
 
@@ -711,20 +1135,61 @@ function get_previous_posts_page_link() {
        }
 }
 
        }
 }
 
-function previous_posts() {
-       echo clean_url(get_previous_posts_page_link());
+/**
+ * Display or return the previous posts pages link.
+ *
+ * @since 0.71
+ *
+ * @param boolean $echo Optional. Echo or return;
+ */
+function previous_posts( $echo = true ) {
+       $output = clean_url( get_previous_posts_page_link() );
+
+       if ( $echo )
+               echo $output;
+       else
+               return $output;
 }
 
 }
 
-function previous_posts_link($label='&laquo; Previous Page') {
+/**
+ * Return the previous posts pages link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Optional. Previous page link text.
+ * @return string|null
+ */
+function get_previous_posts_link( $label = '&laquo; Previous Page' ) {
        global $paged;
        global $paged;
-       if ( (!is_single())     && ($paged > 1) ) {
-               echo '<a href="';
-               previous_posts();
-               echo '">'. preg_replace('/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label) .'</a>';
+
+       if ( !is_single() && $paged > 1 ) {
+               $attr = apply_filters( 'previous_posts_link_attributes', '' );
+               return '<a href="' . previous_posts( false ) . "\" $attr>". preg_replace( '/&([^#])(?![a-z]{1,8};)/', '&#038;$1', $label ) .'</a>';
        }
 }
 
        }
 }
 
-function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nxtlabel='Next Page &raquo;') {
+/**
+ * Display the previous posts page link.
+ *
+ * @since 0.71
+ * @uses get_previous_posts_link()
+ *
+ * @param string $label Optional. Previous page link text.
+ */
+function previous_posts_link( $label = '&laquo; Previous Page' ) {
+       echo get_previous_posts_link( $label );
+}
+
+/**
+ * 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 = ' &#8212; ', $prelabel = '&laquo; Previous Page', $nxtlabel = 'Next Page &raquo;' ) {
        global $wp_query;
        if ( !is_singular() ) {
                $max_num_pages = $wp_query->max_num_pages;
        global $wp_query;
        if ( !is_singular() ) {
                $max_num_pages = $wp_query->max_num_pages;
@@ -743,6 +1208,172 @@ function posts_nav_link($sep=' &#8212; ', $prelabel='&laquo; Previous Page', $nx
        }
 }
 
        }
 }
 
+/**
+ * Retrieve page numbers links.
+ *
+ * @since 2.7.0
+ *
+ * @param int $pagenum Optional. Page number.
+ * @return string
+ */
+function get_comments_pagenum_link( $pagenum = 1, $max_page = 0 ) {
+       global $post, $wp_rewrite;
+
+       $pagenum = (int) $pagenum;
+
+       $result = get_permalink( $post->ID );
+
+       if ( 'newest' == get_option('default_comments_page') ) {
+               if ( $pagenum != $max_page ) {
+                       if ( $wp_rewrite->using_permalinks() )
+                               $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
+                       else
+                               $result = add_query_arg( 'cpage', $pagenum, $result );
+               }
+       } elseif ( $pagenum > 1 ) {
+               if ( $wp_rewrite->using_permalinks() )
+                       $result = user_trailingslashit( trailingslashit($result) . 'comment-page-' . $pagenum, 'commentpaged');
+               else
+                       $result = add_query_arg( 'cpage', $pagenum, $result );
+       }
+
+       $result .= '#comments';
+
+       $result = apply_filters('get_comments_pagenum_link', $result);
+
+       return $result;
+}
+
+/**
+ * Return the link to next comments pages.
+ *
+ * @since 2.7.1
+ *
+ * @param string $label Optional. Label for link text.
+ * @param int $max_page Optional. Max page.
+ * @return string|null
+ */
+function get_next_comments_link( $label = '', $max_page = 0 ) {
+       global $wp_query;
+
+       if ( !is_singular() )
+               return;
+
+       $page = get_query_var('cpage');
+
+       $nextpage = intval($page) + 1;
+
+       if ( empty($max_page) )
+               $max_page = $wp_query->max_num_comment_pages;
+
+       if ( empty($max_page) )
+               $max_page = get_comment_pages_count();
+
+       if ( $nextpage > $max_page )
+               return;
+
+       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>';
+}
+
+/**
+ * Display the link to next comments pages.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Optional. Label for link text.
+ * @param int $max_page Optional. Max page.
+ */
+function next_comments_link( $label = '', $max_page = 0 ) {
+       echo get_next_comments_link( $label, $max_page );
+}
+
+/**
+ * Return the previous comments page link.
+ *
+ * @since 2.7.1
+ *
+ * @param string $label Optional. Label for comments link text.
+ * @return string|null
+ */
+function get_previous_comments_link( $label = '' ) {
+       if ( !is_singular() )
+               return;
+
+       $page = get_query_var('cpage');
+
+       if ( intval($page) <= 1 )
+               return;
+
+       $prevpage = intval($page) - 1;
+
+       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>';
+}
+
+/**
+ * Display the previous comments page link.
+ *
+ * @since 2.7.0
+ *
+ * @param string $label Optional. Label for comments link text.
+ */
+function previous_comments_link( $label = '' ) {
+       echo get_previous_comments_link( $label );
+}
+
+/**
+ * Create pagination links for the comments on the current post.
+ *
+ * @see paginate_links()
+ * @since 2.7.0
+ *
+ * @param string|array $args Optional args. See paginate_links.
+ * @return string Markup for pagination links.
+*/
+function paginate_comments_links($args = array()) {
+       global $wp_query, $wp_rewrite;
+
+       if ( !is_singular() )
+               return;
+
+       $page = get_query_var('cpage');
+       if ( !$page )
+               $page = 1;
+       $max_page = get_comment_pages_count();
+       $defaults = array(
+               'base' => add_query_arg( 'cpage', '%#%' ),
+               'format' => '',
+               'total' => $max_page,
+               'current' => $page,
+               'echo' => true,
+               'add_fragment' => '#comments'
+       );
+       if ( $wp_rewrite->using_permalinks() )
+               $defaults['base'] = user_trailingslashit(trailingslashit(get_permalink()) . 'comment-page-%#%', 'commentpaged');
+
+       $args = wp_parse_args( $args, $defaults );
+       $page_links = paginate_links( $args );
+
+       if ( $args['echo'] )
+               echo $page_links;
+       else
+               return $page_links;
+}
+
+/**
+ * Retrieve shortcut link.
+ *
+ * Use this in 'a' element 'href' attribute.
+ *
+ * @since 2.6.0
+ *
+ * @return string
+ */
 function get_shortcut_link() {
        $link = "javascript:
                        var d=document,
 function get_shortcut_link() {
        $link = "javascript:
                        var d=document,
@@ -756,7 +1387,7 @@ function get_shortcut_link() {
                        e=encodeURIComponent,
                        g=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=2';
                        function a(){
                        e=encodeURIComponent,
                        g=f+'?u='+e(l.href)+'&t='+e(d.title)+'&s='+e(s)+'&v=2';
                        function a(){
-                               if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=700,height=500')){
+                               if(!w.open(g,'t','toolbar=0,resizable=0,scrollbars=1,status=1,width=720,height=570')){
                                        l.href=g;
                                }
                        }";
                                        l.href=g;
                                }
                        }";
@@ -772,21 +1403,23 @@ function get_shortcut_link() {
        return apply_filters('shortcut_link', $link);
 }
 
        return apply_filters('shortcut_link', $link);
 }
 
-/** Return the site url
+/**
+ * Retrieve the site url.
  *
  *
+ * Returns the 'site_url' option with the appropriate protocol,  'https' if
+ * is_ssl() and 'http' otherwise. If $scheme is 'http' or 'https', is_ssl() is
+ * overridden.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.6
- *
- * Returns the 'site_url' option with the appropriate protocol,  'https' if is_ssl() and 'http' otherwise. 
- * If $scheme is 'http' or 'https', is_ssl() is overridden.
+ * @since 2.6.0
  *
  *
- * @param string $path Optional path relative to the site url
- * @param string $scheme Optional scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'
- * @return string Site url link with optional path appended
+ * @param string $path Optional. Path relative to the site url.
+ * @param string $scheme Optional. Scheme to give the site url context. Currently 'http','https', 'login', 'login_post', or 'admin'.
+ * @return string Site url link with optional path appended.
 */
 function site_url($path = '', $scheme = null) {
        // should the list of allowed schemes be maintained elsewhere?
 */
 function site_url($path = '', $scheme = null) {
        // should the list of allowed schemes be maintained elsewhere?
+       $orig_scheme = $scheme;
        if ( !in_array($scheme, array('http', 'https')) ) {
                if ( ('login_post' == $scheme) && ( force_ssl_login() || force_ssl_admin() ) )
                        $scheme = 'https';
        if ( !in_array($scheme, array('http', 'https')) ) {
                if ( ('login_post' == $scheme) && ( force_ssl_login() || force_ssl_admin() ) )
                        $scheme = 'https';
@@ -803,16 +1436,14 @@ function site_url($path = '', $scheme = null) {
        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('site_url', $url, $path, $orig_scheme);
 }
 
 }
 
-/** Return the admin url
- *
+/**
+ * Retrieve the url to the admin area.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.6
- *
- * Returns the url to the admin area
+ * @since 2.6.0
  *
  * @param string $path Optional path relative to the admin url
  * @return string Admin url link with optional path appended
  *
  * @param string $path Optional path relative to the admin url
  * @return string Admin url link with optional path appended
@@ -826,16 +1457,14 @@ function admin_url($path = '') {
        return $url;
 }
 
        return $url;
 }
 
-/** Return the includes url
- *
+/**
+ * Retrieve the url to the includes directory.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.6
+ * @since 2.6.0
  *
  *
- * Returns the url to the includes directory
- *
- * @param string $path Optional path relative to the includes url
- * @return string Includes url link with optional path appended
+ * @param string $path Optional. Path relative to the includes url.
+ * @return string Includes url link with optional path appended.
 */
 function includes_url($path = '') {
        $url = site_url() . '/' . WPINC . '/';
 */
 function includes_url($path = '') {
        $url = site_url() . '/' . WPINC . '/';
@@ -846,16 +1475,14 @@ function includes_url($path = '') {
        return $url;
 }
 
        return $url;
 }
 
-/** Return the content url
- *
+/**
+ * Retrieve the url to the content directory.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.6
- *
- * Returns the url to the content directory
+ * @since 2.6.0
  *
  *
- * @param string $path Optional path relative to the content url
- * @return string Content url link with optional path appended
+ * @param string $path Optional. Path relative to the content url.
+ * @return string Content url link with optional path appended.
 */
 function content_url($path = '') {
        $scheme = ( is_ssl() ? 'https' : 'http' );
 */
 function content_url($path = '') {
        $scheme = ( is_ssl() ? 'https' : 'http' );
@@ -871,16 +1498,14 @@ function content_url($path = '') {
        return $url;
 }
 
        return $url;
 }
 
-/** Return the plugins url
- *
+/**
+ * Retrieve the url to the plugins directory.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.6
- *
- * Returns the url to the plugins directory
+ * @since 2.6.0
  *
  *
- * @param string $path Optional path relative to the plugins url
- * @return string Plugins url link with optional path appended
+ * @param string $path Optional. Path relative to the plugins url.
+ * @return string Plugins url link with optional path appended.
 */
 function plugins_url($path = '') {
        $scheme = ( is_ssl() ? 'https' : 'http' );
 */
 function plugins_url($path = '') {
        $scheme = ( is_ssl() ? 'https' : 'http' );
index 5f24c543571421263d8963bdaf5faa0b333fe4a8..135c6bf7284777601f958d00abbcf04214847f95 100644 (file)
@@ -7,9 +7,7 @@
  */
 
 /**
  */
 
 /**
- * {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
+ * Class that loads the calendar locale.
  *
  * @since 2.1.0
  */
  *
  * @since 2.1.0
  */
@@ -190,7 +188,7 @@ class WP_Locale {
                $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.
-               foreach ( $this->locale_vars as $var ) {
+               foreach ( (array) $this->locale_vars as $var ) {
                        if ( isset($GLOBALS[$var]) )
                                $this->$var = $GLOBALS[$var];
                }
                        if ( isset($GLOBALS[$var]) )
                                $this->$var = $GLOBALS[$var];
                }
index 36ca5958a36caa88b2f082cd9abbf124d4c6d155..58feaf3ab1ef2868f9f88e91a13a6d4410edb52e 100644 (file)
@@ -1,9 +1,38 @@
 <?php
 <?php
+/**
+ * WordPress API for media display.
+ *
+ * @package WordPress
+ */
 
 
-// functions for media display
-
-// scale down the default size of an image so it's a better fit for the editor and theme
+/**
+ * Scale down the default size of an image.
+ *
+ * This is so that the image is a better fit for the editor and theme.
+ *
+ * The $size parameter accepts either an array or a string. The supported string
+ * values are 'thumb' or 'thumbnail' for the given thumbnail size or defaults at
+ * 128 width and 96 height in pixels. Also supported for the string value is
+ * 'medium' and 'full'. The 'full' isn't actually supported, but any value other
+ * than the supported will result in the content_width size or 500 if that is
+ * not set.
+ *
+ * Finally, there is a filter named, 'editor_max_image_size' that will be called
+ * on the calculated array for width and height, respectively. The second
+ * parameter will be the value that was in the $size parameter. The returned
+ * type for the hook is an array with the width as the first element and the
+ * height as the second element.
+ *
+ * @since 2.5.0
+ * @uses wp_constrain_dimensions() This function passes the widths and the heights.
+ *
+ * @param int $width Width of the image
+ * @param int $height Height of the image
+ * @param string|array $size Size of what the result image should be.
+ * @return array Width and height of what the result image should resize to.
+ */
 function image_constrain_size_for_editor($width, $height, $size = 'medium') {
 function image_constrain_size_for_editor($width, $height, $size = 'medium') {
+       global $content_width;
 
        if ( is_array($size) ) {
                $max_width = $size[0];
 
        if ( is_array($size) ) {
                $max_width = $size[0];
@@ -23,15 +52,20 @@ function image_constrain_size_for_editor($width, $height, $size = 'medium') {
                $max_height = intval(get_option('medium_size_h'));
                // if no width is set, default to the theme content width if available
        }
                $max_height = intval(get_option('medium_size_h'));
                // if no width is set, default to the theme content width if available
        }
-       else { // $size == 'full'
-               // we're inserting a full size image into the editor.  if it's a really big image we'll scale it down to fit reasonably
-               // within the editor itself, and within the theme's content width if it's known.  the user can resize it in the editor
-               // if they wish.
-               if ( !empty($GLOBALS['content_width']) ) {
-                       $max_width = $GLOBALS['content_width'];
-               }
-               else
-                       $max_width = 500;
+       elseif ( $size == 'large' ) {
+               // we're inserting a large size image into the editor.  if it's a really
+               // big image we'll scale it down to fit reasonably within the editor
+               // itself, and within the theme's content width if it's known.  the user
+               // can resize it in the editor if they wish.
+               $max_width = intval(get_option('large_size_w'));
+               $max_height = intval(get_option('large_size_h'));
+               if ( intval($content_width) > 0 )
+                       $max_width = min( intval($content_width), $max_width );
+       }
+       // $size == 'full' has no constraint
+       else {
+               $max_width = $width;
+               $max_height = $height;
        }
 
        list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size );
        }
 
        list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size );
@@ -39,7 +73,23 @@ function image_constrain_size_for_editor($width, $height, $size = 'medium') {
        return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
 }
 
        return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
 }
 
-// return a width/height string for use in an <img /> tag.  Empty values will be omitted.
+/**
+ * Retrieve width and height attributes using given width and height values.
+ *
+ * Both attributes are required in the sense that both parameters must have a
+ * value, but are optional in that if you set them to false or null, then they
+ * will not be added to the returned string.
+ *
+ * You can set the value using a string, but it will only take numeric values.
+ * If you wish to put 'px' after the numbers, then it will be stripped out of
+ * the return.
+ *
+ * @since 2.5.0
+ *
+ * @param int|string $width Optional. Width attribute value.
+ * @param int|string $height Optional. Height attribute value.
+ * @return string HTML attributes for width and, or height.
+ */
 function image_hwstring($width, $height) {
        $out = '';
        if ($width)
 function image_hwstring($width, $height) {
        $out = '';
        if ($width)
@@ -49,9 +99,30 @@ function image_hwstring($width, $height) {
        return $out;
 }
 
        return $out;
 }
 
-// Scale an image to fit a particular size (such as 'thumb' or 'medium'), and return an image URL, height and width.
-// The URL might be the original image, or it might be a resized version.  This function won't create a new resized copy, it will just return an already resized one if it exists.
-// returns an array($url, $width, $height)
+/**
+ * Scale an image to fit a particular size (such as 'thumb' or 'medium').
+ *
+ * Array with image url, width, height, and whether is intermediate size, in
+ * that order is returned on success is returned. $is_intermediate is true if
+ * $url is a resized image, false if it is the original.
+ *
+ * The URL might be the original image, or it might be a resized version. This
+ * function won't create a new resized copy, it will just return an already
+ * resized one if it exists.
+ *
+ * A plugin may use the 'image_downsize' filter to hook into and offer image
+ * resizing services for images. The hook must return an array with the same
+ * elements that are returned in the function. The first element being the URL
+ * to the new image that was resized.
+ *
+ * @since 2.5.0
+ * @uses apply_filters() Calls 'image_downsize' on $id and $size to provide
+ *             resize services.
+ *
+ * @param int $id Attachment ID for image.
+ * @param string $size Optional, default is 'medium'. Size of image, can be 'thumbnail'.
+ * @return bool|array False on failure, array on success.
+ */
 function image_downsize($id, $size = 'medium') {
 
        if ( !wp_attachment_is_image($id) )
 function image_downsize($id, $size = 'medium') {
 
        if ( !wp_attachment_is_image($id) )
@@ -60,6 +131,7 @@ function image_downsize($id, $size = 'medium') {
        $img_url = wp_get_attachment_url($id);
        $meta = wp_get_attachment_metadata($id);
        $width = $height = 0;
        $img_url = wp_get_attachment_url($id);
        $meta = wp_get_attachment_metadata($id);
        $width = $height = 0;
+       $is_intermediate = false;
 
        // plugins can use this to provide resize services
        if ( $out = apply_filters('image_downsize', false, $id, $size) )
 
        // plugins can use this to provide resize services
        if ( $out = apply_filters('image_downsize', false, $id, $size) )
@@ -70,6 +142,7 @@ function image_downsize($id, $size = 'medium') {
                $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
                $width = $intermediate['width'];
                $height = $intermediate['height'];
                $img_url = str_replace(basename($img_url), $intermediate['file'], $img_url);
                $width = $intermediate['width'];
                $height = $intermediate['height'];
+               $is_intermediate = true;
        }
        elseif ( $size == 'thumbnail' ) {
                // fall back to the old thumbnail
        }
        elseif ( $size == 'thumbnail' ) {
                // fall back to the old thumbnail
@@ -77,15 +150,21 @@ function image_downsize($id, $size = 'medium') {
                        $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
                        $width = $info[0];
                        $height = $info[1];
                        $img_url = str_replace(basename($img_url), basename($thumb_file), $img_url);
                        $width = $info[0];
                        $height = $info[1];
+                       $is_intermediate = true;
                }
        }
        if ( !$width && !$height && isset($meta['width'], $meta['height']) ) {
                }
        }
        if ( !$width && !$height && isset($meta['width'], $meta['height']) ) {
-               // any other type: use the real image and constrain it
-               list( $width, $height ) = image_constrain_size_for_editor( $meta['width'], $meta['height'], $size );
+               // any other type: use the real image
+               $width = $meta['width'];
+               $height = $meta['height'];
        }
 
        }
 
-       if ( $img_url)
-               return array( $img_url, $width, $height );
+       if ( $img_url) {
+               // we have the actual image size, but might need to further constrain it if content_width is narrower
+               list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size );
+
+               return array( $img_url, $width, $height, $is_intermediate );
+       }
        return false;
 
 }
        return false;
 
 }
@@ -93,7 +172,16 @@ function image_downsize($id, $size = 'medium') {
 /**
  * An <img src /> tag for an image attachment, scaling it down if requested.
  *
 /**
  * An <img src /> tag for an image attachment, scaling it down if requested.
  *
- * {@internal Missing Long Description}}
+ * The filter 'get_image_tag_class' allows for changing the class name for the
+ * image without having to use regular expressions on the HTML content. The
+ * parameters are: what WordPress will use for the class, the Attachment ID,
+ * image align value, and the size the image should be.
+ *
+ * The second filter 'get_image_tag' has the HTML content, which can then be
+ * further manipulated by a plugin to change all attribute values and even HTML
+ * content.
+ *
+ * @since 2.5.0
  *
  * @uses apply_filters() The 'get_image_tag_class' filter is the IMG element
  *             class attribute.
  *
  * @uses apply_filters() The 'get_image_tag_class' filter is the IMG element
  *             class attribute.
@@ -122,8 +210,21 @@ function get_image_tag($id, $alt, $title, $align, $size='medium') {
        return $html;
 }
 
        return $html;
 }
 
-// same as wp_shrink_dimensions, except the max parameters are optional.
-// if either width or height are empty, no constraint is applied on that dimension.
+/**
+ * Calculates the new dimentions for a downsampled image.
+ *
+ * Same as {@link wp_shrink_dimensions()}, except the max parameters are
+ * optional. If either width or height are empty, no constraint is applied on
+ * that dimension.
+ *
+ * @since 2.5.0
+ *
+ * @param int $current_width Current width of the image.
+ * @param int $current_height Current height of the image.
+ * @param int $max_width Optional. Maximum wanted width.
+ * @param int $max_height Optional. Maximum wanted height.
+ * @return array First item is the width, the second item is the height.
+ */
 function wp_constrain_dimensions( $current_width, $current_height, $max_width=0, $max_height=0 ) {
        if ( !$max_width and !$max_height )
                return array( $current_width, $current_height );
 function wp_constrain_dimensions( $current_width, $current_height, $max_width=0, $max_height=0 ) {
        if ( !$max_width and !$max_height )
                return array( $current_width, $current_height );
@@ -142,8 +243,22 @@ function wp_constrain_dimensions( $current_width, $current_height, $max_width=0,
        return array( intval($current_width * $ratio), intval($current_height * $ratio) );
 }
 
        return array( intval($current_width * $ratio), intval($current_height * $ratio) );
 }
 
-// calculate dimensions and coordinates for a resized image that fits within a specified width and height
-// if $crop is true, the largest matching central portion of the image will be cropped out and resized to the required size
+/**
+ * Retrieve calculated resized dimensions for use in imagecopyresampled().
+ *
+ * Calculate dimensions and coordinates for a resized image that fits within a
+ * specified width and height. If $crop is true, the largest matching central
+ * portion of the image will be cropped out and resized to the required size.
+ *
+ * @since 2.5.0
+ *
+ * @param int $orig_w Original width.
+ * @param int $orig_h Original height.
+ * @param int $dest_w New width.
+ * @param int $dest_h New height.
+ * @param bool $crop Optional, default is false. Whether to crop image or resize.
+ * @return bool|array False, on failure. Returned array matches parameters for imagecopyresampled() PHP function.
+ */
 function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop=false) {
 
        if ($orig_w <= 0 || $orig_h <= 0)
 function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop=false) {
 
        if ($orig_w <= 0 || $orig_h <= 0)
@@ -193,7 +308,28 @@ function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop=false
 
 }
 
 
 }
 
-// Scale down an image to fit a particular size and save a new copy of the image
+/**
+ * Scale down an image to fit a particular size and save a new copy of the image.
+ *
+ * The PNG transparency will be preserved using the function, as well as the
+ * image type. If the file going in is PNG, then the resized image is going to
+ * be PNG. The only supported image types are PNG, GIF, and JPEG.
+ *
+ * Some functionality requires API to exist, so some PHP version may lose out
+ * support. This is not the fault of WordPress (where functionality is
+ * downgraded, not actual defects), but of your PHP version.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file Image file path.
+ * @param int $max_w Maximum width to resize to.
+ * @param int $max_h Maximum height to resize to.
+ * @param bool $crop Optional. Whether to crop image or resize.
+ * @param string $suffix Optional. File Suffix.
+ * @param string $dest_path Optional. New image file path.
+ * @param int $jpeg_quality Optional, default is 90. Image quality percentage.
+ * @return mixed WP_Error on failure. String with new destination path. Array of dimensions from {@link image_resize_dimensions()}
+ */
 function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=90) {
 
        $image = wp_load_image( $file );
 function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_path=null, $jpeg_quality=90) {
 
        $image = wp_load_image( $file );
@@ -256,8 +392,21 @@ function image_resize( $file, $max_w, $max_h, $crop=false, $suffix=null, $dest_p
        return $destfilename;
 }
 
        return $destfilename;
 }
 
-// resize an image to make a thumbnail or intermediate size, and return metadata describing the new copy
-// returns false if no image was created
+/**
+ * Resize an image to make a thumbnail or intermediate size.
+ *
+ * The returned array has the file size, the image width, and image height. The
+ * filter 'image_make_intermediate_size' can be used to hook in and change the
+ * values of the returned array. The only parameter is the resized file path.
+ *
+ * @since 2.5.0
+ *
+ * @param string $file File path.
+ * @param int $width Image width.
+ * @param int $height Image height.
+ * @param bool $crop Optional, default is false. Whether to crop image to specified height and width or resize.
+ * @return bool|array False, if no image was created. Metadata array on success.
+ */
 function image_make_intermediate_size($file, $width, $height, $crop=false) {
        if ( $width || $height ) {
                $resized_file = image_resize($file, $width, $height, $crop);
 function image_make_intermediate_size($file, $width, $height, $crop=false) {
        if ( $width || $height ) {
                $resized_file = image_resize($file, $width, $height, $crop);
@@ -273,6 +422,26 @@ function image_make_intermediate_size($file, $width, $height, $crop=false) {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Retrieve the image's intermediate size (resized) path, width, and height.
+ *
+ * The $size parameter can be an array with the width and height respectively.
+ * If the size matches the 'sizes' metadata array for width and height, then it
+ * will be used. If there is no direct match, then the nearest image size larger
+ * than the specified size will be used. If nothing is found, then the function
+ * will break out and return false.
+ *
+ * The metadata 'sizes' is used for compatible sizes that can be used for the
+ * parameter $size value.
+ *
+ * The url path will be given, when the $size parameter is a string.
+ *
+ * @since 2.5.0
+ *
+ * @param int $post_id Attachment ID for image.
+ * @param array|string $size Optional, default is 'thumbnail'. Size of image, either array or string.
+ * @return bool|array False on failure or array of file path, width, and height on success.
+ */
 function image_get_intermediate_size($post_id, $size='thumbnail') {
        if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) )
                return false;
 function image_get_intermediate_size($post_id, $size='thumbnail') {
        if ( !is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) )
                return false;
@@ -305,7 +474,7 @@ function image_get_intermediate_size($post_id, $size='thumbnail') {
 
        if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) )
                return false;
 
        if ( is_array($size) || empty($size) || empty($imagedata['sizes'][$size]) )
                return false;
-               
+
        $data = $imagedata['sizes'][$size];
        // include the full filesystem path of the intermediate file
        if ( empty($data['path']) && !empty($data['file']) ) {
        $data = $imagedata['sizes'][$size];
        // include the full filesystem path of the intermediate file
        if ( empty($data['path']) && !empty($data['file']) ) {
@@ -316,16 +485,26 @@ function image_get_intermediate_size($post_id, $size='thumbnail') {
        return $data;
 }
 
        return $data;
 }
 
-// get an image to represent an attachment - a mime icon for files, thumbnail or intermediate size for images
-// returns an array (url, width, height), or false if no image is available
+/**
+ * Retrieve an image to represent an attachment.
+ *
+ * A mime icon for files, thumbnail or intermediate size for images.
+ *
+ * @since 2.5.0
+ *
+ * @param int $attachment_id Image attachment ID.
+ * @param string $size Optional, default is 'thumbnail'.
+ * @param bool $icon Optional, default is false. Whether it is an icon.
+ * @return bool|array Returns an array (url, width, height), or false, if no image is available.
+ */
 function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) {
 function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon = false) {
-       
+
        // get a thumbnail or intermediate image if there is one
        if ( $image = image_downsize($attachment_id, $size) )
                return $image;
 
        if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
        // get a thumbnail or intermediate image if there is one
        if ( $image = image_downsize($attachment_id, $size) )
                return $image;
 
        if ( $icon && $src = wp_mime_type_icon($attachment_id) ) {
-               $icon_dir = apply_filters( 'icon_dir', includes_url('images/crystal') );
+               $icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/crystal' );
                $src_file = $icon_dir . '/' . basename($src);
                @list($width, $height) = getimagesize($src_file);
        }
                $src_file = $icon_dir . '/' . basename($src);
                @list($width, $height) = getimagesize($src_file);
        }
@@ -334,8 +513,18 @@ function wp_get_attachment_image_src($attachment_id, $size='thumbnail', $icon =
        return false;
 }
 
        return false;
 }
 
-// as per wp_get_attachment_image_src, but returns an <img> tag
-function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = false) {
+/**
+ * Retrieve img HTML content for an image to represent an attachment.
+ *
+ * @see wp_get_attachment_image_src() Returns img HTML element based on array.
+ * @since 2.5.0
+ *
+ * @param int $attachment_id Image attachment ID.
+ * @param string $size Optional, default is 'thumbnail'.
+ * @param bool $icon Optional, default is false. Whether it is an icon.
+ * @return string HTML img element or empty string on failure.
+ */
+function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false) {
 
        $html = '';
        $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
 
        $html = '';
        $image = wp_get_attachment_image_src($attachment_id, $size, $icon);
@@ -346,13 +535,29 @@ function wp_get_attachment_image($attachment_id, $size='thumbnail', $icon = fals
                        $size = join('x', $size);
                $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="" />';
        }
                        $size = join('x', $size);
                $html = '<img src="'.attribute_escape($src).'" '.$hwstring.'class="attachment-'.attribute_escape($size).'" alt="" />';
        }
-       
+
        return $html;
 }
 
 add_shortcode('wp_caption', 'img_caption_shortcode');
 add_shortcode('caption', 'img_caption_shortcode');
 
        return $html;
 }
 
 add_shortcode('wp_caption', 'img_caption_shortcode');
 add_shortcode('caption', 'img_caption_shortcode');
 
+/**
+ * The Caption shortcode.
+ *
+ * Allows a plugin to replace the content that would otherwise be returned. The
+ * filter is 'img_caption_shortcode' and passes an empty string, the attr
+ * parameter and the content parameter values.
+ *
+ * The supported attributes for the shortcode are 'id', 'align', 'width', and
+ * 'caption'.
+ *
+ * @since 2.6.0
+ *
+ * @param array $attr Attributes attributed to the shortcode.
+ * @param string $content Optional. Shortcode content.
+ * @return string
+ */
 function img_caption_shortcode($attr, $content = null) {
 
        // Allow plugins/themes to override the default caption template.
 function img_caption_shortcode($attr, $content = null) {
 
        // Allow plugins/themes to override the default caption template.
@@ -366,18 +571,29 @@ function img_caption_shortcode($attr, $content = null) {
                'width' => '',
                'caption' => ''
        ), $attr));
                'width' => '',
                'caption' => ''
        ), $attr));
-       
+
        if ( 1 > (int) $width || empty($caption) )
                return $content;
        if ( 1 > (int) $width || empty($caption) )
                return $content;
-       
+
        if ( $id ) $id = 'id="' . $id . '" ';
        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>';
 }
 
 add_shortcode('gallery', 'gallery_shortcode');
 
        return '<div ' . $id . 'class="wp-caption ' . $align . '" style="width: ' . (10 + (int) $width) . 'px">'
        . $content . '<p class="wp-caption-text">' . $caption . '</p></div>';
 }
 
 add_shortcode('gallery', 'gallery_shortcode');
 
+/**
+ * The Gallery shortcode.
+ *
+ * This implements the functionality of the Gallery Shortcode for displaying
+ * WordPress images on a post.
+ *
+ * @since 2.5.0
+ *
+ * @param array $attr Attributes attributed to the shortcode.
+ * @return string HTML content to display gallery.
+ */
 function gallery_shortcode($attr) {
        global $post;
 
 function gallery_shortcode($attr) {
        global $post;
 
@@ -401,7 +617,7 @@ function gallery_shortcode($attr) {
                'icontag'    => 'dt',
                'captiontag' => 'dd',
                'columns'    => 3,
                'icontag'    => 'dt',
                'captiontag' => 'dd',
                'columns'    => 3,
-               'size'       => 'thumbnail',
+               'size'       => 'thumbnail'
        ), $attr));
 
        $id = intval($id);
        ), $attr));
 
        $id = intval($id);
@@ -417,12 +633,11 @@ function gallery_shortcode($attr) {
                return $output;
        }
 
                return $output;
        }
 
-       $listtag = tag_escape($listtag);
        $itemtag = tag_escape($itemtag);
        $captiontag = tag_escape($captiontag);
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
        $itemtag = tag_escape($itemtag);
        $captiontag = tag_escape($captiontag);
        $columns = intval($columns);
        $itemwidth = $columns > 0 ? floor(100/$columns) : 100;
-       
+
        $output = apply_filters('gallery_style', "
                <style type='text/css'>
                        .gallery {
        $output = apply_filters('gallery_style', "
                <style type='text/css'>
                        .gallery {
@@ -443,8 +658,10 @@ function gallery_shortcode($attr) {
                <!-- see gallery_shortcode() in wp-includes/media.php -->
                <div class='gallery'>");
 
                <!-- see gallery_shortcode() in wp-includes/media.php -->
                <div class='gallery'>");
 
+       $i = 0;
        foreach ( $attachments as $id => $attachment ) {
        foreach ( $attachments as $id => $attachment ) {
-               $link = wp_get_attachment_link($id, $size, true);
+               $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
+
                $output .= "<{$itemtag} class='gallery-item'>";
                $output .= "
                        <{$icontag} class='gallery-icon'>
                $output .= "<{$itemtag} class='gallery-item'>";
                $output .= "
                        <{$icontag} class='gallery-icon'>
@@ -468,14 +685,33 @@ function gallery_shortcode($attr) {
        return $output;
 }
 
        return $output;
 }
 
+/**
+ * Display previous image link that has the same post parent.
+ *
+ * @since 2.5.0
+ */
 function previous_image_link() {
        adjacent_image_link(true);
 }
 
 function previous_image_link() {
        adjacent_image_link(true);
 }
 
+/**
+ * Display next image link that has the same post parent.
+ *
+ * @since 2.5.0
+ */
 function next_image_link() {
        adjacent_image_link(false);
 }
 
 function next_image_link() {
        adjacent_image_link(false);
 }
 
+/**
+ * Display next or previous image link that has the same post parent.
+ *
+ * Retrieves the current attachment object from the $post global.
+ *
+ * @since 2.5.0
+ *
+ * @param bool $prev Optional. Default is true to display previous link, true for next.
+ */
 function adjacent_image_link($prev = true) {
        global $post;
        $post = get_post($post);
 function adjacent_image_link($prev = true) {
        global $post;
        $post = get_post($post);
@@ -491,6 +727,14 @@ function adjacent_image_link($prev = true) {
                echo wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true);
 }
 
                echo wp_get_attachment_link($attachments[$k]->ID, 'thumbnail', true);
 }
 
+/**
+ * Retrieve taxonomies attached to the attachment.
+ *
+ * @since 2.5.0
+ *
+ * @param int|array|object $attachment Attachment ID, Attachment data array, or Attachment data object.
+ * @return array Empty array on failure. List of taxonomies on success.
+ */
 function get_attachment_taxonomies($attachment) {
        if ( is_int( $attachment ) )
                $attachment = get_post($attachment);
 function get_attachment_taxonomies($attachment) {
        if ( is_int( $attachment ) )
                $attachment = get_post($attachment);
index e7ca2a7321c4dc3f7f9563100cde65b0e31251aa..7e3f4f13143ae19d2561d1c66c21b35b62bdd4d2 100644 (file)
@@ -253,11 +253,15 @@ if ( !function_exists( 'wp_mail' ) ) :
  * @param string $subject Email subject
  * @param string $message Message contents
  * @param string|array $headers Optional. Additional headers.
  * @param string $subject Email subject
  * @param string $message Message contents
  * @param string|array $headers Optional. Additional headers.
+ * @param string|array $attachments Optional. Files to attach.
  * @return bool Whether the email contents were sent successfully.
  */
  * @return bool Whether the email contents were sent successfully.
  */
-function wp_mail( $to, $subject, $message, $headers = '' ) {
+function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
        // Compact the input, apply the filters, and extract them back out
        // Compact the input, apply the filters, and extract them back out
-       extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers' ) ) );
+       extract( apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) ) );
+
+       if ( !is_array($attachments) )
+               $attachments = explode( "\n", $attachments );
 
        global $phpmailer;
 
 
        global $phpmailer;
 
@@ -280,7 +284,7 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
                // If it's actually got contents
                if ( !empty( $tempheaders ) ) {
                        // Iterate through the raw headers
                // If it's actually got contents
                if ( !empty( $tempheaders ) ) {
                        // Iterate through the raw headers
-                       foreach ( $tempheaders as $header ) {
+                       foreach ( (array) $tempheaders as $header ) {
                                if ( strpos($header, ':') === false )
                                        continue;
                                // Explode them out
                                if ( strpos($header, ':') === false )
                                        continue;
                                // Explode them out
@@ -363,12 +367,12 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
 
        // Add any CC and BCC recipients
        if ( !empty($cc) ) {
 
        // Add any CC and BCC recipients
        if ( !empty($cc) ) {
-               foreach ($cc as $recipient) {
+               foreach ( (array) $cc as $recipient ) {
                        $phpmailer->AddCc( trim($recipient) );
                }
        }
        if ( !empty($bcc) ) {
                        $phpmailer->AddCc( trim($recipient) );
                }
        }
        if ( !empty($bcc) ) {
-               foreach ($bcc as $recipient) {
+               foreach ( (array) $bcc as $recipient) {
                        $phpmailer->AddBcc( trim($recipient) );
                }
        }
                        $phpmailer->AddBcc( trim($recipient) );
                }
        }
@@ -401,11 +405,17 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
 
        // Set custom headers
        if ( !empty( $headers ) ) {
 
        // Set custom headers
        if ( !empty( $headers ) ) {
-               foreach ( $headers as $name => $content ) {
+               foreach( (array) $headers as $name => $content ) {
                        $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
                }
        }
 
                        $phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
                }
        }
 
+       if ( !empty( $attachments ) ) {
+               foreach ( $attachments as $attachment ) {
+                       $phpmailer->AddAttachment($attachment);
+               }
+       }
+
        do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
 
        // Send!
        do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
 
        // Send!
@@ -415,16 +425,16 @@ function wp_mail( $to, $subject, $message, $headers = '' ) {
 }
 endif;
 
 }
 endif;
 
+if ( !function_exists('wp_authenticate') ) :
 /**
  * Checks a user's login information and logs them in if it checks out.
  *
 /**
  * Checks a user's login information and logs them in if it checks out.
  *
- * @since 2.5
+ * @since 2.5.0
  *
  * @param string $username User's username
  * @param string $password User's password
  * @return WP_Error|WP_User WP_User object if login successful, otherwise WP_Error object.
  */
  *
  * @param string $username User's username
  * @param string $password User's password
  * @return WP_Error|WP_User WP_User object if login successful, otherwise WP_Error object.
  */
-if ( !function_exists('wp_authenticate') ) :
 function wp_authenticate($username, $password) {
        $username = sanitize_user($username);
 
 function wp_authenticate($username, $password) {
        $username = sanitize_user($username);
 
@@ -456,12 +466,12 @@ function wp_authenticate($username, $password) {
 }
 endif;
 
 }
 endif;
 
+if ( !function_exists('wp_logout') ) :
 /**
  * Log the current user out.
  *
 /**
  * Log the current user out.
  *
- * @since 2.5
+ * @since 2.5.0
  */
  */
-if ( !function_exists('wp_logout') ) :
 function wp_logout() {
        wp_clear_auth_cookie();
        do_action('wp_logout');
 function wp_logout() {
        wp_clear_auth_cookie();
        do_action('wp_logout');
@@ -484,26 +494,13 @@ if ( !function_exists('wp_validate_auth_cookie') ) :
  * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
  * @return bool|int False if invalid cookie, User ID if valid.
  */
  * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
  * @return bool|int False if invalid cookie, User ID if valid.
  */
-function wp_validate_auth_cookie($cookie = '', $scheme = 'auth') {
-       if ( empty($cookie) ) {
-               if ( is_ssl() ) {
-                       $cookie_name = SECURE_AUTH_COOKIE;
-                       $scheme = 'secure_auth';
-               } else {
-                       $cookie_name = AUTH_COOKIE;
-                       $scheme = 'auth';
-               }
-
-               if ( empty($_COOKIE[$cookie_name]) )
-                       return false;
-               $cookie = $_COOKIE[$cookie_name];
-       }
-
-       $cookie_elements = explode('|', $cookie);
-       if ( count($cookie_elements) != 3 )
+function wp_validate_auth_cookie($cookie = '', $scheme = '') {
+       if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) {
+               do_action('auth_cookie_malformed', $cookie, $scheme);
                return false;
                return false;
+       }
 
 
-       list($username, $expiration, $hmac) = $cookie_elements;
+       extract($cookie_elements, EXTR_OVERWRITE);
 
        $expired = $expiration;
 
 
        $expired = $expiration;
 
@@ -512,18 +509,26 @@ function wp_validate_auth_cookie($cookie = '', $scheme = 'auth') {
                $expired += 3600;
 
        // Quick check to see if an honest cookie has expired
                $expired += 3600;
 
        // Quick check to see if an honest cookie has expired
-       if ( $expired < time() )
+       if ( $expired < time() ) {
+               do_action('auth_cookie_expired', $cookie_elements);
                return false;
                return false;
+       }
 
        $key = wp_hash($username . '|' . $expiration, $scheme);
        $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
 
 
        $key = wp_hash($username . '|' . $expiration, $scheme);
        $hash = hash_hmac('md5', $username . '|' . $expiration, $key);
 
-       if ( $hmac != $hash )
+       if ( $hmac != $hash ) {
+               do_action('auth_cookie_bad_hash', $cookie_elements);
                return false;
                return false;
+       }
 
        $user = get_userdatabylogin($username);
 
        $user = get_userdatabylogin($username);
-       if ( ! $user )
+       if ( ! $user ) {
+               do_action('auth_cookie_bad_username', $cookie_elements);
                return false;
                return false;
+       }
+
+       do_action('auth_cookie_valid', $cookie_elements, $user);
 
        return $user->ID;
 }
 
        return $user->ID;
 }
@@ -554,6 +559,53 @@ function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth') {
 }
 endif;
 
 }
 endif;
 
+if ( !function_exists('wp_parse_auth_cookie') ) :
+/**
+ * Parse a cookie into its components
+ *
+ * @since 2.7
+ *
+ * @param string $cookie
+ * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
+ * @return array Authentication cookie components
+ */
+function wp_parse_auth_cookie($cookie = '', $scheme = '') {
+       if ( empty($cookie) ) {
+               switch ($scheme){
+                       case 'auth':
+                               $cookie_name = AUTH_COOKIE;
+                               break;
+                       case 'secure_auth':
+                               $cookie_name = SECURE_AUTH_COOKIE;
+                               break;
+                       case "logged_in":
+                               $cookie_name = LOGGED_IN_COOKIE;
+                               break;
+                       default:
+                               if ( is_ssl() ) {
+                                       $cookie_name = SECURE_AUTH_COOKIE;
+                                       $scheme = 'secure_auth';
+                               } else {
+                                       $cookie_name = AUTH_COOKIE;
+                                       $scheme = 'auth';
+                               }
+           }
+
+               if ( empty($_COOKIE[$cookie_name]) )
+                       return false;
+               $cookie = $_COOKIE[$cookie_name];
+       }
+
+       $cookie_elements = explode('|', $cookie);
+       if ( count($cookie_elements) != 3 )
+               return false;
+
+       list($username, $expiration, $hmac) = $cookie_elements;
+
+       return compact('username', 'expiration', 'hmac', 'scheme');
+}
+endif;
+
 if ( !function_exists('wp_set_auth_cookie') ) :
 /**
  * Sets the authentication cookies based User ID.
 if ( !function_exists('wp_set_auth_cookie') ) :
 /**
  * Sets the authentication cookies based User ID.
@@ -592,11 +644,23 @@ function wp_set_auth_cookie($user_id, $remember = false, $secure = '') {
        do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);
        do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');
 
        do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);
        do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');
 
-       setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure);
-       setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure);
-       setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN);
-       if ( COOKIEPATH != SITECOOKIEPATH )
-               setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN);
+       // Set httponly if the php version is >= 5.2.0
+       if ( version_compare(phpversion(), '5.2.0', 'ge') ) {
+               setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
+               setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
+               setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, false, true);
+               if ( COOKIEPATH != SITECOOKIEPATH )
+                       setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, false, true);
+       } else {
+               $cookie_domain = COOKIE_DOMAIN;
+               if ( !empty($cookie_domain) )
+                       $cookie_domain .= '; HttpOnly';
+               setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, $cookie_domain, $secure);
+               setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, $cookie_domain, $secure);
+               setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, $cookie_domain);
+               if ( COOKIEPATH != SITECOOKIEPATH )
+                       setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, $cookie_domain);
+       }
 }
 endif;
 
 }
 endif;
 
@@ -607,6 +671,8 @@ if ( !function_exists('wp_clear_auth_cookie') ) :
  * @since 2.5
  */
 function wp_clear_auth_cookie() {
  * @since 2.5
  */
 function wp_clear_auth_cookie() {
+       do_action('clear_auth_cookie');
+
        setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
        setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
        setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
        setcookie(AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
        setcookie(SECURE_AUTH_COOKIE, ' ', time() - 31536000, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
        setcookie(AUTH_COOKIE, ' ', time() - 31536000, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
@@ -661,18 +727,30 @@ function auth_redirect() {
                $secure = false;
 
        // If https is required and request is http, redirect
                $secure = false;
 
        // If https is required and request is http, redirect
-       if ( $secure && !is_ssl() ) {
+       if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
                if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
                        wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
                        exit();
                } else {
                        wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
                if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
                        wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
                        exit();
                } else {
                        wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
-                       exit();                 
+                       exit();
                }
        }
 
                }
        }
 
-       if ( wp_validate_auth_cookie() )
+       if ( $user_id = wp_validate_auth_cookie() ) {
+               // 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') ) {
+                               wp_redirect(preg_replace('|^http://|', 'https://', $_SERVER['REQUEST_URI']));
+                               exit();
+                       } else {
+                               wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
+                               exit();
+                       }
+               }
+
                return;  // The cookie is good so we're done
                return;  // The cookie is good so we're done
+       }
 
        // The cookie is no good so force login
        nocache_headers();
 
        // The cookie is no good so force login
        nocache_headers();
@@ -682,7 +760,9 @@ function auth_redirect() {
        else
                $proto = 'http://';
 
        else
                $proto = 'http://';
 
-       $login_url = site_url( 'wp-login.php?redirect_to=' . urlencode($proto . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']), 'login' );
+       $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' );
 
        wp_redirect($login_url);
        exit();
 
        wp_redirect($login_url);
        exit();
@@ -704,7 +784,7 @@ if ( !function_exists('check_admin_referer') ) :
 function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
        $adminurl = strtolower(admin_url());
        $referer = strtolower(wp_get_referer());
 function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
        $adminurl = strtolower(admin_url());
        $referer = strtolower(wp_get_referer());
-       $result = wp_verify_nonce($_REQUEST[$query_arg], $action);
+       $result = isset($_REQUEST[$query_arg]) ? wp_verify_nonce($_REQUEST[$query_arg], $action) : false;
        if ( !$result && !(-1 == $action && strpos($referer, $adminurl) !== false) ) {
                wp_nonce_ays($action);
                die();
        if ( !$result && !(-1 == $action && strpos($referer, $adminurl) !== false) ) {
                wp_nonce_ays($action);
                die();
@@ -756,7 +836,7 @@ function wp_redirect($location, $status = 302) {
 
        $location = apply_filters('wp_redirect', $location, $status);
        $status = apply_filters('wp_redirect_status', $status, $location);
 
        $location = apply_filters('wp_redirect', $location, $status);
        $status = apply_filters('wp_redirect_status', $status, $location);
-       
+
        if ( !$location ) // allows the wp_redirect filter to cancel a redirect
                return false;
 
        if ( !$location ) // allows the wp_redirect filter to cancel a redirect
                return false;
 
@@ -789,7 +869,7 @@ function wp_sanitize_redirect($location) {
        $found = true;
        while($found) {
                $found = false;
        $found = true;
        while($found) {
                $found = false;
-               foreach($strip as $val) {
+               foreach( (array) $strip as $val ) {
                        while(strpos($location, $val) !== false) {
                                $found = true;
                                $location = str_replace($val, '', $location);
                        while(strpos($location, $val) !== false) {
                                $found = true;
                                $location = str_replace($val, '', $location);
@@ -829,7 +909,7 @@ function wp_safe_redirect($location, $status = 302) {
 
        // In php 5 parse_url may fail if the URL query part contains http://, bug #38143
        $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
 
        // In php 5 parse_url may fail if the URL query part contains http://, bug #38143
        $test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
-       
+
        $lp  = parse_url($test);
        $wpp = parse_url(get_option('home'));
 
        $lp  = parse_url($test);
        $wpp = parse_url(get_option('home'));
 
@@ -974,7 +1054,7 @@ 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( __ngettext('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";
 
                '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";
 
@@ -990,6 +1070,24 @@ function wp_notify_moderator($comment_id) {
 }
 endif;
 
 }
 endif;
 
+if ( !function_exists('wp_password_change_notification') ) :
+/**
+ * Notify the blog admin of a user changing password, normally via email.
+ *
+ * @since 2.7
+ *
+ * @param object $user User Object
+ */
+function wp_password_change_notification(&$user) {
+       // send a copy of password change notification to the admin
+       // but check to see if it's the admin whose password we're changing, and skip this
+       if ( $user->user_email != get_option('admin_email') ) {
+               $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
+               wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message);
+       }
+}
+endif;
+
 if ( !function_exists('wp_new_user_notification') ) :
 /**
  * Notify the blog admin of a new user, normally via email.
 if ( !function_exists('wp_new_user_notification') ) :
 /**
  * Notify the blog admin of a new user, normally via email.
@@ -1061,10 +1159,10 @@ function wp_verify_nonce($nonce, $action = -1) {
        $i = wp_nonce_tick();
 
        // Nonce generated 0-12 hours ago
        $i = wp_nonce_tick();
 
        // Nonce generated 0-12 hours ago
-       if ( substr(wp_hash($i . $action . $uid), -12, 10) == $nonce )
+       if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) == $nonce )
                return 1;
        // Nonce generated 12-24 hours ago
                return 1;
        // Nonce generated 12-24 hours ago
-       if ( substr(wp_hash(($i - 1) . $action . $uid), -12, 10) == $nonce )
+       if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) == $nonce )
                return 2;
        // Invalid nonce
        return false;
                return 2;
        // Invalid nonce
        return false;
@@ -1086,7 +1184,7 @@ function wp_create_nonce($action = -1) {
 
        $i = wp_nonce_tick();
 
 
        $i = wp_nonce_tick();
 
-       return substr(wp_hash($i . $action . $uid), -12, 10);
+       return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10);
 }
 endif;
 
 }
 endif;
 
@@ -1112,7 +1210,7 @@ if ( !function_exists('wp_salt') ) :
  * Below is an example of how the SECRET_KEY constant is defined with a value.
  * You must not copy the below example and paste into your wp-config.php. If you
  * need an example, then you can have a
  * Below is an example of how the SECRET_KEY constant is defined with a value.
  * You must not copy the below example and paste into your wp-config.php. If you
  * need an example, then you can have a
- * {@link http://api.wordpress.org/secret-key/1.0/ secret key created} for you.
+ * {@link https://api.wordpress.org/secret-key/1.1/ secret key created} for you.
  *
  * <code>
  * define('SECRET_KEY', 'mAry1HadA15|\/|b17w55w1t3asSn09w');
  *
  * <code>
  * define('SECRET_KEY', 'mAry1HadA15|\/|b17w55w1t3asSn09w');
@@ -1123,7 +1221,7 @@ if ( !function_exists('wp_salt') ) :
  * salt string is not weak.
  *
  * @since 2.5
  * salt string is not weak.
  *
  * @since 2.5
- * @link http://api.wordpress.org/secret-key/1.0/ Create a Secret Key for wp-config.php
+ * @link https://api.wordpress.org/secret-key/1.1/ Create a Secret Key for wp-config.php
  *
  * @return string Salt value from either 'SECRET_KEY' or 'secret' option
  */
  *
  * @return string Salt value from either 'SECRET_KEY' or 'secret' option
  */
@@ -1174,6 +1272,22 @@ function wp_salt($scheme = 'auth') {
                                update_option('logged_in_salt', $salt);
                        }
                }
                                update_option('logged_in_salt', $salt);
                        }
                }
+       } elseif ( 'nonce' == $scheme ) {
+               if ( defined('NONCE_KEY') && ('' != NONCE_KEY) && ( $wp_default_secret_key != NONCE_KEY) )
+                       $secret_key = NONCE_KEY;
+
+               if ( defined('NONCE_SALT') ) {
+                       $salt = NONCE_SALT;
+               } else {
+                       $salt = get_option('nonce_salt');
+                       if ( empty($salt) ) {
+                               $salt = wp_generate_password();
+                               update_option('nonce_salt', $salt);
+                       }
+               }
+       } else {
+               // ensure each auth scheme has its own unique salt
+               $salt = hash_hmac('md5', $scheme, $secret_key);
        }
 
        return apply_filters('salt', $secret_key . $salt, $scheme);
        }
 
        return apply_filters('salt', $secret_key . $salt, $scheme);
@@ -1280,6 +1394,8 @@ if ( !function_exists('wp_generate_password') ) :
  *
  * @since 2.5
  *
  *
  * @since 2.5
  *
+ * @param int $length The length of password to generate
+ * @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) {
@@ -1332,7 +1448,7 @@ function wp_rand( $min = 0, $max = 0 ) {
        if ( $max != 0 )
                $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1)));
 
        if ( $max != 0 )
                $value = $min + (($max - $min + 1) * ($value / (4294967295 + 1)));
 
-       return abs(intval($value)); 
+       return abs(intval($value));
 }
 endif;
 
 }
 endif;
 
@@ -1368,12 +1484,18 @@ if ( !function_exists( 'get_avatar' ) ) :
  * @param int|string|object $id_or_email A user ID,  email address, or comment object
  * @param int $size Size of the avatar image
  * @param string $default URL to a default image to use if no avatar is available
  * @param int|string|object $id_or_email A user ID,  email address, or comment object
  * @param int $size Size of the avatar image
  * @param string $default URL to a default image to use if no avatar is available
+ * @param string $alt Alternate text to use in image tag. Defaults to blank
  * @return string <img> tag for the user's avatar
 */
  * @return string <img> tag for the user's avatar
 */
-function get_avatar( $id_or_email, $size = '96', $default = '' ) {
+function get_avatar( $id_or_email, $size = '96', $default = '', $alt = false ) {
        if ( ! get_option('show_avatars') )
                return false;
 
        if ( ! get_option('show_avatars') )
                return false;
 
+       if ( false === $alt)
+               $safe_alt = '';
+       else
+               $safe_alt = attribute_escape( $alt );
+
        if ( !is_numeric($size) )
                $size = '96';
 
        if ( !is_numeric($size) )
                $size = '96';
 
@@ -1384,6 +1506,9 @@ function get_avatar( $id_or_email, $size = '96', $default = '' ) {
                if ( $user )
                        $email = $user->user_email;
        } elseif ( is_object($id_or_email) ) {
                if ( $user )
                        $email = $user->user_email;
        } elseif ( is_object($id_or_email) ) {
+               if ( isset($id_or_email->comment_type) && '' != $id_or_email->comment_type && 'comment' != $id_or_email->comment_type )
+                       return false; // No avatar for pingbacks or trackbacks
+
                if ( !empty($id_or_email->user_id) ) {
                        $id = (int) $id_or_email->user_id;
                        $user = get_userdata($id);
                if ( !empty($id_or_email->user_id) ) {
                        $id = (int) $id_or_email->user_id;
                        $user = get_userdata($id);
@@ -1404,21 +1529,26 @@ function get_avatar( $id_or_email, $size = '96', $default = '' ) {
                        $default = $avatar_default;
        }
 
                        $default = $avatar_default;
        }
 
-       if ( 'custom' == $default )
-               $default = add_query_arg( 's', $size, $defaults[$avatar_default][1] );
-       elseif ( 'mystery' == $default )
-               $default = "http://www.gravatar.com/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
+       if ( is_ssl() )
+               $host = 'https://secure.gravatar.com'; 
+       else
+               $host = 'http://www.gravatar.com';
+
+       if ( 'mystery' == $default )
+               $default = "$host/avatar/ad516503a11cd5ca435acc9bb6523536?s={$size}"; // ad516503a11cd5ca435acc9bb6523536 == md5('unknown@gravatar.com')
        elseif ( 'blank' == $default )
                $default = includes_url('images/blank.gif');
        elseif ( !empty($email) && 'gravatar_default' == $default )
                $default = '';
        elseif ( 'gravatar_default' == $default )
        elseif ( 'blank' == $default )
                $default = includes_url('images/blank.gif');
        elseif ( !empty($email) && 'gravatar_default' == $default )
                $default = '';
        elseif ( 'gravatar_default' == $default )
-               $default = "http://www.gravatar.com/avatar/s={$size}";
+               $default = "$host/avatar/s={$size}";
        elseif ( empty($email) )
        elseif ( empty($email) )
-               $default = "http://www.gravatar.com/avatar/?d=$default&amp;s={$size}";
+               $default = "$host/avatar/?d=$default&amp;s={$size}";
+       elseif ( strpos($default, 'http://') === 0 )
+               $default = add_query_arg( 's', $size, $default );
 
        if ( !empty($email) ) {
 
        if ( !empty($email) ) {
-               $out = 'http://www.gravatar.com/avatar/';
+               $out = "$host/avatar/";
                $out .= md5( strtolower( $email ) );
                $out .= '?s='.$size;
                $out .= '&amp;d=' . urlencode( $default );
                $out .= md5( strtolower( $email ) );
                $out .= '?s='.$size;
                $out .= '&amp;d=' . urlencode( $default );
@@ -1427,12 +1557,12 @@ function get_avatar( $id_or_email, $size = '96', $default = '' ) {
                if ( !empty( $rating ) )
                        $out .= "&amp;r={$rating}";
 
                if ( !empty( $rating ) )
                        $out .= "&amp;r={$rating}";
 
-               $avatar = "<img alt='' src='{$out}' class='avatar avatar-{$size}' height='{$size}' width='{$size}' />";
+               $avatar = "<img alt='{$safe_alt}' src='{$out}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' />";
        } else {
        } else {
-               $avatar = "<img alt='' src='{$default}' class='avatar avatar-{$size} avatar-default' height='{$size}' width='{$size}' />";
+               $avatar = "<img alt='{$safe_alt}' src='{$default}' class='avatar avatar-{$size} photo avatar-default' height='{$size}' width='{$size}' />";
        }
 
        }
 
-       return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default);
+       return apply_filters('get_avatar', $avatar, $id_or_email, $size, $default, $alt);
 }
 endif;
 
 }
 endif;
 
@@ -1557,14 +1687,9 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
        if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) )
                require( ABSPATH . WPINC . '/wp-diff.php' );
 
        if ( !class_exists( 'WP_Text_Diff_Renderer_Table' ) )
                require( ABSPATH . WPINC . '/wp-diff.php' );
 
-       // Normalize whitespace
-       $left_string  = trim($left_string);
-       $right_string = trim($right_string);
-       $left_string  = str_replace("\r", "\n", $left_string);
-       $right_string = str_replace("\r", "\n", $right_string);
-       $left_string  = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $left_string );
-       $right_string = preg_replace( array( '/\n+/', '/[ \t]+/' ), array( "\n", ' ' ), $right_string );
-       
+       $left_string  = normalize_whitespace($left_string);
+       $right_string = normalize_whitespace($right_string);
+
        $left_lines  = split("\n", $left_string);
        $right_lines = split("\n", $right_string);
 
        $left_lines  = split("\n", $left_string);
        $right_lines = split("\n", $right_string);
 
@@ -1598,4 +1723,4 @@ function wp_text_diff( $left_string, $right_string, $args = null ) {
 }
 endif;
 
 }
 endif;
 
-?>
\ No newline at end of file
+?>
index 83b53580e5534fc5bdd896409a83c79e016fb03e..b00ed08a1c321248a1ed525c8cc291807ef5c84d 100644 (file)
@@ -11,8 +11,8 @@
  * {@link http://us2.php.net/manual/en/language.pseudo-types.php#language.types.callback 'callback'}
  * type are valid.
  *
  * {@link http://us2.php.net/manual/en/language.pseudo-types.php#language.types.callback 'callback'}
  * type are valid.
  *
- * Also see the {@link http://codex.wordpress.org/Plugin_API Plugin API} for more information
- * and examples on how to use a lot of these functions.
+ * Also see the {@link http://codex.wordpress.org/Plugin_API Plugin API} for
+ * more information and examples on how to use a lot of these functions.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
  */
 
 /**
  */
 
 /**
- * add_filter() - Hooks a function or method to a specific filter action.
+ * Hooks a function or method to a specific filter action.
  *
  * Filters are the hooks that WordPress launches to modify text of various types
  * before adding it to the database or sending it to the browser screen. Plugins
  * can specify that one or more of its PHP functions is executed to
  * modify specific types of text at these times, using the Filter API.
  *
  *
  * Filters are the hooks that WordPress launches to modify text of various types
  * before adding it to the database or sending it to the browser screen. Plugins
  * can specify that one or more of its PHP functions is executed to
  * modify specific types of text at these times, using the Filter API.
  *
- * To use the API, the following code should be used to bind a callback to the filter
+ * To use the API, the following code should be used to bind a callback to the
+ * filter.
+ *
  * <code>
  * function example_hook($example) { echo $example; }
  * <code>
  * function example_hook($example) { echo $example; }
- *
  * add_filter('example_filter', 'example_hook');
  * </code>
  *
  * add_filter('example_filter', 'example_hook');
  * </code>
  *
- * In WordPress 1.5.1+, hooked functions can take extra arguments that are set when
- * the matching do_action() or apply_filters() call is run. The <tt>$accepted_args
- * allow for calling functions only when the number of args match. Hooked functions
- * can take extra arguments that are set when the matching <tt>do_action()</tt> or
- * <tt>apply_filters()</tt> call is run. For example, the action <tt>comment_id_not_found</tt>
- * will pass any functions that hook onto it the ID of the requested comment.
+ * In WordPress 1.5.1+, hooked functions can take extra arguments that are set
+ * when the matching do_action() or apply_filters() call is run. The
+ * $accepted_args allow for calling functions only when the number of args
+ * match. Hooked functions can take extra arguments that are set when the
+ * matching do_action() or apply_filters() call is run. For example, the action
+ * comment_id_not_found will pass any functions that hook onto it the ID of the
+ * requested comment.
  *
  *
- * <strong>Note:</strong> the function will return true no matter if the function was hooked
- * fails or not. There are no checks for whether the function exists beforehand and no checks
- * to whether the <tt>$function_to_add is even a string. It is up to you to take care and
- * this is done for optimization purposes, so everything is as quick as possible.
+ * <strong>Note:</strong> the function will return true no matter if the
+ * function was hooked fails or not. There are no checks for whether the
+ * function exists beforehand and no checks to whether the <tt>$function_to_add
+ * is even a string. It is up to you to take care and this is done for
+ * optimization purposes, so everything is as quick as possible.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -53,7 +56,7 @@
  *     wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
  * @global array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process.
  *
  *     wp_filter['tag']['array of priorities']['array of functions serialized']['array of ['array (functions, accepted_args)]']
  * @global array $merged_filters Tracks the tags that need to be merged for later. If the hook is added, it doesn't need to run through that process.
  *
- * @param string $tag The name of the filter to hook the <tt>$function_to_add</tt> to.
+ * @param string $tag The name of the filter to hook the $function_to_add to.
  * @param callback $function_to_add The name of the function to be called when the filter is applied.
  * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
  * @param int $accepted_args optional. The number of arguments the function accept (default 1).
  * @param callback $function_to_add The name of the function to be called when the filter is applied.
  * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
  * @param int $accepted_args optional. The number of arguments the function accept (default 1).
@@ -69,7 +72,7 @@ function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1)
 }
 
 /**
 }
 
 /**
- * has_filter() - Check if any filter has been registered for a hook.
+ * Check if any filter has been registered for a hook.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -90,7 +93,7 @@ function has_filter($tag, $function_to_check = false) {
        if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )
                return false;
 
        if ( !$idx = _wp_filter_build_unique_id($tag, $function_to_check, false) )
                return false;
 
-       foreach ( array_keys($wp_filter[$tag]) as $priority ) {
+       foreach ( (array) array_keys($wp_filter[$tag]) as $priority ) {
                if ( isset($wp_filter[$tag][$priority][$idx]) )
                        return $priority;
        }
                if ( isset($wp_filter[$tag][$priority][$idx]) )
                        return $priority;
        }
@@ -99,12 +102,12 @@ function has_filter($tag, $function_to_check = false) {
 }
 
 /**
 }
 
 /**
- * apply_filters() - Call the functions added to a filter hook.
+ * Call the functions added to a filter hook.
  *
  *
- * The callback functions attached to filter hook <tt>$tag</tt> are invoked by
- * calling this function. This function can be used to create a new filter hook
- * by simply calling this function with the name of the new hook specified using
- * the <tt>$tag</a> parameter.
+ * The callback functions attached to filter hook $tag are invoked by calling
+ * this function. This function can be used to create a new filter hook by
+ * simply calling this function with the name of the new hook specified using
+ * the $tag parameter.
  *
  * The function allows for additional arguments to be added and passed to hooks.
  * <code>
  *
  * The function allows for additional arguments to be added and passed to hooks.
  * <code>
@@ -120,7 +123,7 @@ function has_filter($tag, $function_to_check = false) {
  * @subpackage Plugin
  * @since 0.71
  * @global array $wp_filter Stores all of the filters
  * @subpackage Plugin
  * @since 0.71
  * @global array $wp_filter Stores all of the filters
- * @global array $merge_filters Merges the filter hooks using this function.
+ * @global array $merged_filters Merges the filter hooks using this function.
  * @global array $wp_current_filter stores the list of current filters with the current one last
  *
  * @param string $tag The name of the filter hook.
  * @global array $wp_current_filter stores the list of current filters with the current one last
  *
  * @param string $tag The name of the filter hook.
@@ -171,14 +174,14 @@ function apply_filters($tag, $value) {
 }
 
 /**
 }
 
 /**
- * remove_filter() - Removes a function from a specified filter hook.
+ * Removes a function from a specified filter hook.
  *
  * This function removes a function attached to a specified filter hook. This
  * method can be used to remove default functions attached to a specific filter
  * hook and possibly replace them with a substitute.
  *
  *
  * This function removes a function attached to a specified filter hook. This
  * method can be used to remove default functions attached to a specific filter
  * hook and possibly replace them with a substitute.
  *
- * To remove a hook, the <tt>$function_to_remove</tt> and <tt>$priority</tt> arguments
- * must match when the hook was added. This goes for both filters and actions. No warning
+ * To remove a hook, the $function_to_remove and $priority arguments must match
+ * when the hook was added. This goes for both filters and actions. No warning
  * will be given on removal failure.
  *
  * @package WordPress
  * will be given on removal failure.
  *
  * @package WordPress
@@ -206,9 +209,33 @@ function remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args
        return $r;
 }
 
        return $r;
 }
 
+/**
+ * Remove all of the hooks from a filter.
+ *
+ * @since 2.7
+ *
+ * @param string $tag The filter to remove hooks from.
+ * @param int $priority The priority number to remove.
+ * @return bool True when finished.
+ */
+function remove_all_filters($tag, $priority = false) {
+       global $wp_filter, $merged_filters;
+
+       if( isset($wp_filter[$tag]) ) {
+               if( false !== $priority && isset($$wp_filter[$tag][$priority]) )
+                       unset($wp_filter[$tag][$priority]);
+               else
+                       unset($wp_filter[$tag]);
+       }
+
+       if( isset($merged_filters[$tag]) )
+               unset($merged_filters[$tag]);
+
+       return true;
+}
 
 /**
 
 /**
- * current_filter() - Return the name of the current filter or action.
+ * Retrieve the name of the current filter or action.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -223,7 +250,7 @@ function current_filter() {
 
 
 /**
 
 
 /**
- * add_action() - Hooks a function on to a specific action.
+ * Hooks a function on to a specific action.
  *
  * Actions are the hooks that the WordPress core launches at specific points
  * during execution, or when specific events occur. Plugins can specify that
  *
  * Actions are the hooks that the WordPress core launches at specific points
  * during execution, or when specific events occur. Plugins can specify that
@@ -236,7 +263,7 @@ function current_filter() {
  * @subpackage Plugin
  * @since 1.2
  *
  * @subpackage Plugin
  * @since 1.2
  *
- * @param string $tag The name of the action to which the <tt>$function_to-add</tt> is hooked.
+ * @param string $tag The name of the action to which the $function_to_add is hooked.
  * @param callback $function_to_add The name of the function you wish to be called.
  * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
  * @param int $accepted_args optional. The number of arguments the function accept (default 1).
  * @param callback $function_to_add The name of the function you wish to be called.
  * @param int $priority optional. Used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
  * @param int $accepted_args optional. The number of arguments the function accept (default 1).
@@ -247,16 +274,17 @@ function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1)
 
 
 /**
 
 
 /**
- * do_action() - Execute functions hooked on a specific action hook.
+ * Execute functions hooked on a specific action hook.
  *
  *
- * This function invokes all functions attached to action hook <tt>$tag</tt>.
- * It is possible to create new action hooks by simply calling this function,
+ * This function invokes all functions attached to action hook $tag. It is
+ * possible to create new action hooks by simply calling this function,
  * specifying the name of the new hook using the <tt>$tag</tt> parameter.
  *
  * specifying the name of the new hook using the <tt>$tag</tt> parameter.
  *
- * You can pass extra arguments to the hooks, much like you can with apply_filters().
+ * You can pass extra arguments to the hooks, much like you can with
+ * apply_filters().
  *
  *
- * @see apply_filters() This function works similar with the exception that nothing is
- * returned and only the functions or methods are called.
+ * @see apply_filters() This function works similar with the exception that
+ * nothing is returned and only the functions or methods are called.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -316,7 +344,7 @@ function do_action($tag, $arg = '') {
 }
 
 /**
 }
 
 /**
- * did_action() - Return the number times an action is fired.
+ * Retrieve the number times an action is fired.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -336,10 +364,10 @@ function did_action($tag) {
 }
 
 /**
 }
 
 /**
- * do_action_ref_array() - Execute functions hooked on a specific action hook, specifying arguments in an array.
+ * Execute functions hooked on a specific action hook, specifying arguments in an array.
  *
  *
- * @see do_action() This function is identical, but the arguments passed to
- * the functions hooked to <tt>$tag</tt> are supplied using an array.
+ * @see do_action() This function is identical, but the arguments passed to the
+ * functions hooked to <tt>$tag</tt> are supplied using an array.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -391,7 +419,7 @@ function do_action_ref_array($tag, $args) {
 }
 
 /**
 }
 
 /**
- * has_action() - Check if any action has been registered for a hook.
+ * Check if any action has been registered for a hook.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -407,7 +435,7 @@ function has_action($tag, $function_to_check = false) {
 }
 
 /**
 }
 
 /**
- * remove_action() - Removes a function from a specified action hook.
+ * Removes a function from a specified action hook.
  *
  * This function removes a function attached to a specified action hook. This
  * method can be used to remove default functions attached to a specific filter
  *
  * This function removes a function attached to a specified action hook. This
  * method can be used to remove default functions attached to a specific filter
@@ -427,12 +455,25 @@ function remove_action($tag, $function_to_remove, $priority = 10, $accepted_args
        return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
 }
 
        return remove_filter($tag, $function_to_remove, $priority, $accepted_args);
 }
 
+/**
+ * Remove all of the hooks from an action.
+ *
+ * @since 2.7
+ *
+ * @param string $tag The action to remove hooks from.
+ * @param int $priority The priority number to remove them from.
+ * @return bool True when finished.
+ */
+function remove_all_actions($tag, $priority = false) {
+       return remove_all_filters($tag, $priority);
+}
+
 //
 // Functions for handling plugins.
 //
 
 /**
 //
 // Functions for handling plugins.
 //
 
 /**
- * plugin_basename() - Gets the basename of a plugin.
+ * Gets the basename of a plugin.
  *
  * This method extracts the name of a plugin from its filename.
  *
  *
  * This method extracts the name of a plugin from its filename.
  *
@@ -456,15 +497,15 @@ function plugin_basename($file) {
 }
 
 /**
 }
 
 /**
- * register_activation_hook() - Hook a function on a plugin activation action hook.
+ * Set the activation hook for a plugin.
  *
  * When a plugin is activated, the action 'activate_PLUGINNAME' hook is
  * activated. In the name of this hook, PLUGINNAME is replaced with the name of
  * the plugin, including the optional subdirectory. For example, when the plugin
  *
  * When a plugin is activated, the action 'activate_PLUGINNAME' hook is
  * activated. In the name of this hook, PLUGINNAME is replaced with the name of
  * the plugin, including the optional subdirectory. For example, when the plugin
- * is located in <tt>wp-content/plugin/sampleplugin/sample.php</tt>, then the
- * name of this hook will become 'activate_sampleplugin/sample.php'
- * When the plugin consists of only one file and is (as by default) located at
- * <tt>wp-content/plugin/sample.php</tt> the name of this hook will be
+ * is located in wp-content/plugin/sampleplugin/sample.php, then the name of
+ * this hook will become 'activate_sampleplugin/sample.php'. When the plugin
+ * consists of only one file and is (as by default) located at
+ * wp-content/plugin/sample.php the name of this hook will be
  * 'activate_sample.php'.
  *
  * @package WordPress
  * 'activate_sample.php'.
  *
  * @package WordPress
@@ -474,7 +515,7 @@ function plugin_basename($file) {
  * @access private
  *
  * @param string $file The filename of the plugin including the path.
  * @access private
  *
  * @param string $file The filename of the plugin including the path.
- * @param string $function the function hooked to the 'activate_PLUGIN' action.
+ * @param callback $function the function hooked to the 'activate_PLUGIN' action.
  */
 function register_activation_hook($file, $function) {
        $file = plugin_basename($file);
  */
 function register_activation_hook($file, $function) {
        $file = plugin_basename($file);
@@ -482,15 +523,16 @@ function register_activation_hook($file, $function) {
 }
 
 /**
 }
 
 /**
- * register_deactivation_hook() - Hook a function on a plugin deactivation action hook.
+ * Set the deactivation hook for a plugin.
  *
  * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is
  *
  * When a plugin is deactivated, the action 'deactivate_PLUGINNAME' hook is
- * deactivated. In the name of this hook, PLUGINNAME is replaced with the name of
- * the plugin, including the optional subdirectory. For example, when the plugin
- * is located in <tt>wp-content/plugin/sampleplugin/sample.php</tt>, then the
- * name of this hook will become 'activate_sampleplugin/sample.php'.
+ * deactivated. In the name of this hook, PLUGINNAME is replaced with the name
+ * of the plugin, including the optional subdirectory. For example, when the
+ * plugin is located in wp-content/plugin/sampleplugin/sample.php, then
+ * the name of this hook will become 'activate_sampleplugin/sample.php'.
+ *
  * When the plugin consists of only one file and is (as by default) located at
  * When the plugin consists of only one file and is (as by default) located at
- * <tt>wp-content/plugin/sample.php</tt> the name of this hook will be
+ * wp-content/plugin/sample.php the name of this hook will be
  * 'activate_sample.php'.
  *
  * @package WordPress
  * 'activate_sample.php'.
  *
  * @package WordPress
@@ -500,7 +542,7 @@ function register_activation_hook($file, $function) {
  * @access private
  *
  * @param string $file The filename of the plugin including the path.
  * @access private
  *
  * @param string $file The filename of the plugin including the path.
- * @param string $function the function hooked to the 'activate_PLUGIN' action.
+ * @param callback $function the function hooked to the 'activate_PLUGIN' action.
  */
 function register_deactivation_hook($file, $function) {
        $file = plugin_basename($file);
  */
 function register_deactivation_hook($file, $function) {
        $file = plugin_basename($file);
@@ -508,14 +550,49 @@ function register_deactivation_hook($file, $function) {
 }
 
 /**
 }
 
 /**
- * _wp_call_all_hook() - Calls the 'all' hook, which will process the functions hooked into it.
+ * Set the uninstallation hook for a plugin.
+ *
+ * Registers the uninstall hook that will be called when the user clicks on the
+ * uninstall link that calls for the plugin to uninstall itself. The link won't
+ * be active unless the plugin hooks into the action.
  *
  *
- * The 'all' hook passes all of the arguments or parameters that were used for the
- * hook, which this function was called for.
+ * The plugin should not run arbitrary code outside of functions, when
+ * registering the uninstall hook. In order to run using the hook, the plugin
+ * will have to be included, which means that any code laying outside of a
+ * function will be run during the uninstall process. The plugin should not
+ * hinder the uninstall process.
  *
  *
- * This function is used internally for apply_filters(), do_action(), and do_action_ref_array()
- * and is not meant to be used from outside those functions. This function does not check for the
- * existence of the all hook, so it will fail unless the all hook exists prior to this function call.
+ * If the plugin can not be written without running code within the plugin, then
+ * the plugin should create a file named 'uninstall.php' in the base plugin
+ * folder. This file will be called, if it exists, during the uninstall process
+ * bypassing the uninstall hook. The plugin, when using the 'uninstall.php'
+ * should always check for the 'WP_UNINSTALL_PLUGIN' constant, before
+ * executing.
+ *
+ * @since 2.7
+ *
+ * @param string $file
+ * @param callback $callback The callback to run when the hook is called.
+ */
+function register_uninstall_hook($file, $callback) {
+       // The option should not be autoloaded, because it is not needed in most
+       // cases. Emphasis should be put on using the 'uninstall.php' way of
+       // uninstalling the plugin.
+       $uninstallable_plugins = (array) get_option('uninstall_plugins');
+       $uninstallable_plugins[plugin_basename($file)] = $callback;
+       update_option('uninstall_plugins', $uninstallable_plugins);
+}
+
+/**
+ * Calls the 'all' hook, which will process the functions hooked into it.
+ *
+ * The 'all' hook passes all of the arguments or parameters that were used for
+ * the hook, which this function was called for.
+ *
+ * This function is used internally for apply_filters(), do_action(), and
+ * do_action_ref_array() and is not meant to be used from outside those
+ * functions. This function does not check for the existence of the all hook, so
+ * it will fail unless the all hook exists prior to this function call.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
@@ -540,7 +617,7 @@ function _wp_call_all_hook($args) {
 }
 
 /**
 }
 
 /**
- * _wp_filter_build_unique_id() - Build Unique ID for storage and retrieval
+ * Build Unique ID for storage and retrieval.
  *
  * The old way to serialize the callback caused issues and this function is the
  * solution. It works by checking for objects and creating an a new property in
  *
  * The old way to serialize the callback caused issues and this function is the
  * solution. It works by checking for objects and creating an a new property in
@@ -549,21 +626,19 @@ function _wp_call_all_hook($args) {
  *
  * It also allows for the removal of actions and filters for objects after they
  * change class properties. It is possible to include the property $wp_filter_id
  *
  * It also allows for the removal of actions and filters for objects after they
  * change class properties. It is possible to include the property $wp_filter_id
- * in your class and set it to "null" or a number to bypass the workaround. However
- * this will prevent you from adding new classes and any new classes will overwrite
- * the previous hook by the same class.
+ * in your class and set it to "null" or a number to bypass the workaround.
+ * However this will prevent you from adding new classes and any new classes
+ * will overwrite the previous hook by the same class.
  *
  *
- * Functions and static method callbacks are just returned as strings and shouldn't
- * have any speed penalty.
+ * Functions and static method callbacks are just returned as strings and
+ * shouldn't have any speed penalty.
  *
  * @package WordPress
  * @subpackage Plugin
  *
  * @package WordPress
  * @subpackage Plugin
+ * @access private
  * @since 2.2.3
  * @since 2.2.3
- *
  * @link http://trac.wordpress.org/ticket/3875
  *
  * @link http://trac.wordpress.org/ticket/3875
  *
- * @access private
- *
  * @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
  * @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
@@ -583,7 +658,7 @@ 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 = count((array)$wp_filter[$tag][$priority]);
+                       $count = isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : 0;
                        $function[0]->wp_filter_id = $count;
                        $obj_idx .= $count;
                        unset($count);
                        $function[0]->wp_filter_id = $count;
                        $obj_idx .= $count;
                        unset($count);
index 40a56d99eb3f5a8381fae9a55c77cec15be1f728..2ff0e7db168fb2f22fcb4af60606483ea1bb8bdf 100644 (file)
@@ -1,21 +1,47 @@
 <?php
 <?php
+/**
+ * WordPress Post Template Functions.
+ *
+ * Gets content for the current post in the loop.
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
 
 
-//
-// "The Loop" post functions
-//
-
+/**
+ * Display the ID of the current item in the WordPress Loop.
+ *
+ * @since 0.71
+ * @uses $id
+ */
 function the_ID() {
        global $id;
        echo $id;
 }
 
 function the_ID() {
        global $id;
        echo $id;
 }
 
-
+/**
+ * Retrieve the ID of the current item in the WordPress Loop.
+ *
+ * @since 2.1.0
+ * @uses $id
+ *
+ * @return unknown
+ */
 function get_the_ID() {
        global $id;
        return $id;
 }
 
 function get_the_ID() {
        global $id;
        return $id;
 }
 
-
+/**
+ * Display or retrieve the current post title with optional content.
+ *
+ * @since 0.71
+ *
+ * @param string $before Optional. Content to prepend to the title.
+ * @param string $after Optional. Content to append to the title.
+ * @param bool $echo Optional, default to true.Whether to display or return.
+ * @return null|string Null on no title. String if $echo parameter is false.
+ */
 function the_title($before = '', $after = '', $echo = true) {
        $title = get_the_title();
 
 function the_title($before = '', $after = '', $echo = true) {
        $title = get_the_title();
 
@@ -30,6 +56,21 @@ function the_title($before = '', $after = '', $echo = true) {
                return $title;
 }
 
                return $title;
 }
 
+/**
+ * Sanitize the current title when retrieving or displaying.
+ *
+ * Works like {@link the_title()}, except the parameters can be in a string or
+ * 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
+ * as with {@link the_title()}, is to display the title.
+ *
+ * @since 2.3.0
+ *
+ * @param string|array $args Optional. Override the defaults.
+ * @return string|null Null on failure or display. String when echo is false.
+ */
 function the_title_attribute( $args = '' ) {
        $title = get_the_title();
 
 function the_title_attribute( $args = '' ) {
        $title = get_the_title();
 
@@ -50,6 +91,18 @@ function the_title_attribute( $args = '' ) {
                return $title;
 }
 
                return $title;
 }
 
+/**
+ * Retrieve post title.
+ *
+ * If the post is protected and the visitor is not an admin, then "Protected"
+ * will be displayed before the post title. If the post is private, then
+ * "Private" will be located before the post title.
+ *
+ * @since 0.71
+ *
+ * @param int $id Optional. Post ID.
+ * @return string
+ */
 function get_the_title( $id = 0 ) {
        $post = &get_post($id);
 
 function get_the_title( $id = 0 ) {
        $post = &get_post($id);
 
@@ -64,34 +117,77 @@ function get_the_title( $id = 0 ) {
        return apply_filters( 'the_title', $title );
 }
 
        return apply_filters( 'the_title', $title );
 }
 
+/**
+ * Display the Post Global Unique Identifier (guid).
+ *
+ * The guid will appear to be a link, but should not be used as an link to the
+ * post. The reason you should not use it as a link, is because of moving the
+ * blog across domains.
+ *
+ * @since 1.5.0
+ *
+ * @param int $id Optional. Post ID.
+ */
 function the_guid( $id = 0 ) {
        echo get_the_guid($id);
 }
 
 function the_guid( $id = 0 ) {
        echo get_the_guid($id);
 }
 
+/**
+ * Retrieve the Post Global Unique Identifier (guid).
+ *
+ * The guid will appear to be a link, but should not be used as an link to the
+ * post. The reason you should not use it as a link, is because of moving the
+ * blog across domains.
+ *
+ * @since 1.5.0
+ *
+ * @param int $id Optional. Post ID.
+ * @return string
+ */
 function get_the_guid( $id = 0 ) {
        $post = &get_post($id);
 
        return apply_filters('get_the_guid', $post->guid);
 }
 
 function get_the_guid( $id = 0 ) {
        $post = &get_post($id);
 
        return apply_filters('get_the_guid', $post->guid);
 }
 
-function the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
+/**
+ * Display the post content.
+ *
+ * @since 0.71
+ *
+ * @param string $more_link_text Optional. Content for when there is more text.
+ * @param string $stripteaser Optional. Teaser content before the more text.
+ * @param string $more_file Optional. Not used.
+ */
+function the_content($more_link_text = null, $stripteaser = 0, $more_file = '') {
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        echo $content;
 }
 
        $content = get_the_content($more_link_text, $stripteaser, $more_file);
        $content = apply_filters('the_content', $content);
        $content = str_replace(']]>', ']]&gt;', $content);
        echo $content;
 }
 
-
-function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') {
+/**
+ * Retrieve the post content.
+ *
+ * @since 0.71
+ *
+ * @param string $more_link_text Optional. Content for when there is more text.
+ * @param string $stripteaser Optional. Teaser content before the more text.
+ * @param string $more_file Optional. Not used.
+ * @return string
+ */
+function get_the_content($more_link_text = null, $stripteaser = 0, $more_file = '') {
        global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow;
 
        global $id, $post, $more, $page, $pages, $multipage, $preview, $pagenow;
 
+       if ( null === $more_link_text )
+               $more_link_text = __( '(more...)' );
+
        $output = '';
 
        $output = '';
 
-       if ( !empty($post->post_password) ) { // if there's a password
-               if ( !isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || stripslashes($_COOKIE['wp-postpass_'.COOKIEHASH]) != $post->post_password ) {       // and it doesn't match the cookie
-                       $output = get_the_password_form();
-                       return $output;
-               }
+       // If post password required and it doesn't match the cookie.
+       if ( post_password_required($post) ) {
+               $output = get_the_password_form();
+               return $output;
        }
 
        if ( $more_file != '' )
        }
 
        if ( $more_file != '' )
@@ -127,39 +223,202 @@ function get_the_content($more_link_text = '(more...)', $stripteaser = 0, $more_
 
        }
        if ( $preview ) // preview fix for javascript bug with foreign languages
 
        }
        if ( $preview ) // preview fix for javascript bug with foreign languages
-               $output =       preg_replace('/\%u([0-9A-F]{4,4})/e',   "'&#'.base_convert('\\1',16,10).';'", $output);
+               $output =       preg_replace_callback('/\%u([0-9A-F]{4})/', create_function('$match', 'return "&#" . base_convert($match[1], 16, 10) . ";";'), $output);
 
        return $output;
 }
 
 
        return $output;
 }
 
-
+/**
+ * Display the post excerpt.
+ *
+ * @since 0.71
+ * @uses apply_filters() Calls 'the_excerpt' hook on post excerpt.
+ */
 function the_excerpt() {
        echo apply_filters('the_excerpt', get_the_excerpt());
 }
 
 function the_excerpt() {
        echo apply_filters('the_excerpt', get_the_excerpt());
 }
 
-
+/**
+ * Retrieve the post excerpt.
+ *
+ * @since 0.71
+ *
+ * @param mixed $deprecated Not used.
+ * @return string
+ */
 function get_the_excerpt($deprecated = '') {
        global $post;
        $output = '';
        $output = $post->post_excerpt;
 function get_the_excerpt($deprecated = '') {
        global $post;
        $output = '';
        $output = $post->post_excerpt;
-       if ( !empty($post->post_password) ) { // if there's a password
-               if ( !isset($_COOKIE['wp-postpass_'.COOKIEHASH]) || $_COOKIE['wp-postpass_'.COOKIEHASH] != $post->post_password ) {  // and it doesn't match the cookie
-                       $output = __('There is no excerpt because this is a protected post.');
-                       return $output;
-               }
+       if ( post_password_required($post) ) {
+               $output = __('There is no excerpt because this is a protected post.');
+               return $output;
        }
 
        return apply_filters('get_the_excerpt', $output);
 }
 
        }
 
        return apply_filters('get_the_excerpt', $output);
 }
 
+/**
+ * Whether post has excerpt.
+ *
+ * @since 2.3.0
+ *
+ * @param int $id Optional. Post ID.
+ * @return bool
+ */
 function has_excerpt( $id = 0 ) {
        $post = &get_post( $id );
        return ( !empty( $post->post_excerpt ) );
 }
 
 function has_excerpt( $id = 0 ) {
        $post = &get_post( $id );
        return ( !empty( $post->post_excerpt ) );
 }
 
+/**
+ * Display the classes for the post div.
+ *
+ * @since 2.7.0
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @param int $post_id An optional post ID.
+ */
+function post_class( $class = '', $post_id = null ) {
+       // Separates classes with a single space, collates classes for post DIV
+       echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
+}
+
+/**
+ * Retrieve the classes for the post div as an array.
+ *
+ * The class names are add are many. If the post is a sticky, then the 'sticky'
+ * class name. The class 'hentry' is always added to each post. For each
+ * category, the class will be added with 'category-' with category slug is
+ * added. The tags are the same way as the categories with 'tag-' before the tag
+ * slug. All classes are passed through the filter, 'post_class' with the list
+ * of classes, followed by $class parameter value, with the post ID as the last
+ * parameter.
+ *
+ * @since 2.7.0
+ *
+ * @param string|array $class One or more classes to add to the class list.
+ * @param int $post_id An optional post ID.
+ * @return array Array of classes.
+ */
+function get_post_class( $class = '', $post_id = null ) {
+       $post = get_post($post_id);
+
+       $classes = array();
+
+       $classes[] = $post->post_type;
+
+       // sticky for Sticky Posts
+       if ( is_sticky($post->ID) && is_home())
+               $classes[] = 'sticky';
+
+       // hentry for hAtom compliace
+       $classes[] = 'hentry';
+
+       // Categories
+       foreach ( (array) get_the_category($post->ID) as $cat ) {
+               if ( empty($cat->slug ) )
+                       continue;
+               $classes[] = 'category-' . $cat->slug;
+       }
+
+       // Tags
+       foreach ( (array) get_the_tags($post->ID) as $tag ) {
+               if ( empty($tag->slug ) )
+                       continue;
+               $classes[] = 'tag-' . $tag->slug;
+       }
+
+       if ( !empty($class) ) {
+               if ( !is_array( $class ) )
+                       $class = preg_split('#\s+#', $class);
+               $classes = array_merge($classes, $class);
+       }
+
+       return apply_filters('post_class', $classes, $class, $post_id);
+}
+
+/**
+ * Whether post requires password and correct password has been provided.
+ *
+ * @since 2.7.0
+ *
+ * @param int|object $post An optional post.  Global $post used if not provided.
+ * @return bool false if a password is not required or the correct password cookie is present, true otherwise.
+ */
+function post_password_required( $post = null ) {
+       $post = get_post($post);
+
+       if ( empty($post->post_password) )
+               return false;
+
+       if ( !isset($_COOKIE['wp-postpass_' . COOKIEHASH]) )
+               return true;
+
+       if ( $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password )
+               return true;
+
+       return false;
+}
+
+/**
+ * Display "sticky" CSS class, if a post is sticky.
+ *
+ * @since 2.7.0
+ *
+ * @param int $post_id An optional post ID.
+ */
+function sticky_class( $post_id = null ) {
+       if ( !is_sticky($post_id) )
+               return;
+
+       echo " sticky";
+}
+
+/**
+ * Page Template Functions for usage in Themes
+ *
+ * @package WordPress
+ * @subpackage Template
+ */
+
+/**
+ * The formatted output of a list of pages.
+ *
+ * Displays page links for paginated posts (i.e. includes the <!--nextpage-->.
+ * Quicktag one or more times). This tag must be within The Loop.
+ *
+ * The defaults for overwriting are:
+ * 'next_or_number' - Default is 'number' (string). Indicates whether page
+ *      numbers should be used. Valid values are number and next.
+ * 'nextpagelink' - Default is 'Next Page' (string). Text for link to next page.
+ *      of the bookmark.
+ * 'previouspagelink' - Default is 'Previous Page' (string). Text for link to
+ *      previous page, if available.
+ * 'pagelink' - Default is '%' (String).Format string for page numbers. The % in
+ *      the parameter string will be replaced with the page number, so Page %
+ *      generates "Page 1", "Page 2", etc. Defaults to %, just the page number.
+ * 'before' - Default is '<p> Pages:' (string). The html or text to prepend to
+ *      each bookmarks.
+ * 'after' - Default is '</p>' (string). The html or text to append to each
+ *      bookmarks.
+ * 'more_file' - Default is '' (string) Page the links should point to. Defaults
+ *      to the current page.
+ * 'link_before' - Default is '' (string). The html or text to prepend to each
+ *      Pages link inside the <a> tag.
+ * 'link_after' - Default is '' (string). The html or text to append to each
+ *      Pages link inside the <a> tag.
+ *
+ * @since 1.2.0
+ * @access private
+ *
+ * @param string|array $args Optional. Overwrite the defaults.
+ * @return string Formatted output in HTML.
+ */
 function wp_link_pages($args = '') {
        $defaults = array(
                'before' => '<p>' . __('Pages:'), 'after' => '</p>',
 function wp_link_pages($args = '') {
        $defaults = array(
                'before' => '<p>' . __('Pages:'), 'after' => '</p>',
+               'link_before' => '', 'link_after' => '',
                'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
                'previouspagelink' => __('Previous page'), 'pagelink' => '%',
                'more_file' => '', 'echo' => 1
                'next_or_number' => 'number', 'nextpagelink' => __('Next page'),
                'previouspagelink' => __('Previous page'), 'pagelink' => '%',
                'more_file' => '', 'echo' => 1
@@ -190,8 +449,11 @@ function wp_link_pages($args = '') {
                                                else
                                                        $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
                                        }
                                                else
                                                        $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">';
                                        }
+
                                }
                                }
+                               $output .= $link_before;
                                $output .= $j;
                                $output .= $j;
+                               $output .= $link_after;
                                if ( ($i != $page) || ((!$more) && ($page==1)) )
                                        $output .= '</a>';
                        }
                                if ( ($i != $page) || ((!$more) && ($page==1)) )
                                        $output .= '</a>';
                        }
@@ -202,23 +464,23 @@ function wp_link_pages($args = '') {
                                $i = $page - 1;
                                if ( $i && $more ) {
                                        if ( 1 == $i ) {
                                $i = $page - 1;
                                if ( $i && $more ) {
                                        if ( 1 == $i ) {
-                                               $output .= '<a href="' . get_permalink() . '">' . $previouspagelink . '</a>';
+                                               $output .= '<a href="' . get_permalink() . '">' . $link_before. $previouspagelink . $link_after . '</a>';
                                        } else {
                                                if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
                                        } else {
                                                if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-                                                       $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $previouspagelink . '</a>';
+                                                       $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $previouspagelink . $link_after . '</a>';
                                                else
                                                else
-                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $previouspagelink . '</a>';
+                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $previouspagelink . $link_after . '</a>';
                                        }
                                }
                                $i = $page + 1;
                                if ( $i <= $numpages && $more ) {
                                        if ( 1 == $i ) {
                                        }
                                }
                                $i = $page + 1;
                                if ( $i <= $numpages && $more ) {
                                        if ( 1 == $i ) {
-                                               $output .= '<a href="' . get_permalink() . '">' . $nextpagelink . '</a>';
+                                               $output .= '<a href="' . get_permalink() . '">' . $link_before. $nextpagelink . $link_after . '</a>';
                                        } else {
                                                if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
                                        } else {
                                                if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
-                                                       $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $nextpagelink . '</a>';
+                                                       $output .= '<a href="' . get_permalink() . '&amp;page=' . $i . '">' . $link_before. $nextpagelink . $link_after . '</a>';
                                                else
                                                else
-                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $nextpagelink . '</a>';
+                                                       $output .= '<a href="' . trailingslashit(get_permalink()) . user_trailingslashit($i, 'single_paged') . '">' . $link_before. $nextpagelink . $link_after . '</a>';
                                        }
                                }
                                $output .= $after;
                                        }
                                }
                                $output .= $after;
@@ -237,7 +499,14 @@ function wp_link_pages($args = '') {
 // Post-meta: Custom per-post fields.
 //
 
 // Post-meta: Custom per-post fields.
 //
 
-
+/**
+ * Retrieve post custom meta data field.
+ *
+ * @since 1.5.0
+ *
+ * @param string $key Meta data key name.
+ * @return string|array Array of values or single value, if only one element exists.
+ */
 function post_custom( $key = '' ) {
        $custom = get_post_custom();
 
 function post_custom( $key = '' ) {
        $custom = get_post_custom();
 
@@ -247,12 +516,17 @@ function post_custom( $key = '' ) {
                return $custom[$key];
 }
 
                return $custom[$key];
 }
 
-
-// this will probably change at some point...
+/**
+ * Display list of post custom fields.
+ *
+ * @internal This will probably change at some point...
+ * @since 1.2.0
+ * @uses apply_filters() Calls 'the_meta_key' on list item HTML content, with key and value as separate parameters.
+ */
 function the_meta() {
        if ( $keys = get_post_custom_keys() ) {
                echo "<ul class='post-meta'>\n";
 function the_meta() {
        if ( $keys = get_post_custom_keys() ) {
                echo "<ul class='post-meta'>\n";
-               foreach ( $keys as $key ) {
+               foreach ( (array) $keys as $key ) {
                        $keyt = trim($key);
                        if ( '_' == $keyt{0} )
                                continue;
                        $keyt = trim($key);
                        if ( '_' == $keyt{0} )
                                continue;
@@ -264,16 +538,24 @@ function the_meta() {
        }
 }
 
        }
 }
 
-
 //
 // Pages
 //
 
 //
 // Pages
 //
 
+/**
+ * Retrieve or display list of pages as a dropdown (select list).
+ *
+ * @since 2.1.0
+ *
+ * @param array|string $args Optional. Override default arguments.
+ * @return string HTML content, if not displaying.
+ */
 function wp_dropdown_pages($args = '') {
        $defaults = array(
                'depth' => 0, 'child_of' => 0,
                'selected' => 0, 'echo' => 1,
 function wp_dropdown_pages($args = '') {
        $defaults = array(
                'depth' => 0, 'child_of' => 0,
                'selected' => 0, 'echo' => 1,
-               'name' => 'page_id', 'show_option_none' => ''
+               'name' => 'page_id', 'show_option_none' => '', 'show_option_no_change' => '',
+               'option_none_value' => ''
        );
 
        $r = wp_parse_args( $args, $defaults );
        );
 
        $r = wp_parse_args( $args, $defaults );
@@ -283,9 +565,11 @@ function wp_dropdown_pages($args = '') {
        $output = '';
 
        if ( ! empty($pages) ) {
        $output = '';
 
        if ( ! empty($pages) ) {
-               $output = "<select name='$name' id='$name'>\n";
+               $output = "<select name=\"$name\" id=\"$name\">\n";
+               if ( $show_option_no_change )
+                       $output .= "\t<option value=\"-1\">$show_option_no_change</option>";
                if ( $show_option_none )
                if ( $show_option_none )
-                       $output .= "\t<option value=''>$show_option_none</option>\n";
+                       $output .= "\t<option value=\"$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";
        }
@@ -298,13 +582,22 @@ function wp_dropdown_pages($args = '') {
        return $output;
 }
 
        return $output;
 }
 
+/**
+ * Retrieve or display list of pages in list (li) format.
+ *
+ * @since 1.5.0
+ *
+ * @param array|string $args Optional. Override default arguments.
+ * @return string HTML content, if not displaying.
+ */
 function wp_list_pages($args = '') {
        $defaults = array(
                'depth' => 0, 'show_date' => '',
                'date_format' => get_option('date_format'),
                'child_of' => 0, 'exclude' => '',
                'title_li' => __('Pages'), 'echo' => 1,
 function wp_list_pages($args = '') {
        $defaults = array(
                'depth' => 0, 'show_date' => '',
                'date_format' => get_option('date_format'),
                'child_of' => 0, 'exclude' => '',
                'title_li' => __('Pages'), 'echo' => 1,
-               'authors' => '', 'sort_column' => 'menu_order, post_title'
+               'authors' => '', 'sort_column' => 'menu_order, post_title',
+               'link_before' => '', 'link_after' => ''
        );
 
        $r = wp_parse_args( $args, $defaults );
        );
 
        $r = wp_parse_args( $args, $defaults );
@@ -314,7 +607,7 @@ function wp_list_pages($args = '') {
        $current_page = 0;
 
        // sanitize, mostly to keep spaces out
        $current_page = 0;
 
        // sanitize, mostly to keep spaces out
-       $r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']);
+       $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);
 
        // Allow plugins to filter an array of excluded pages
        $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude'])));
 
        // Allow plugins to filter an array of excluded pages
        $r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude'])));
@@ -344,16 +637,100 @@ function wp_list_pages($args = '') {
                return $output;
 }
 
                return $output;
 }
 
+/**
+ * Display or retrieve list of pages with optional home link.
+ *
+ * The arguments are listed below and part of the arguments are for {@link
+ * wp_list_pages()} function. Check that function for more info on those
+ * arguments.
+ *
+ * <ul>
+ * <li><strong>sort_column</strong> - How to sort the list of pages. Defaults
+ * to page title. Use column for posts table.</li>
+ * <li><strong>menu_class</strong> - Class to use for the div ID which contains
+ * the page list. Defaults to 'menu'.</li>
+ * <li><strong>echo</strong> - Whether to echo list or return it. Defaults to
+ * echo.</li>
+ * <li><strong>link_before</strong> - Text before show_home argument text.</li>
+ * <li><strong>link_after</strong> - Text after show_home argument text.</li>
+ * <li><strong>show_home</strong> - If you set this argument, then it will
+ * display the link to the home page. The show_home argument really just needs
+ * to be set to the value of the text of the link.</li>
+ * </ul>
+ *
+ * @since 2.7.0
+ *
+ * @param array|string $args
+ */
+function wp_page_menu( $args = array() ) {
+       $defaults = array('sort_column' => 'post_title', 'menu_class' => 'menu', 'echo' => true, 'link_before' => '', 'link_after' => '');
+       $args = wp_parse_args( $args, $defaults );
+       $args = apply_filters( 'wp_page_menu_args', $args );
+
+       $menu = '';
+
+       $list_args = $args;
+
+       // Show Home in the menu
+       if ( isset($args['show_home']) && ! empty($args['show_home']) ) {
+               if ( true === $args['show_home'] || '1' === $args['show_home'] || 1 === $args['show_home'] )
+                       $text = __('Home');
+               else
+                       $text = $args['show_home'];
+               $class = '';
+               if ( is_front_page() && !is_paged() )
+                       $class = 'class="current_page_item"';
+               $menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $args['link_before'] . $text . $args['link_after'] . '</a></li>';
+               // If the front page is a page, add it to the exclude list
+               if (get_option('show_on_front') == 'page') {
+                       if ( !empty( $list_args['exclude'] ) ) {
+                               $list_args['exclude'] .= ',';
+                       } else {
+                               $list_args['exclude'] = '';
+                       }
+                       $list_args['exclude'] .= get_option('page_on_front');
+               }
+       }
+
+       $list_args['echo'] = false;
+       $list_args['title_li'] = '';
+       $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );
+
+       if ( $menu )
+               $menu = '<ul>' . $menu . '</ul>';
+
+       $menu = '<div class="' . $args['menu_class'] . '">' . $menu . "</div>\n";
+       $menu = apply_filters( 'wp_page_menu', $menu, $args );
+       if ( $args['echo'] )
+               echo $menu;
+       else
+               return $menu;
+}
+
 //
 // Page helpers
 //
 
 //
 // Page helpers
 //
 
-function walk_page_tree() {
+/**
+ * Retrieve HTML list content for page list.
+ *
+ * @uses Walker_Page to create HTML list content.
+ * @since 2.1.0
+ * @see Walker_Page::walk() for parameters and return description.
+ */
+function walk_page_tree($pages, $depth, $current_page, $r) {
        $walker = new Walker_Page;
        $walker = new Walker_Page;
-       $args = func_get_args();
+       $args = array($pages, $depth, $r, $current_page);
        return call_user_func_array(array(&$walker, 'walk'), $args);
 }
 
        return call_user_func_array(array(&$walker, 'walk'), $args);
 }
 
+/**
+ * Retrieve HTML dropdown (select) content for page list.
+ *
+ * @uses Walker_PageDropdown to create HTML dropdown content.
+ * @since 2.1.0
+ * @see Walker_PageDropdown::walk() for parameters and return description.
+ */
 function walk_page_dropdown_tree() {
        $walker = new Walker_PageDropdown;
        $args = func_get_args();
 function walk_page_dropdown_tree() {
        $walker = new Walker_PageDropdown;
        $args = func_get_args();
@@ -364,6 +741,16 @@ function walk_page_dropdown_tree() {
 // Attachments
 //
 
 // Attachments
 //
 
+/**
+ * Display an attachment page link using an image or icon.
+ *
+ * @since 2.0.0
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $fullsize Optional, default is false. Whether to use full size.
+ * @param bool $deprecated Deprecated. Not used.
+ * @param bool $permalink Optional, default is false. Whether to include permalink.
+ */
 function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) {
        if ( $fullsize )
                echo wp_get_attachment_link($id, 'full', $permalink);
 function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $permalink = false) {
        if ( $fullsize )
                echo wp_get_attachment_link($id, 'full', $permalink);
@@ -371,7 +758,18 @@ function the_attachment_link($id = 0, $fullsize = false, $deprecated = false, $p
                echo wp_get_attachment_link($id, 'thumbnail', $permalink);
 }
 
                echo wp_get_attachment_link($id, 'thumbnail', $permalink);
 }
 
-// get an attachment page link using an image or icon if possible
+/**
+ * Retrieve an attachment page link using an image or icon, if possible.
+ *
+ * @since 2.5.0
+ * @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 bool $permalink Optional, default is false. Whether to add permalink to image.
+ * @param bool $icon Optional, default is false. Whether to include icon.
+ * @return string HTML content.
+ */
 function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
        $id = intval($id);
        $_post = & get_post( $id );
 function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false, $icon = false) {
        $id = intval($id);
        $_post = & get_post( $id );
@@ -388,11 +786,22 @@ function wp_get_attachment_link($id = 0, $size = 'thumbnail', $permalink = false
        if ( !$link_text )
                $link_text = $_post->post_title;
 
        if ( !$link_text )
                $link_text = $_post->post_title;
 
-       return "<a href='$url' title='$post_title'>$link_text</a>";
-
+       return apply_filters( 'wp_get_attachment_link', "<a href='$url' title='$post_title'>$link_text</a>", $id, $size, $permalink, $icon );
 }
 
 }
 
-// deprecated - use wp_get_attachment_link()
+/**
+ * Retrieve HTML content of attachment image with link.
+ *
+ * @since 2.0.0
+ * @deprecated Use {@link wp_get_attachment_link()}
+ * @see wp_get_attachment_link() Use instead.
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $fullsize Optional, default is false. Whether to use full size image.
+ * @param array $max_dims Optional. Max image dimensions.
+ * @param bool $permalink Optional, default is false. Whether to include permalink to image.
+ * @return string
+ */
 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
        $id = (int) $id;
        $_post = & get_post($id);
 function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false, $permalink = false) {
        $id = (int) $id;
        $_post = & get_post($id);
@@ -409,8 +818,17 @@ function get_the_attachment_link($id = 0, $fullsize = false, $max_dims = false,
        return "<a href='$url' title='$post_title'>$innerHTML</a>";
 }
 
        return "<a href='$url' title='$post_title'>$innerHTML</a>";
 }
 
-
-// deprecated: use wp_get_attachment_image_src()
+/**
+ * Retrieve icon URL and Path.
+ *
+ * @since 2.1.0
+ * @deprecated Use {@link wp_get_attachment_image_src()}
+ * @see wp_get_attachment_image_src() Use instead.
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $fullsize Optional, default to false. Whether to have full image.
+ * @return array Icon URL and full path to file, respectively.
+ */
 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
        $id = (int) $id;
        if ( !$post = & get_post($id) )
 function get_attachment_icon_src( $id = 0, $fullsize = false ) {
        $id = (int) $id;
        if ( !$post = & get_post($id) )
@@ -442,12 +860,23 @@ function get_attachment_icon_src( $id = 0, $fullsize = false ) {
        return array($src, $src_file);
 }
 
        return array($src, $src_file);
 }
 
-// deprecated: use wp_get_attachment_image()
+/**
+ * Retrieve HTML content of icon attachment image element.
+ *
+ * @since 2.0.0
+ * @deprecated Use {@link wp_get_attachment_image()}
+ * @see wp_get_attachment_image() Use instead of.
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $fullsize Optional, default to false. Whether to have full size image.
+ * @param array $max_dims Optional. Dimensions of image.
+ * @return string HTML content.
+ */
 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
        $id = (int) $id;
        if ( !$post = & get_post($id) )
                return false;
 function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
        $id = (int) $id;
        if ( !$post = & get_post($id) )
                return false;
-               
+
        if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
                return false;
 
        if ( !$src = get_attachment_icon_src( $post->ID, $fullsize ) )
                return false;
 
@@ -486,7 +915,18 @@ function get_attachment_icon( $id = 0, $fullsize = false, $max_dims = false ) {
        return apply_filters( 'attachment_icon', $icon, $post->ID );
 }
 
        return apply_filters( 'attachment_icon', $icon, $post->ID );
 }
 
-// deprecated: use wp_get_attachment_image()
+/**
+ * Retrieve HTML content of image element.
+ *
+ * @since 2.0.0
+ * @deprecated Use {@link wp_get_attachment_image()}
+ * @see wp_get_attachment_image() Use instead.
+ *
+ * @param int $id Optional. Post ID.
+ * @param bool $fullsize Optional, default to false. Whether to have full size image.
+ * @param array $max_dims Optional. Dimensions of image.
+ * @return string
+ */
 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
        $id = (int) $id;
        if ( !$post = & get_post($id) )
 function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false) {
        $id = (int) $id;
        if ( !$post = & get_post($id) )
@@ -501,6 +941,15 @@ function get_attachment_innerHTML($id = 0, $fullsize = false, $max_dims = false)
        return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
 }
 
        return apply_filters('attachment_innerHTML', $innerHTML, $post->ID);
 }
 
+/**
+ * Wrap attachment in <<p>> element before content.
+ *
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'prepend_attachment' hook on HTML content.
+ *
+ * @param string $content
+ * @return string
+ */
 function prepend_attachment($content) {
        global $post;
 
 function prepend_attachment($content) {
        global $post;
 
@@ -520,6 +969,14 @@ function prepend_attachment($content) {
 // Misc
 //
 
 // Misc
 //
 
+/**
+ * Retrieve protected post password form content.
+ *
+ * @since 1.0.0
+ * @uses apply_filters() Calls 'the_password_form' filter on output.
+ *
+ * @return string HTML content for password form for password protected post.
+ */
 function get_the_password_form() {
        global $post;
        $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
 function get_the_password_form() {
        global $post;
        $label = 'pwbox-'.(empty($post->ID) ? rand() : $post->ID);
@@ -528,19 +985,21 @@ function get_the_password_form() {
        <p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . __("Submit") . '" /></p>
        </form>
        ';
        <p><label for="' . $label . '">' . __("Password:") . ' <input name="post_password" id="' . $label . '" type="password" size="20" /></label> <input type="submit" name="Submit" value="' . __("Submit") . '" /></p>
        </form>
        ';
-       return $output;
+       return apply_filters('the_password_form', $output);
 }
 
 /**
 }
 
 /**
- * is_page_template() - Determine wether or not we are in a page template
+ * Whether currently in a page template.
+ *
+ * This template tag allows you to determine whether or not you are in a page
+ * template. You can optional provide a template name and then the check will be
+ * specific to that template.
  *
  *
- * This template tag allows you to determine wether or not you are in a page template.
- * You can optional provide a template name and then the check will be specific to
- * that template.
+ * @since 2.5.0
+ * @uses $wp_query
  *
  *
- * @package Template Tags
- * @global object $wp_query
- * @param string $template The specific template name if specific matching is required
+ * @param string $template The specific template name if specific matching is required.
+ * @return bool False on failure, true if success.
  */
 function is_page_template($template = '') {
        if (!is_page()) {
  */
 function is_page_template($template = '') {
        if (!is_page()) {
@@ -566,17 +1025,17 @@ function is_page_template($template = '') {
 }
 
 /**
 }
 
 /**
- * wp_post_revision_title() - returns formatted datetimestamp of a revision (linked to that revisions's page)
+ * Retrieve formatted date timestamp of a revision (linked to that revisions's page).
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses date_i18n()
  *
  *
  * @uses date_i18n()
  *
- * @param int|object $revision revision ID or revision object
- * @param bool $link optional Link to revisions's page?
- * @return string i18n formatted datetimestamp or localized 'Corrent Revision'
+ * @param int|object $revision Revision ID or revision object.
+ * @param bool $link Optional, default is true. Link to revisions's page?
+ * @return string i18n formatted datetimestamp or localized 'Current Revision'.
  */
 function wp_post_revision_title( $revision, $link = true ) {
        if ( !$revision = get_post( $revision ) )
  */
 function wp_post_revision_title( $revision, $link = true ) {
        if ( !$revision = get_post( $revision ) )
@@ -589,7 +1048,7 @@ function wp_post_revision_title( $revision, $link = true ) {
        $autosavef = __( '%s [Autosave]' );
        $currentf  = __( '%s [Current Revision]' );
 
        $autosavef = __( '%s [Autosave]' );
        $currentf  = __( '%s [Current Revision]' );
 
-       $date = date_i18n( $datef, strtotime( $revision->post_modified_gmt . ' +0000' ) );
+       $date = date_i18n( $datef, strtotime( $revision->post_modified ) );
        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>";
 
@@ -602,29 +1061,36 @@ function wp_post_revision_title( $revision, $link = true ) {
 }
 
 /**
 }
 
 /**
- * wp_list_post_revisions() - echoes list of a post's revisions
+ * Display list of a post's revisions.
  *
  *
- * Can output either a UL with edit links or a TABLE with diff interface, and restore action links
+ * Can output either a UL with edit links or a TABLE with diff interface, and
+ * restore action links.
  *
  * Second argument controls parameters:
  *
  * Second argument controls parameters:
- *   (bool)   parent : include the parent (the "Current Revision") in the list
- *   (string) format : 'list' or 'form-table'.  'list' outputs UL, 'form-table' outputs TABLE with UI
- *   (int)    right  : what revision is currently being viewed - used in form-table format
- *   (int)    left   : what revision is currently being diffed against right - used in form-table format
+ *   (bool)   parent : include the parent (the "Current Revision") in the list.
+ *   (string) format : 'list' or 'form-table'.  'list' outputs UL, 'form-table'
+ *                     outputs TABLE with UI.
+ *   (int)    right  : what revision is currently being viewed - used in
+ *                     form-table format.
+ *   (int)    left   : what revision is currently being diffed against right -
+ *                     used in form-table format.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses wp_get_post_revisions()
  * @uses wp_post_revision_title()
  * @uses get_edit_post_link()
  * @uses get_author_name()
  *
  *
  * @uses wp_get_post_revisions()
  * @uses wp_post_revision_title()
  * @uses get_edit_post_link()
  * @uses get_author_name()
  *
- * @param int|object $post_id post ID or post object
- * @param string|array $args see description @see wp_parse_args()
+ * @todo split into two functions (list, form-table) ?
+ *
+ * @param int|object $post_id Post ID or post object.
+ * @param string|array $args See description {@link wp_parse_args()}.
+ * @return null
  */
  */
-function wp_list_post_revisions( $post_id = 0, $args = null ) { // TODO? split into two functions (list, form-table) ?
+function wp_list_post_revisions( $post_id = 0, $args = null ) {
        if ( !$post = get_post( $post_id ) )
                return;
 
        if ( !$post = get_post( $post_id ) )
                return;
 
@@ -701,7 +1167,7 @@ function wp_list_post_revisions( $post_id = 0, $args = null ) { // TODO? split i
 
 <br class="clear" />
 
 
 <br class="clear" />
 
-<table class="widefat post-revisions">
+<table class="widefat post-revisions" cellspacing="0">
        <col />
        <col style="width: 33%" />
        <col style="width: 33%" />
        <col />
        <col style="width: 33%" />
        <col style="width: 33%" />
index 32526400baedfde00c815d022c2548a7d3e1d519..605c24511eb781c3442c77a62674124d9acd5cba 100644 (file)
@@ -2,13 +2,9 @@
 /**
  * Post functions and post utility function.
  *
 /**
  * Post functions and post utility function.
  *
- * Warning: The inline documentation for the functions contained
- * in this file might be inaccurate, so the documentation is not
- * authoritative at the moment.
- *
  * @package WordPress
  * @subpackage Post
  * @package WordPress
  * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  */
 
 /**
  */
 
 /**
  * prevent looking up the meta name and provide a mechanism for sending the
  * attached filename through a filter.
  *
  * prevent looking up the meta name and provide a mechanism for sending the
  * attached filename through a filter.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
- * @uses apply_filters() Calls 'get_attached_file' on file path and attachment ID
+ * @since 2.0.0
+ * @uses apply_filters() Calls 'get_attached_file' on file path and attachment ID.
  *
  *
- * @param int $attachment_id Attachment ID
- * @param bool $unfiltered Whether to apply filters or not
+ * @param int $attachment_id Attachment ID.
+ * @param bool $unfiltered Whether to apply filters or not.
  * @return string The file path to the attached file.
  */
 function get_attached_file( $attachment_id, $unfiltered = false ) {
        $file = get_post_meta( $attachment_id, '_wp_attached_file', true );
  * @return string The file path to the attached file.
  */
 function get_attached_file( $attachment_id, $unfiltered = false ) {
        $file = get_post_meta( $attachment_id, '_wp_attached_file', true );
+       // If the file is relative, prepend upload dir
+       if ( 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
+               $file = $uploads['basedir'] . "/$file";
        if ( $unfiltered )
                return $file;
        return apply_filters( 'get_attached_file', $file, $attachment_id );
        if ( $unfiltered )
                return $file;
        return apply_filters( 'get_attached_file', $file, $attachment_id );
@@ -44,10 +41,8 @@ function get_attached_file( $attachment_id, $unfiltered = false ) {
  * Used to update the file path of the attachment, which uses post meta name
  * '_wp_attached_file' to store the path of the attachment.
  *
  * Used to update the file path of the attachment, which uses post meta name
  * '_wp_attached_file' to store the path of the attachment.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
- * @uses apply_filters() Calls 'update_attached_file' on file path and attachment ID
+ * @since 2.1.0
+ * @uses apply_filters() Calls 'update_attached_file' on file path and attachment ID.
  *
  * @param int $attachment_id Attachment ID
  * @param string $file File path for the attachment
  *
  * @param int $attachment_id Attachment ID
  * @param string $file File path for the attachment
@@ -59,6 +54,14 @@ function update_attached_file( $attachment_id, $file ) {
 
        $file = apply_filters( 'update_attached_file', $file, $attachment_id );
 
 
        $file = apply_filters( 'update_attached_file', $file, $attachment_id );
 
+       // Make the file path relative to the upload dir
+       if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { // Get upload directory
+               if ( 0 === strpos($file, $uploads['basedir']) ) {// Check that the upload base exists in the file path
+                               $file = str_replace($uploads['basedir'], '', $file); // Remove upload dir from the file path
+                               $file = ltrim($file, '/');
+               }
+       }
+
        return update_post_meta( $attachment_id, '_wp_attached_file', $file );
 }
 
        return update_post_meta( $attachment_id, '_wp_attached_file', $file );
 }
 
@@ -79,10 +82,11 @@ function update_attached_file( $attachment_id, $file ) {
  * example of what is possible.
  *
  * The arguments listed as defaults are for this function and also of the
  * example of what is possible.
  *
  * The arguments listed as defaults are for this function and also of the
- * get_posts() function. The arguments are combined with the get_children
- * defaults and are then passed to the get_posts() function, which accepts
- * additional arguments. You can replace the defaults in this function, listed
- * below and the additional arguments listed in the get_posts() function.
+ * {@link get_posts()} function. The arguments are combined with the
+ * get_children defaults and are then passed to the {@link get_posts()}
+ * function, which accepts additional arguments. You can replace the defaults in
+ * this function, listed below and the additional arguments listed in the
+ * {@link get_posts()} function.
  *
  * The 'post_parent' is the most important argument and important attention
  * needs to be paid to the $args parameter. If you pass either an object or an
  *
  * The 'post_parent' is the most important argument and important attention
  * needs to be paid to the $args parameter. If you pass either an object or an
@@ -103,9 +107,7 @@ function update_attached_file( $attachment_id, $file ) {
  * @see get_posts() Has additional arguments that can be replaced.
  * @internal Claims made in the long description might be inaccurate.
  *
  * @see get_posts() Has additional arguments that can be replaced.
  * @internal Claims made in the long description might be inaccurate.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
+ * @since 2.0.0
  *
  * @param mixed $args Optional. User defined arguments for replacing the defaults.
  * @param string $output Optional. Constant for return type, either OBJECT (default), ARRAY_A, ARRAY_N.
  *
  * @param mixed $args Optional. User defined arguments for replacing the defaults.
  * @param string $output Optional. Constant for return type, either OBJECT (default), ARRAY_A, ARRAY_N.
@@ -125,15 +127,17 @@ function &get_children($args = '', $output = OBJECT) {
        }
 
        $defaults = array(
        }
 
        $defaults = array(
-               'numberposts' => -1, 'post_type' => '',
-               'post_status' => '', 'post_parent' => 0
+               'numberposts' => -1, 'post_type' => 'any',
+               'post_status' => 'any', 'post_parent' => 0,
        );
 
        $r = wp_parse_args( $args, $defaults );
 
        $children = get_posts( $r );
        );
 
        $r = wp_parse_args( $args, $defaults );
 
        $children = get_posts( $r );
-       if ( !$children )
-               return false;
+       if ( !$children ) {
+               $kids = false;
+               return $kids;
+       }
 
        update_post_cache($children);
 
 
        update_post_cache($children);
 
@@ -143,11 +147,11 @@ function &get_children($args = '', $output = OBJECT) {
        if ( $output == OBJECT ) {
                return $kids;
        } elseif ( $output == ARRAY_A ) {
        if ( $output == OBJECT ) {
                return $kids;
        } elseif ( $output == ARRAY_A ) {
-               foreach ( $kids as $kid )
+               foreach ( (array) $kids as $kid )
                        $weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]);
                return $weeuns;
        } elseif ( $output == ARRAY_N ) {
                        $weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]);
                return $weeuns;
        } elseif ( $output == ARRAY_N ) {
-               foreach ( $kids as $kid )
+               foreach ( (array) $kids as $kid )
                        $babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID]));
                return $babes;
        } else {
                        $babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID]));
                return $babes;
        } else {
@@ -156,16 +160,20 @@ function &get_children($args = '', $output = OBJECT) {
 }
 
 /**
 }
 
 /**
- * get_extended() - Get extended entry info (<!--more-->)
+ * Get extended entry info (<!--more-->).
  *
  *
- * {@internal Missing Long Description}}
+ * There should not be any space after the second dash and before the word
+ * 'more'. There can be text or space(s) after the word 'more', but won't be
+ * referenced.
+ *
+ * The returned array has 'main' and 'extended' keys. Main has the text before
+ * the <code><!--more--></code>. The 'extended' key has the content after the
+ * <code><!--more--></code> comment.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.0.0
  *
  * @since 1.0.0
  *
- * @param string $post {@internal Missing Description}}
- * @return array {@internal Missing Description}}
+ * @param string $post Post content.
+ * @return array Post before ('main') and after ('extended').
  */
 function get_extended($post) {
        //Match the new style more links
  */
 function get_extended($post) {
        //Match the new style more links
@@ -184,20 +192,19 @@ function get_extended($post) {
 }
 
 /**
 }
 
 /**
- * get_post() - Retrieves post data given a post ID or post object.
+ * Retrieves post data given a post ID or post object.
  *
  *
- * {@internal Missing Long Description}}
+ * See {@link sanitize_post()} for optional $filter values. Also, the parameter
+ * $post, must be given as a variable, since it is passed by reference.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.5.1
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/get_post
  *
  * @since 1.5.1
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/get_post
  *
- * @param int|object &$post post ID or post object
- * @param string $output {@internal Missing Description}}
- * @param string $filter {@internal Missing Description}}
- * @return mixed {@internal Missing Description}}
+ * @param int|object $post Post ID or post object.
+ * @param string $output Optional, default is Object. Either OBJECT, ARRAY_A, or ARRAY_N.
+ * @param string $filter Optional, default is raw.
+ * @return mixed Post data
  */
 function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
        global $wpdb;
  */
 function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
        global $wpdb;
@@ -208,14 +215,16 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
                        $_post = & $GLOBALS['post'];
                else
                        return $null;
                        $_post = & $GLOBALS['post'];
                else
                        return $null;
-       } elseif ( is_object($post) ) {
+       } elseif ( is_object($post) && empty($post->filter) ) {
                _get_post_ancestors($post);
                wp_cache_add($post->ID, $post, 'posts');
                $_post = &$post;
        } else {
                _get_post_ancestors($post);
                wp_cache_add($post->ID, $post, 'posts');
                $_post = &$post;
        } else {
+               if ( is_object($post) )
+                       $post = $post->ID;
                $post = (int) $post;
                if ( ! $_post = wp_cache_get($post, 'posts') ) {
                $post = (int) $post;
                if ( ! $_post = wp_cache_get($post, 'posts') ) {
-                       $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post));
+                       $_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post));
                        if ( ! $_post )
                                return $null;
                        _get_post_ancestors($_post);
                        if ( ! $_post )
                                return $null;
                        _get_post_ancestors($_post);
@@ -241,9 +250,7 @@ function &get_post(&$post, $output = OBJECT, $filter = 'raw') {
 /**
  * Retrieve ancestors of a post.
  *
 /**
  * Retrieve ancestors of a post.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
+ * @since 2.5.0
  *
  * @param int|object $post Post ID or post object
  * @return array Ancestor IDs or empty array if none are found.
  *
  * @param int|object $post Post ID or post object
  * @return array Ancestor IDs or empty array if none are found.
@@ -266,9 +273,7 @@ function get_post_ancestors($post) {
  * The context values are based off of the taxonomy filter functions and
  * supported values are found within those functions.
  *
  * The context values are based off of the taxonomy filter functions and
  * supported values are found within those functions.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * @since 2.3.0
  * @uses sanitize_post_field() See for possible $context values.
  *
  * @param string $field Post field name
  * @uses sanitize_post_field() See for possible $context values.
  *
  * @param string $field Post field name
@@ -298,9 +303,7 @@ function get_post_field( $field, $post, $context = 'display' ) {
  * This function can be used with any post type, but it makes more sense with
  * attachments.
  *
  * This function can be used with any post type, but it makes more sense with
  * attachments.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
+ * @since 2.0.0
  *
  * @param int $ID Optional. Post ID.
  * @return bool|string False on failure or returns the mime type
  *
  * @param int $ID Optional. Post ID.
  * @return bool|string False on failure or returns the mime type
@@ -320,9 +323,7 @@ function get_post_mime_type($ID = '') {
  * If the post ID is of an attachment, then the parent post status will be given
  * instead.
  *
  * If the post ID is of an attachment, then the parent post status will be given
  * instead.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
+ * @since 2.0.0
  *
  * @param int $ID Post ID
  * @return string|bool Post status or false on failure.
  *
  * @param int $ID Post ID
  * @return string|bool Post status or false on failure.
@@ -346,9 +347,7 @@ function get_post_status($ID = '') {
  * Posts have a limited set of valid status values, this provides the
  * post_status values and descriptions.
  *
  * Posts have a limited set of valid status values, this provides the
  * post_status values and descriptions.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
+ * @since 2.5.0
  *
  * @return array List of post statuses.
  */
  *
  * @return array List of post statuses.
  */
@@ -369,9 +368,7 @@ function get_post_statuses( ) {
  * Pages have a limited set of valid status values, this provides the
  * post_status values and descriptions.
  *
  * Pages have a limited set of valid status values, this provides the
  * post_status values and descriptions.
  *
- * @package WordPress
- * @subpackage Page
- * @since 2.5
+ * @since 2.5.0
  *
  * @return array List of page statuses.
  */
  *
  * @return array List of page statuses.
  */
@@ -386,19 +383,15 @@ function get_page_statuses( ) {
 }
 
 /**
 }
 
 /**
- * get_post_type() - Returns post type
- *
- * {@internal Missing Long Description}}
+ * Retrieve the post type of the current post or of a given post.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  * @uses $wpdb
  *
  * @uses $wpdb
- * @uses $posts {@internal Missing Description}}
+ * @uses $posts The Loop post global
  *
  *
- * @param mixed $post post object or post ID
- * @return mixed post type or false
+ * @param mixed $post Optional. Post object or post ID.
+ * @return bool|string post type or false on failure.
  */
 function get_post_type($post = false) {
        global $posts;
  */
 function get_post_type($post = false) {
        global $posts;
@@ -415,20 +408,17 @@ function get_post_type($post = false) {
 }
 
 /**
 }
 
 /**
- * set_post_type() - Set post type
+ * Updates the post type for the post ID.
  *
  *
- * {@internal Missing Long Description}}
+ * The page or post cache will be cleaned for the post ID.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
+ * @since 2.5.0
  *
  * @uses $wpdb
  *
  * @uses $wpdb
- * @uses $posts {@internal Missing Description}}
  *
  *
- * @param mixed $post_id post ID
- * @param mixed post type
- * @return bool {@internal Missing Description}}
+ * @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.
+ * @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;
  */
 function set_post_type( $post_id = 0, $post_type = 'post' ) {
        global $wpdb;
@@ -445,18 +435,29 @@ function set_post_type( $post_id = 0, $post_type = 'post' ) {
 }
 
 /**
 }
 
 /**
- * get_posts() - Returns a number of posts
+ * Retrieve list of latest posts or posts matching criteria.
  *
  *
- * {@internal Missing Long Description}}
+ * The defaults are as follows:
+ *     'numberposts' - Default is 5. Total number of posts to retrieve.
+ *     'offset' - Default is 0. See {@link WP_Query::query()} for more.
+ *     'category' - What category to pull the posts from.
+ *     'orderby' - Default is 'post_date'. How to order the posts.
+ *     'order' - Default is 'DESC'. The order to retrieve the posts.
+ *     'include' - See {@link WP_Query::query()} for more.
+ *     'exclude' - See {@link WP_Query::query()} for more.
+ *     'meta_key' - See {@link WP_Query::query()} for more.
+ *     'meta_value' - See {@link WP_Query::query()} for more.
+ *     'post_type' - Default is 'post'. Can be 'page', or 'attachment' to name a few.
+ *     'post_parent' - The parent of the post or post type.
+ *     'post_status' - Default is 'published'. Post status to retrieve.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.2
+ * @since 1.2.0
  * @uses $wpdb
  * @uses $wpdb
+ * @uses WP_Query::query() See for more default arguments and information.
  * @link http://codex.wordpress.org/Template_Tags/get_posts
  *
  * @link http://codex.wordpress.org/Template_Tags/get_posts
  *
- * @param array $args {@internal Missing Description}}
- * @return array {@internal Missing Description}}
+ * @param array $args Optional. Override defaults.
+ * @return array List of posts.
  */
 function get_posts($args = null) {
        $defaults = array(
  */
 function get_posts($args = null) {
        $defaults = array(
@@ -465,7 +466,7 @@ function get_posts($args = null) {
                'order' => 'DESC', 'include' => '',
                'exclude' => '', 'meta_key' => '',
                'meta_value' =>'', 'post_type' => 'post',
                'order' => 'DESC', 'include' => '',
                'exclude' => '', 'meta_key' => '',
                'meta_value' =>'', 'post_type' => 'post',
-               'post_parent' => 0, 'suppress_filters' => true
+               'suppress_filters' => true
        );
 
        $r = wp_parse_args( $args, $defaults );
        );
 
        $r = wp_parse_args( $args, $defaults );
@@ -482,6 +483,8 @@ function get_posts($args = null) {
        } elseif ( ! empty($r['exclude']) )
                $r['post__not_in'] = preg_split('/[\s,]+/',$r['exclude']);
 
        } elseif ( ! empty($r['exclude']) )
                $r['post__not_in'] = preg_split('/[\s,]+/',$r['exclude']);
 
+       $r['caller_get_posts'] = true;
+
        $get_posts = new WP_Query;
        return $get_posts->query($r);
 
        $get_posts = new WP_Query;
        return $get_posts->query($r);
 
@@ -492,21 +495,19 @@ function get_posts($args = null) {
 //
 
 /**
 //
 
 /**
- * add_post_meta() - adds metadata for post
+ * Add meta data field to a post.
  *
  *
- * {@internal Missing Long Description}}
+ * Post meta data is called "Custom Fields" on the Administration Panels.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/add_post_meta
  *
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/add_post_meta
  *
- * @param int $post_id post ID
- * @param string $key {@internal Missing Description}}
- * @param mixed $value {@internal Missing Description}}
- * @param bool $unique whether to check for a value with the same key
- * @return bool {@internal Missing Description}}
+ * @param int $post_id Post ID.
+ * @param string $key Metadata name.
+ * @param mixed $value Metadata value.
+ * @param bool $unique Optional, default is false. Whether the same key should not be added.
+ * @return bool False for failure. True for success.
  */
 function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
        global $wpdb;
  */
 function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
        global $wpdb;
@@ -521,7 +522,7 @@ function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
        if ( $unique && $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) )
                return false;
 
        if ( $unique && $wpdb->get_var( $wpdb->prepare( "SELECT meta_key FROM $wpdb->postmeta WHERE meta_key = %s AND post_id = %d", $meta_key, $post_id ) ) )
                return false;
 
-       $meta_value = maybe_serialize($meta_value);
+       $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
 
        $wpdb->insert( $wpdb->postmeta, compact( 'post_id', 'meta_key', 'meta_value' ) );
 
 
        $wpdb->insert( $wpdb->postmeta, compact( 'post_id', 'meta_key', 'meta_value' ) );
 
@@ -531,42 +532,44 @@ function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
 }
 
 /**
 }
 
 /**
- * delete_post_meta() - delete post metadata
+ * Remove metadata matching criteria from a post.
  *
  *
- * {@internal Missing Long Description}}
+ * You can match based on the key, or key and value. Removing based on key and
+ * value, will keep from removing duplicate metadata with the same key. It also
+ * allows removing all metadata matching key, if needed.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/delete_post_meta
  *
  * @param int $post_id post ID
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/delete_post_meta
  *
  * @param int $post_id post ID
- * @param string $key {@internal Missing Description}}
- * @param mixed $value {@internal Missing Description}}
- * @return bool {@internal Missing Description}}
+ * @param string $meta_key Metadata name.
+ * @param mixed $meta_value Optional. Metadata value.
+ * @return bool False for failure. True for success.
  */
  */
-function delete_post_meta($post_id, $key, $value = '') {
+function delete_post_meta($post_id, $meta_key, $meta_value = '') {
        global $wpdb;
 
        global $wpdb;
 
-       $post_id = absint( $post_id );
+       // make sure meta is added to the post, not a revision
+       if ( $the_post = wp_is_post_revision($post_id) )
+               $post_id = $the_post;
 
 
-       // expected_slashed ($key, $value)
-       $key = stripslashes( $key );
-       $value = stripslashes( $value );
+       // expected_slashed ($meta_key, $meta_value)
+       $meta_key = stripslashes( $meta_key );
+       $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
 
 
-       if ( empty( $value ) )
-               $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $key ) );
+       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
        else
-               $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $key, $value ) );
+               $meta_id = $wpdb->get_var( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $meta_key, $meta_value ) );
 
        if ( !$meta_id )
                return false;
 
 
        if ( !$meta_id )
                return false;
 
-       if ( empty( $value ) )
-               $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $key ) );
+       if ( empty( $meta_value ) )
+               $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s", $post_id, $meta_key ) );
        else
        else
-               $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $key, $value ) );
+               $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = %s AND meta_value = %s", $post_id, $meta_key, $meta_value ) );
 
        wp_cache_delete($post_id, 'post_meta');
 
 
        wp_cache_delete($post_id, 'post_meta');
 
@@ -574,20 +577,16 @@ function delete_post_meta($post_id, $key, $value = '') {
 }
 
 /**
 }
 
 /**
- * get_post_meta() - Get a post meta field
- *
- * {@internal Missing Long Description}}
+ * Retrieve post meta field for a post.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/get_post_meta
  *
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/get_post_meta
  *
- * @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 {@internal Missing Description}}
+ * @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.
  */
 function get_post_meta($post_id, $key, $single = false) {
        $post_id = (int) $post_id;
  */
 function get_post_meta($post_id, $key, $single = false) {
        $post_id = (int) $post_id;
@@ -611,25 +610,30 @@ function get_post_meta($post_id, $key, $single = false) {
 }
 
 /**
 }
 
 /**
- * update_post_meta() - Update a post meta field
+ * Update post meta field based on post ID.
  *
  *
- * {@internal Missing Long Description}}
+ * Use the $prev_value parameter to differentiate between meta fields with the
+ * same key and post ID.
+ *
+ * If the meta field for the post does not exist, it will be added.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.5
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/update_post_meta
  *
  * @since 1.5
  * @uses $wpdb
  * @link http://codex.wordpress.org/Function_Reference/update_post_meta
  *
- * @param int $post_id post ID
- * @param string $key {@internal Missing Description}}
- * @param mixed $value {@internal Missing Description}}
- * @param mixed $prev_value previous value (for differentiating between meta fields with the same key and post ID)
- * @return bool {@internal Missing Description}}
+ * @param int $post_id Post ID.
+ * @param string $key Metadata key.
+ * @param mixed $value Metadata value.
+ * @param mixed $prev_value Optional. Previous value to check before removing.
+ * @return bool False on failure, true if success.
  */
 function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
        global $wpdb;
 
  */
 function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
        global $wpdb;
 
+       // make sure meta is added to the post, not a revision
+       if ( $the_post = wp_is_post_revision($post_id) )
+               $post_id = $the_post;
+
        // expected_slashed ($meta_key)
        $meta_key = stripslashes($meta_key);
 
        // expected_slashed ($meta_key)
        $meta_key = stripslashes($meta_key);
 
@@ -637,7 +641,7 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
                return add_post_meta($post_id, $meta_key, $meta_value);
        }
 
                return add_post_meta($post_id, $meta_key, $meta_value);
        }
 
-       $meta_value = maybe_serialize($meta_value);
+       $meta_value = maybe_serialize( stripslashes_deep($meta_value) );
 
        $data  = compact( 'meta_value' );
        $where = compact( 'meta_key', 'post_id' );
 
        $data  = compact( 'meta_value' );
        $where = compact( 'meta_key', 'post_id' );
@@ -653,14 +657,12 @@ function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
 }
 
 /**
 }
 
 /**
- * delete_post_meta_by_key() - Delete everything from post meta matching $post_meta_key
+ * Delete everything from post meta matching meta key.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param string $post_meta_key What to search for when deleting
+ * @param string $post_meta_key Key to search for when deleting.
  * @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) {
@@ -674,20 +676,19 @@ function delete_post_meta_by_key($post_meta_key) {
 }
 
 /**
 }
 
 /**
- * get_post_custom() - Retrieve post custom fields
+ * Retrieve post meta fields, based on post ID.
  *
  *
- * {@internal Missing Long Description}}
+ * The post meta fields are retrieved from the cache, so the function is
+ * optimized to be called more than once. It also applies to the functions, that
+ * use this function.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.2
+ * @since 1.2.0
  * @link http://codex.wordpress.org/Function_Reference/get_post_custom
  *
  * @link http://codex.wordpress.org/Function_Reference/get_post_custom
  *
- * @uses $id
- * @uses $wpdb
+ * @uses $id Current Loop Post ID
  *
  * @param int $post_id post ID
  *
  * @param int $post_id post ID
- * @return array {@internal Missing Description}}
+ * @return array
  */
 function get_post_custom($post_id = 0) {
        global $id;
  */
 function get_post_custom($post_id = 0) {
        global $id;
@@ -704,15 +705,15 @@ function get_post_custom($post_id = 0) {
 }
 
 /**
 }
 
 /**
- * get_post_custom_keys() - Retrieve post custom field names
+ * Retrieve meta field names for a post.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.2
+ * If there are no meta fields, then nothing (null) will be returned.
+ *
+ * @since 1.2.0
  * @link http://codex.wordpress.org/Function_Reference/get_post_custom_keys
  *
  * @param int $post_id post ID
  * @link http://codex.wordpress.org/Function_Reference/get_post_custom_keys
  *
  * @param int $post_id post ID
- * @return array|null Either array of the keys, or null if keys would not be retrieved
+ * @return array|null Either array of the keys, or null if keys could not be retrieved.
  */
 function get_post_custom_keys( $post_id = 0 ) {
        $custom = get_post_custom( $post_id );
  */
 function get_post_custom_keys( $post_id = 0 ) {
        $custom = get_post_custom( $post_id );
@@ -725,63 +726,99 @@ function get_post_custom_keys( $post_id = 0 ) {
 }
 
 /**
 }
 
 /**
- * get_post_custom_values() - Retrieve values for a custom post field
+ * Retrieve values for a custom post field.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.2
+ * The parameters must not be considered optional. All of the post meta fields
+ * will be retrieved and only the meta field key values returned.
+ *
+ * @since 1.2.0
  * @link http://codex.wordpress.org/Function_Reference/get_post_custom_values
  *
  * @link http://codex.wordpress.org/Function_Reference/get_post_custom_values
  *
- * @param string $key field name
- * @param int $post_id post ID
- * @return mixed {@internal Missing Description}}
+ * @param string $key Meta field key.
+ * @param int $post_id Post ID
+ * @return array Meta field values.
  */
 function get_post_custom_values( $key = '', $post_id = 0 ) {
        $custom = get_post_custom($post_id);
 
  */
 function get_post_custom_values( $key = '', $post_id = 0 ) {
        $custom = get_post_custom($post_id);
 
-       return $custom[$key];
+       return isset($custom[$key]) ? $custom[$key] : null;
 }
 
 /**
 }
 
 /**
- * sanitize_post() - Sanitize every post field
+ * Check if post is sticky.
  *
  *
- * {@internal Missing Long Description}}
+ * Sticky posts should remain at the top of The Loop. If the post ID is not
+ * given, then The Loop ID for the current post will be used.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * @since 2.7.0
+ *
+ * @param int $post_id Optional. Post ID.
+ * @return bool Whether post is sticky (true) or not sticky (false).
+ */
+function is_sticky($post_id = null) {
+       global $id;
+
+       $post_id = absint($post_id);
+
+       if ( !$post_id )
+               $post_id = absint($id);
+
+       $stickies = get_option('sticky_posts');
+
+       if ( !is_array($stickies) )
+               return false;
+
+       if ( in_array($post_id, $stickies) )
+               return true;
+
+       return false;
+}
+
+/**
+ * Sanitize every post field.
+ *
+ * If the context is 'raw', then the post object or array will just be returned.
+ *
+ * @since 2.3.0
+ * @uses sanitize_post_field() Used to sanitize the fields.
  *
  * @param object|array $post The Post Object or Array
  *
  * @param object|array $post The Post Object or Array
- * @param string $context How to sanitize post fields
+ * @param string $context Optional, default is 'display'. How to sanitize post fields.
  * @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) ) {
  * @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;
                foreach ( array_keys(get_object_vars($post)) as $field )
                        $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
                foreach ( array_keys(get_object_vars($post)) as $field )
                        $post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
+               $post->filter = $context;
        } else {
        } else {
+               if ( !isset($post['ID']) )
+                       $post['ID'] = 0;
                foreach ( array_keys($post) as $field )
                        $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
                foreach ( array_keys($post) as $field )
                        $post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
+               $post['filter'] = $context;
        }
        }
+
        return $post;
 }
 
 /**
        return $post;
 }
 
 /**
- * sanitize_post_field() - Sanitize post field based on context
+ * Sanitize post field based on context.
  *
  *
- * {@internal Missing Long Description}}
+ * Possible context values are: raw, edit, db, attribute, js, and display. The
+ * display context is used by default.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * @since 2.3.0
  *
  *
- * @param string $field The Post Object field name
- * @param string $value The Post Object value
- * @param int $postid Post ID
- * @param string $context How to sanitize post fields
- * @return string Sanitized value
+ * @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.
+ * @return mixed Sanitized value.
  */
 function sanitize_post_field($field, $value, $post_id, $context) {
        $int_fields = array('ID', 'post_parent', 'menu_order');
  */
 function sanitize_post_field($field, $value, $post_id, $context) {
        $int_fields = array('ID', 'post_parent', 'menu_order');
@@ -840,6 +877,54 @@ function sanitize_post_field($field, $value, $post_id, $context) {
        return $value;
 }
 
        return $value;
 }
 
+/**
+ * Make a post sticky.
+ *
+ * Sticky posts should be displayed at the top of the front page.
+ *
+ * @since 2.7.0
+ *
+ * @param int $post_id Post ID.
+ */
+function stick_post($post_id) {
+       $stickies = get_option('sticky_posts');
+
+       if ( !is_array($stickies) )
+               $stickies = array($post_id);
+
+       if ( ! in_array($post_id, $stickies) )
+               $stickies[] = $post_id;
+
+       update_option('sticky_posts', $stickies);
+}
+
+/**
+ * Unstick a post.
+ *
+ * Sticky posts should be displayed at the top of the front page.
+ *
+ * @since 2.7.0
+ *
+ * @param int $post_id Post ID.
+ */
+function unstick_post($post_id) {
+       $stickies = get_option('sticky_posts');
+
+       if ( !is_array($stickies) )
+               return;
+
+       if ( ! in_array($post_id, $stickies) )
+               return;
+
+       $offset = array_search($post_id, $stickies);
+       if ( false === $offset )
+               return;
+
+       array_splice($stickies, $offset, 1);
+
+       update_option('sticky_posts', $stickies);
+}
+
 /**
  * Count number of posts of a post type and is user has permissions to view.
  *
 /**
  * Count number of posts of a post type and is user has permissions to view.
  *
@@ -851,9 +936,7 @@ function sanitize_post_field($field, $value, $post_id, $context) {
  * The $perm parameter checks for 'readable' value and if the user can read
  * private posts, it will display that for the user that is signed in.
  *
  * The $perm parameter checks for 'readable' value and if the user can read
  * private posts, it will display that for the user that is signed in.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
+ * @since 2.5.0
  * @link http://codex.wordpress.org/Template_Tags/wp_count_posts
  *
  * @param string $type Optional. Post type to retrieve count
  * @link http://codex.wordpress.org/Template_Tags/wp_count_posts
  *
  * @param string $type Optional. Post type to retrieve count
@@ -895,18 +978,18 @@ function wp_count_posts( $type = 'post', $perm = '' ) {
 
 
 /**
 
 
 /**
- * wp_count_attachments() - Count number of attachments
+ * Count number of attachments for the mime type(s).
  *
  *
- * {@internal Missing Long Description}}
+ * If you set the optional mime_type parameter, then an array will still be
+ * returned, but will only have the item you are looking for. It does not give
+ * you the number of attachments that are children of a post. You can get that
+ * by counting the number of children that post has.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
+ * @since 2.5.0
  *
  *
- * @param string|array $post_mime_type Array or comma-separated list of MIME patterns
- * @return array Number of posts for each post_mime_type
+ * @param string|array $mime_type Optional. Array or comma-separated list of MIME patterns.
+ * @return array Number of posts for each mime type.
  */
  */
-
 function wp_count_attachments( $mime_type = '' ) {
        global $wpdb;
 
 function wp_count_attachments( $mime_type = '' ) {
        global $wpdb;
 
@@ -922,13 +1005,13 @@ function wp_count_attachments( $mime_type = '' ) {
 }
 
 /**
 }
 
 /**
- * wp_match_mime_type() - Check a MIME-Type against a list
+ * Check a MIME-Type against a list.
  *
  *
- * {@internal Missing Long Description}}
+ * If the wildcard_mime_types parameter is a string, it must be comma separated
+ * list. If the real_mime_types is a string, it is also comma separated to
+ * create the list.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
+ * @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 $real_mime_types post_mime_type values
  *
  * @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
@@ -959,14 +1042,12 @@ function wp_match_mime_types($wildcard_mime_types, $real_mime_types) {
 }
 
 /**
 }
 
 /**
- * wp_get_post_mime_type_where() - Convert MIME types into SQL
+ * Convert MIME types into SQL.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
+ * @since 2.5.0
  *
  *
- * @param string|array $mime_types MIME types
- * @return string SQL AND clause
+ * @param string|array $mime_types List of mime types or comma separated string of mime types.
+ * @return string The SQL AND clause for mime searching.
  */
 function wp_post_mime_type_where($post_mime_types) {
        $where = '';
  */
 function wp_post_mime_type_where($post_mime_types) {
        $where = '';
@@ -1006,16 +1087,16 @@ function wp_post_mime_type_where($post_mime_types) {
 }
 
 /**
 }
 
 /**
- * wp_delete_post() - Deletes a Post
+ * Removes a post, attachment, or page.
  *
  *
- * {@internal Missing Long Description}}
+ * When the post and page goes, everything that is tied to it is deleted also.
+ * This includes comments, post meta fields, and terms associated with the post.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.0.0
  * @since 1.0.0
+ * @uses do_action() Calls 'deleted_post' hook on post ID.
  *
  *
- * @param int $postid post ID
- * @return mixed {@internal Missing Description}}
+ * @param int $postid Post ID.
+ * @return mixed
  */
 function wp_delete_post($postid = 0) {
        global $wpdb, $wp_rewrite;
  */
 function wp_delete_post($postid = 0) {
        global $wpdb, $wp_rewrite;
@@ -1084,20 +1165,18 @@ function wp_delete_post($postid = 0) {
 }
 
 /**
 }
 
 /**
- * wp_get_post_categories() - Retrieve the list of categories for a post
+ * Retrieve the list of categories for a post.
  *
  * Compatibility layer for themes and plugins. Also an easy layer of abstraction
  * away from the complexity of the taxonomy layer.
  *
  *
  * Compatibility layer for themes and plugins. Also an easy layer of abstraction
  * away from the complexity of the taxonomy layer.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  *
- * @uses wp_get_object_terms() Retrieves the categories. Args details can be found here
+ * @uses wp_get_object_terms() Retrieves the categories. Args details can be found here.
  *
  *
- * @param int $post_id Optional. The Post ID
- * @param array $args Optional. Overwrite the defaults
- * @return array {@internal Missing Description}}
+ * @param int $post_id Optional. The Post ID.
+ * @param array $args Optional. Overwrite the defaults.
+ * @return array
  */
 function wp_get_post_categories( $post_id = 0, $args = array() ) {
        $post_id = (int) $post_id;
  */
 function wp_get_post_categories( $post_id = 0, $args = array() ) {
        $post_id = (int) $post_id;
@@ -1110,17 +1189,21 @@ function wp_get_post_categories( $post_id = 0, $args = array() ) {
 }
 
 /**
 }
 
 /**
- * wp_get_post_tags() - Retrieve the post tags
+ * 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
+ * {@link wp_get_object_terms()}.
  *
  * @package WordPress
  * @subpackage Post
  *
  * @package WordPress
  * @subpackage Post
- * @since 2.3
+ * @since 2.3.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 array $args Optional. Overwrite the defaults
  *
  * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here
  *
  * @param int $post_id Optional. The Post ID
  * @param array $args Optional. Overwrite the defaults
- * @return mixed The tags the post has currently
+ * @return array List of post tags.
  */
 function wp_get_post_tags( $post_id = 0, $args = array() ) {
        $post_id = (int) $post_id;
  */
 function wp_get_post_tags( $post_id = 0, $args = array() ) {
        $post_id = (int) $post_id;
@@ -1134,16 +1217,13 @@ function wp_get_post_tags( $post_id = 0, $args = array() ) {
 }
 
 /**
 }
 
 /**
- * wp_get_recent_posts() - Get the $num most recent posts
- *
- * {@internal Missing Long Description}}
+ * Retrieve number of recent posts.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.0.0
  * @since 1.0.0
+ * @uses $wpdb
  *
  *
- * @param int $num number of posts to get
- * @return array {@internal Missing Description}}
+ * @param int $num Optional, default is 10. Number of posts to get.
+ * @return array List of posts.
  */
 function wp_get_recent_posts($num = 10) {
        global $wpdb;
  */
 function wp_get_recent_posts($num = 10) {
        global $wpdb;
@@ -1157,21 +1237,19 @@ function wp_get_recent_posts($num = 10) {
        $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
        $result = $wpdb->get_results($sql,ARRAY_A);
 
        $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit";
        $result = $wpdb->get_results($sql,ARRAY_A);
 
-       return $result?$result:array();
+       return $result ? $result : array();
 }
 
 /**
 }
 
 /**
- * wp_get_single_post() - Get one post
+ * Retrieve a single post, based on post ID.
  *
  *
- * {@internal Missing Long Description}}
+ * Has categories in 'post_category' property or key. Has tags in 'tags_input'
+ * property or key.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.0.0
  * @since 1.0.0
- * @uses $wpdb
  *
  *
- * @param int $postid post ID
- * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A
+ * @param int $postid Post ID.
+ * @param string $mode How to return result, either OBJECT, ARRAY_N, or ARRAY_A.
  * @return object|array Post object or array holding post contents and information
  */
 function wp_get_single_post($postid = 0, $mode = OBJECT) {
  * @return object|array Post object or array holding post contents and information
  */
 function wp_get_single_post($postid = 0, $mode = OBJECT) {
@@ -1193,21 +1271,40 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
 }
 
 /**
 }
 
 /**
- * wp_insert_post() - Insert a post
+ * Insert a post.
  *
  *
- * {@internal Missing Long Description}}
+ * If the $postarr parameter has 'ID' set to a value, then post will be updated.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.0.0
+ * You can set the post date manually, but setting the values for 'post_date'
+ * and 'post_date_gmt' keys. You can close the comments or open the comments by
+ * 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_content_filtered' - Post content filtered.
+ *     'post_excerpt' - Post excerpt.
+ *
+ * @since 1.0.0
  * @uses $wpdb
  * @uses $wp_rewrite
  * @uses $user_ID
  * @uses $wpdb
  * @uses $wp_rewrite
  * @uses $user_ID
- * @uses $allowedtags
  *
  *
- * @param array $postarr post contents
- * @return int post ID or 0 on error
+ * @param array $postarr Optional. Override 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.
  */
 function wp_insert_post($postarr = array(), $wp_error = false) {
        global $wpdb, $wp_rewrite, $user_ID;
  */
 function wp_insert_post($postarr = array(), $wp_error = false) {
        global $wpdb, $wp_rewrite, $user_ID;
@@ -1215,7 +1312,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
                'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
                'menu_order' => 0, 'to_ping' =>  '', 'pinged' => '', 'post_password' => '',
        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
                'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
                'menu_order' => 0, 'to_ping' =>  '', 'pinged' => '', 'post_password' => '',
-               'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '');
+               'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0);
 
        $postarr = wp_parse_args($postarr, $defaults);
        $postarr = sanitize_post($postarr, 'db');
 
        $postarr = wp_parse_args($postarr, $defaults);
        $postarr = sanitize_post($postarr, 'db');
@@ -1240,10 +1337,14 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
        }
 
        // Make sure we set a valid category
        }
 
        // Make sure we set a valid category
-       if (0 == count($post_category) || !is_array($post_category)) {
+       if ( empty($post_category) || 0 == count($post_category) || !is_array($post_category) ) {
                $post_category = array(get_option('default_category'));
        }
 
                $post_category = array(get_option('default_category'));
        }
 
+       //Set the default tag list
+       if ( !isset($tags_input) )
+               $tags_input = array();
+
        if ( empty($post_author) )
                $post_author = $user_ID;
 
        if ( empty($post_author) )
                $post_author = $user_ID;
 
@@ -1253,31 +1354,33 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
        if ( empty($post_type) )
                $post_type = 'post';
 
        if ( empty($post_type) )
                $post_type = 'post';
 
+       $post_ID = 0;
+
        // Get the post ID and GUID
        if ( $update ) {
                $post_ID = (int) $ID;
                $guid = get_post_field( 'guid', $post_ID );
        }
 
        // Get the post ID and GUID
        if ( $update ) {
                $post_ID = (int) $ID;
                $guid = get_post_field( 'guid', $post_ID );
        }
 
-       // Create a valid post name.  Drafts are allowed to have an empty
+       // Don't allow contributors to set to set the post slug for pending review posts
+       if ( 'pending' == $post_status && !current_user_can( 'publish_posts' ) )
+               $post_name = '';
+
+       // Create a valid post name.  Drafts and pending posts are allowed to have an empty
        // post name.
        if ( empty($post_name) ) {
        // post name.
        if ( empty($post_name) ) {
-               if ( 'draft' != $post_status )
+               if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
                        $post_name = sanitize_title($post_title);
        } else {
                $post_name = sanitize_title($post_name);
        }
 
                        $post_name = sanitize_title($post_title);
        } else {
                $post_name = sanitize_title($post_name);
        }
 
-       // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
-       if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) {
-               if ( !in_array($post_status, array('draft', 'pending')) )
-                       $post_date = current_time('mysql');
-               else
-                       $post_date = '0000-00-00 00:00:00';
-       }
+       // If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now
+       if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date )
+               $post_date = current_time('mysql');
 
        if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
 
        if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
-               if ( !in_array($post_status, array('draft', 'pending')) )
+               if ( !in_array( $post_status, array( 'draft', 'pending' ) ) )
                        $post_date_gmt = get_gmt_from_date($post_date);
                else
                        $post_date_gmt = '0000-00-00 00:00:00';
                        $post_date_gmt = get_gmt_from_date($post_date);
                else
                        $post_date_gmt = '0000-00-00 00:00:00';
@@ -1319,15 +1422,27 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
        else
                $post_parent = 0;
 
        else
                $post_parent = 0;
 
+       if ( !empty($post_ID) ) {
+               if ( $post_parent == $post_ID ) {
+                       // Post can't be its own parent
+                       $post_parent = 0;
+               } elseif ( !empty($post_parent) ) {
+                       $parent_post = get_post($post_parent);
+                       // Check for circular dependency
+                       if ( $parent_post->post_parent == $post_ID )
+                               $post_parent = 0;
+               }
+       }
+
        if ( isset($menu_order) )
                $menu_order = (int) $menu_order;
        else
                $menu_order = 0;
 
        if ( isset($menu_order) )
                $menu_order = (int) $menu_order;
        else
                $menu_order = 0;
 
-       if ( !isset($post_password) )
+       if ( !isset($post_password) || 'private' == $post_status )
                $post_password = '';
 
                $post_password = '';
 
-       if ( 'draft' != $post_status ) {
+       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) ) {
                $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) ) {
@@ -1343,6 +1458,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
 
        // 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' ) );
+       $data = apply_filters('wp_insert_post_data', $data, $postarr);
        $data = stripslashes_deep( $data );
        $where = array( 'ID' => $post_ID );
 
        $data = stripslashes_deep( $data );
        $where = array( 'ID' => $post_ID );
 
@@ -1355,12 +1471,20 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                                return 0;
                }
        } else {
                                return 0;
                }
        } else {
-               $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update
+               if ( isset($post_mime_type) )
+                       $data['post_mime_type'] = stripslashes( $post_mime_type ); // This isn't in the update
+               // If there is a suggested ID, use it if not already present
+               if ( !empty($import_id) ) {
+                       $import_id = (int) $import_id;
+                       if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) {
+                               $data['ID'] = $import_id;
+                       }
+               }
                if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
                        if ( $wp_error )
                                return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
                        else
                if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
                        if ( $wp_error )
                                return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
                        else
-                               return 0;       
+                               return 0;
                }
                $post_ID = (int) $wpdb->insert_id;
 
                }
                $post_ID = (int) $wpdb->insert_id;
 
@@ -1368,7 +1492,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
                $where = array( 'ID' => $post_ID );
        }
 
                $where = array( 'ID' => $post_ID );
        }
 
-       if ( empty($post_name) && 'draft' != $post_status ) {
+       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 );
        }
                $post_name = sanitize_title($post_title, $post_ID);
                $wpdb->update( $wpdb->posts, compact( 'post_name' ), $where );
        }
@@ -1413,17 +1537,15 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
 }
 
 /**
 }
 
 /**
- * wp_update_post() - Update a post
+ * Update a post with new post data.
  *
  *
- * {@internal Missing Long Description}}
+ * The date does not have to be set for drafts. You can set the date and it will
+ * not be overridden.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.0.0
  * @since 1.0.0
- * @uses $wpdb
  *
  *
- * @param array $postarr post data
- * @return int {@internal Missing Description}}
+ * @param array|object $postarr Post data.
+ * @return int 0 on failure, Post ID on success.
  */
 function wp_update_post($postarr = array()) {
        if ( is_object($postarr) )
  */
 function wp_update_post($postarr = array()) {
        if ( is_object($postarr) )
@@ -1443,8 +1565,8 @@ function wp_update_post($postarr = array()) {
                $post_cats = $post['post_category'];
 
        // Drafts shouldn't be assigned a date unless explicitly done so by the user
                $post_cats = $post['post_category'];
 
        // Drafts shouldn't be assigned a date unless explicitly done so by the user
-       if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
-                        ('0000-00-00 00:00:00' == $post['post_date']) )
+       if ( in_array($post['post_status'], array('draft', 'pending')) && empty($postarr['edit_date']) &&
+                        ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
                $clear_date = true;
        else
                $clear_date = false;
                $clear_date = true;
        else
                $clear_date = false;
@@ -1453,7 +1575,7 @@ function wp_update_post($postarr = array()) {
        $postarr = array_merge($post, $postarr);
        $postarr['post_category'] = $post_cats;
        if ( $clear_date ) {
        $postarr = array_merge($post, $postarr);
        $postarr['post_category'] = $post_cats;
        if ( $clear_date ) {
-               $postarr['post_date'] = '';
+               $postarr['post_date'] = current_time('mysql');
                $postarr['post_date_gmt'] = '';
        }
 
                $postarr['post_date_gmt'] = '';
        }
 
@@ -1464,17 +1586,14 @@ function wp_update_post($postarr = array()) {
 }
 
 /**
 }
 
 /**
- * wp_publish_post() - Mark a post as "published"
- *
- * {@internal Missing Long Description}}
+ * Publish a post by transitioning the post status.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  * @uses $wpdb
  * @uses $wpdb
+ * @uses do_action() Calls 'edit_post', 'save_post', and 'wp_insert_post' on post_id and post data.
  *
  *
- * @param int $post_id Post ID
- * @return int|null {@internal Missing Description}}
+ * @param int $post_id Post ID.
+ * @return null
  */
 function wp_publish_post($post_id) {
        global $wpdb;
  */
 function wp_publish_post($post_id) {
        global $wpdb;
@@ -1494,9 +1613,9 @@ function wp_publish_post($post_id) {
        wp_transition_post_status('publish', $old_status, $post);
 
        // Update counts for the post's terms.
        wp_transition_post_status('publish', $old_status, $post);
 
        // Update counts for the post's terms.
-       foreach ( get_object_taxonomies('post') as $taxonomy ) {
-               $terms = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
-               wp_update_term_count($terms, $taxonomy);
+       foreach ( (array) get_object_taxonomies('post') as $taxonomy ) {
+               $tt_ids = wp_get_object_terms($post_id, $taxonomy, 'fields=tt_ids');
+               wp_update_term_count($tt_ids, $taxonomy);
        }
 
        do_action('edit_post', $post_id, $post);
        }
 
        do_action('edit_post', $post_id, $post);
@@ -1505,19 +1624,15 @@ function wp_publish_post($post_id) {
 }
 
 /**
 }
 
 /**
- * check_and_publish_future_post() - check to make sure post has correct status before
- * passing it on to be published. Invoked by cron 'publish_future_post' event
- * This safeguard prevents cron from publishing drafts, etc.
+ * Publish future post and make sure post ID has future post status.
  *
  *
- * {@internal Missing Long Description}}
+ * Invoked by cron 'publish_future_post' event. This safeguard prevents cron
+ * from publishing drafts, etc.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.5
- * @uses $wpdb
+ * @since 2.5.0
  *
  *
- * @param int $post_id Post ID
- * @return int|null {@internal Missing Description}}
+ * @param int $post_id Post ID.
+ * @return null Nothing is returned. Which can mean that no action is required or post was published.
  */
 function check_and_publish_future_post($post_id) {
 
  */
 function check_and_publish_future_post($post_id) {
 
@@ -1529,38 +1644,43 @@ function check_and_publish_future_post($post_id) {
        if ( 'future' != $post->post_status )
                return;
 
        if ( 'future' != $post->post_status )
                return;
 
+       $time = strtotime( $post->post_date_gmt . ' GMT' );
+
+       if ( $time > time() ) { // Uh oh, someone jumped the gun!
+               wp_clear_scheduled_hook( 'publish_future_post', $post_id ); // clear anything else in the system
+               wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) );
+               return;
+       }
+
        return wp_publish_post($post_id);
 }
 
 /**
        return wp_publish_post($post_id);
 }
 
 /**
- * wp_add_post_tags() - Adds the tags to a post
+ * Adds tags to a post.
  *
  *
- * @uses wp_set_post_tags() Same first two paraeters, but the last parameter is always set to true.
+ * @uses wp_set_post_tags() Same first two parameters, but the last parameter is always set to true.
  *
  * @package WordPress
  * @subpackage Post
  *
  * @package WordPress
  * @subpackage Post
- * @since 2.3
+ * @since 2.3.0
  *
  *
- * @param int $post_id Optional. Post ID
- * @param string $tags The tags to set for the post
+ * @param int $post_id Post ID
+ * @param string $tags The tags to set for the post, separated by commas.
  * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
  */
 function wp_add_post_tags($post_id = 0, $tags = '') {
        return wp_set_post_tags($post_id, $tags, true);
 }
 
  * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise
  */
 function wp_add_post_tags($post_id = 0, $tags = '') {
        return wp_set_post_tags($post_id, $tags, true);
 }
 
+
 /**
 /**
- * wp_set_post_tags() - Set the tags for a post
+ * Set the tags for a post.
  *
  *
- * {@internal Missing Long Description}}
+ * @since 2.3.0
+ * @uses wp_set_object_terms() Sets the tags for the post.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
- * @uses $wpdb
- *
- * @param int $post_id post ID
- * @param string $tags The tags to set 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
  */
  * @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
  */
@@ -1578,18 +1698,16 @@ function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
 }
 
 /**
 }
 
 /**
- * wp_set_post_categories() - Set categories for a post
+ * Set categories for a post.
  *
  *
- * {@internal Missing Long Description}}
+ * If the post categories parameter is not set, then the default category is
+ * going used.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
- * @uses $wpdb
+ * @since 2.1.0
  *
  *
- * @param int $post_ID post ID
- * @param array $post_categories
- * @return bool|mixed {@internal Missing Description}}
+ * @param int $post_ID Post ID.
+ * @param array $post_categories Optional. List of categories.
+ * @return bool|mixed
  */
 function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
        $post_ID = (int) $post_ID;
  */
 function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
        $post_ID = (int) $post_ID;
@@ -1603,20 +1721,27 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
        $post_categories = array_unique($post_categories);
 
        return wp_set_object_terms($post_ID, $post_categories, 'category');
        $post_categories = array_unique($post_categories);
 
        return wp_set_object_terms($post_ID, $post_categories, 'category');
-}      // wp_set_post_categories()
+}
 
 /**
 
 /**
- * wp_transition_post_status() - Change the post transition status
+ * Transition the post status of a post.
  *
  *
- * {@internal Missing Long Description}}
+ * 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
+ * post data.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * 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
+ * parameter and POSTTYPE is post_type post data.
  *
  *
- * @param string $new_status {@internal Missing Description}}
- * @param string $old_status {@internal Missing Description}}
- * @param int $post {@internal Missing Description}}
+ * @since 2.3.0
+ *
+ * @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 ) {
  */
 function wp_transition_post_status($new_status, $old_status, $post) {
        if ( $new_status != $old_status ) {
@@ -1631,18 +1756,14 @@ function wp_transition_post_status($new_status, $old_status, $post) {
 //
 
 /**
 //
 
 /**
- * add_ping() - Add a URL to those already pung
- *
- * {@internal Missing Long Description}}
+ * Add a URL to those already pung.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param int $post_id post ID
- * @param string $uri {@internal Missing Description}}
- * @return mixed {@internal Missing Description}}
+ * @param int $post_id Post ID.
+ * @param string $uri Ping URI.
+ * @return int How many rows were updated.
  */
 function add_ping($post_id, $uri) {
        global $wpdb;
  */
 function add_ping($post_id, $uri) {
        global $wpdb;
@@ -1658,17 +1779,13 @@ function add_ping($post_id, $uri) {
 }
 
 /**
 }
 
 /**
- * get_enclosed() - Get enclosures already enclosed for a post
+ * Retrieve enclosures already enclosed for a post.
  *
  *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param int $post_id post ID
- * @return array {@internal Missing Description}}
+ * @param int $post_id Post ID.
+ * @return array List of enclosures
  */
 function get_enclosed($post_id) {
        $custom_fields = get_post_custom( $post_id );
  */
 function get_enclosed($post_id) {
        $custom_fields = get_post_custom( $post_id );
@@ -1689,17 +1806,13 @@ function get_enclosed($post_id) {
 }
 
 /**
 }
 
 /**
- * get_pung() - Get URLs already pinged for a post
- *
- * {@internal Missing Long Description}}
+ * Retrieve URLs already pinged for a post.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param int $post_id post ID
- * @return array {@internal Missing Description}}
+ * @param int $post_id Post ID.
+ * @return array
  */
 function get_pung($post_id) {
        global $wpdb;
  */
 function get_pung($post_id) {
        global $wpdb;
@@ -1711,17 +1824,13 @@ function get_pung($post_id) {
 }
 
 /**
 }
 
 /**
- * get_to_ping() - Get any URLs in the todo list
- *
- * {@internal Missing Long Description}}
+ * Retrieve URLs that need to be pinged.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param int $post_id post ID
- * @return array {@internal Missing Description}}
+ * @param int $post_id Post ID
+ * @return array
  */
 function get_to_ping($post_id) {
        global $wpdb;
  */
 function get_to_ping($post_id) {
        global $wpdb;
@@ -1733,19 +1842,15 @@ function get_to_ping($post_id) {
 }
 
 /**
 }
 
 /**
- * trackback_url_list() - Do trackbacks for a list of urls
- *
- * {@internal Missing Long Description}}
+ * Do trackbacks for a list of URLs.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.0.0
  *
  * @since 1.0.0
  *
- * @param string $tb_list comma separated list of URLs
- * @param int $post_id post ID
+ * @param string $tb_list Comma separated list of URLs
+ * @param int $post_id Post ID
  */
 function trackback_url_list($tb_list, $post_id) {
  */
 function trackback_url_list($tb_list, $post_id) {
-       if (!empty($tb_list)) {
+       if ( ! empty( $tb_list ) ) {
                // get post data
                $postdata = wp_get_single_post($post_id, ARRAY_A);
 
                // get post data
                $postdata = wp_get_single_post($post_id, ARRAY_A);
 
@@ -1753,18 +1858,18 @@ function trackback_url_list($tb_list, $post_id) {
                extract($postdata, EXTR_SKIP);
 
                // form an excerpt
                extract($postdata, EXTR_SKIP);
 
                // form an excerpt
-               $excerpt = strip_tags($post_excerpt?$post_excerpt:$post_content);
+               $excerpt = strip_tags($post_excerpt ? $post_excerpt : $post_content);
 
                if (strlen($excerpt) > 255) {
                        $excerpt = substr($excerpt,0,252) . '...';
                }
 
                $trackback_urls = explode(',', $tb_list);
 
                if (strlen($excerpt) > 255) {
                        $excerpt = substr($excerpt,0,252) . '...';
                }
 
                $trackback_urls = explode(',', $tb_list);
-               foreach($trackback_urls as $tb_url) {
-                               $tb_url = trim($tb_url);
-                               trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
-               }
+               foreach( (array) $trackback_urls as $tb_url) {
+                       $tb_url = trim($tb_url);
+                       trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
                }
                }
+       }
 }
 
 //
 }
 
 //
@@ -1772,16 +1877,12 @@ function trackback_url_list($tb_list, $post_id) {
 //
 
 /**
 //
 
 /**
- * get_all_page_ids() - Get a list of page IDs
- *
- * {@internal Missing Long Description}}
+ * Get a list of page IDs.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
+ * @since 2.0.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @return array {@internal Missing Description}}
+ * @return array List of page IDs.
  */
 function get_all_page_ids() {
        global $wpdb;
  */
 function get_all_page_ids() {
        global $wpdb;
@@ -1795,43 +1896,38 @@ function get_all_page_ids() {
 }
 
 /**
 }
 
 /**
- * get_page() - Retrieves page data given a page ID or page object
- *
- * {@internal Missing Long Description}}
+ * Retrieves page data given a page ID or page object.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.5.1
  *
  * @since 1.5.1
  *
- * @param mixed &$page page object or page ID
- * @param string $output what to output
+ * @param mixed $page Page object or page ID. Passed by reference.
+ * @param string $output What to output. OBJECT, ARRAY_A, or ARRAY_N.
  * @param string $filter How the return value should be filtered.
  * @param string $filter How the return value should be filtered.
- * @return mixed {@internal Missing Description}}
+ * @return mixed Page data.
  */
 function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
        if ( empty($page) ) {
  */
 function &get_page(&$page, $output = OBJECT, $filter = 'raw') {
        if ( empty($page) ) {
-               if ( isset( $GLOBALS['page'] ) && isset( $GLOBALS['page']->ID ) )
+               if ( isset( $GLOBALS['page'] ) && isset( $GLOBALS['page']->ID ) ) {
                        return get_post($GLOBALS['page'], $output, $filter);
                        return get_post($GLOBALS['page'], $output, $filter);
-               else
-                       return null;
+               } else {
+                       $page = null;
+                       return $page;
+               }
        }
 
        }
 
-       return get_post($page, $output, $filter);
+       $the_page = get_post($page, $output, $filter);
+       return $the_page;
 }
 
 /**
 }
 
 /**
- * get_page_by_path() - Retrieves a page given its path
- *
- * {@internal Missing Long Description}}
+ * Retrieves a page given its path.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param string $page_path page path
- * @param string $output output type
- * @return mixed {@internal Missing Description}}
+ * @param string $page_path Page path
+ * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
+ * @return mixed Null when complete.
  */
 function get_page_by_path($page_path, $output = OBJECT) {
        global $wpdb;
  */
 function get_page_by_path($page_path, $output = OBJECT) {
        global $wpdb;
@@ -1841,13 +1937,14 @@ function get_page_by_path($page_path, $output = OBJECT) {
        $page_paths = '/' . trim($page_path, '/');
        $leaf_path  = sanitize_title(basename($page_paths));
        $page_paths = explode('/', $page_paths);
        $page_paths = '/' . trim($page_path, '/');
        $leaf_path  = sanitize_title(basename($page_paths));
        $page_paths = explode('/', $page_paths);
-       foreach($page_paths as $pathdir)
+       $full_path = '';
+       foreach( (array) $page_paths as $pathdir)
                $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
 
        $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = 'page' OR post_type = 'attachment')", $leaf_path ));
 
        if ( empty($pages) )
                $full_path .= ($pathdir!=''?'/':'') . sanitize_title($pathdir);
 
        $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = 'page' OR post_type = 'attachment')", $leaf_path ));
 
        if ( empty($pages) )
-               return NULL;
+               return null;
 
        foreach ($pages as $page) {
                $path = '/' . $leaf_path;
 
        foreach ($pages as $page) {
                $path = '/' . $leaf_path;
@@ -1861,22 +1958,18 @@ function get_page_by_path($page_path, $output = OBJECT) {
                        return get_page($page->ID, $output);
        }
 
                        return get_page($page->ID, $output);
        }
 
-       return NULL;
+       return null;
 }
 
 /**
 }
 
 /**
- * get_page_by_title() - Retrieve a page given its title
+ * Retrieve a page given its title.
  *
  *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param string $page_title page title
- * @param string $output output type
- * @return mixed {@internal Missing Description}}
+ * @param string $page_title Page title
+ * @param string $output Optional. Output type. OBJECT, ARRAY_N, or ARRAY_A.
+ * @return mixed
  */
 function get_page_by_title($page_title, $output = OBJECT) {
        global $wpdb;
  */
 function get_page_by_title($page_title, $output = OBJECT) {
        global $wpdb;
@@ -1884,25 +1977,25 @@ function get_page_by_title($page_title, $output = OBJECT) {
        if ( $page )
                return get_page($page, $output);
 
        if ( $page )
                return get_page($page, $output);
 
-       return NULL;
+       return null;
 }
 
 /**
 }
 
 /**
- * get_page_children() - Retrieve child pages
+ * Retrieve child pages from list of pages matching page ID.
  *
  *
- * {@internal Missing Long Description}}
+ * Matches against the pages parameter against the page ID. Also matches all
+ * children for the same to retrieve all children of a page. Does not make any
+ * SQL queries to get the children.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 1.5.1
  *
  * @since 1.5.1
  *
- * @param int $page_id page ID
- * @param array $pages list of pages
- * @return array {@internal Missing Description}}
+ * @param int $page_id Page ID.
+ * @param array $pages List of pages' objects.
+ * @return array
  */
 function &get_page_children($page_id, $pages) {
        $page_list = array();
  */
 function &get_page_children($page_id, $pages) {
        $page_list = array();
-       foreach ( $pages as $page ) {
+       foreach ( (array) $pages as $page ) {
                if ( $page->post_parent == $page_id ) {
                        $page_list[] = $page;
                        if ( $children = get_page_children($page->ID, $pages) )
                if ( $page->post_parent == $page_id ) {
                        $page_list[] = $page;
                        if ( $children = get_page_children($page->ID, $pages) )
@@ -1913,22 +2006,20 @@ function &get_page_children($page_id, $pages) {
 }
 
 /**
 }
 
 /**
- * get_page_hierarchy() - {@internal Missing Short Description}}
+ * 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.
+ * Fetches the pages returned as a FLAT list, but arranged in order of their
+ * hierarchy, i.e., child parents immediately follow their parents.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
+ * @since 2.0.0
  *
  *
- * @param array $posts posts array
- * @param int $parent parent page ID
- * @return array {@internal Missing Description}}
+ * @param array $posts Posts array.
+ * @param int $parent Parent page ID.
+ * @return array
  */
 function get_page_hierarchy($posts, $parent = 0) {
        $result = array ( );
  */
 function get_page_hierarchy($posts, $parent = 0) {
        $result = array ( );
-       if ($posts) { foreach ($posts as $post) {
+       if ($posts) { foreach ( (array) $posts as $post) {
                if ($post->post_parent == $parent) {
                        $result[$post->ID] = $post->post_name;
                        $children = get_page_hierarchy($posts, $post->ID);
                if ($post->post_parent == $parent) {
                        $result[$post->ID] = $post->post_name;
                        $children = get_page_hierarchy($posts, $post->ID);
@@ -1939,16 +2030,14 @@ function get_page_hierarchy($posts, $parent = 0) {
 }
 
 /**
 }
 
 /**
- * get_page_uri() - Builds a page URI
+ * Builds URI for a page.
  *
  *
- * {@internal Missing Long Description}}
+ * Sub pages will be in the "directory" under the parent page post name.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  *
  *
- * @param int $page_id page ID
- * @return string {@internal Missing Description}}
+ * @param int $page_id Page ID.
+ * @return string Page URI.
  */
 function get_page_uri($page_id) {
        $page = get_page($page_id);
  */
 function get_page_uri($page_id) {
        $page = get_page($page_id);
@@ -1967,16 +2056,16 @@ function get_page_uri($page_id) {
 }
 
 /**
 }
 
 /**
- * get_pages() - Retrieve a list of pages
+ * Retrieve a list of pages.
  *
  *
- * {@internal Missing Long Description}}
+ * 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'.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 1.5
+ * @since 1.5.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param mixed $args Optional. Array or string of options
+ * @param mixed $args Optional. Array or string of options that overrides defaults.
  * @return array List of pages matching defaults or $args
  */
 function &get_pages($args = '') {
  * @return array List of pages matching defaults or $args
  */
 function &get_pages($args = '') {
@@ -1987,20 +2076,24 @@ 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' => ''
+               'authors' => '', 'parent' => -1, 'exclude_tree' => ''
        );
 
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );
 
        );
 
        $r = wp_parse_args( $args, $defaults );
        extract( $r, EXTR_SKIP );
 
-       $key = md5( serialize( $r ) );
-       if ( $cache = wp_cache_get( 'get_pages', 'posts' ) )
-               if ( isset( $cache[ $key ] ) )
-                       return apply_filters('get_pages', $cache[ $key ], $r );
+       $key = md5( serialize( compact(array_keys($defaults)) ) );
+       if ( $cache = wp_cache_get( 'get_pages', 'posts' ) ) {
+               if ( isset( $cache[ $key ] ) ) {
+                       $pages = apply_filters('get_pages', $cache[ $key ], $r );
+                       return $pages;
+               }
+       }
 
        $inclusions = '';
        if ( !empty($include) ) {
 
        $inclusions = '';
        if ( !empty($include) ) {
-               $child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
+               $child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
+               $parent = -1;
                $exclude = '';
                $meta_key = '';
                $meta_value = '';
                $exclude = '';
                $meta_key = '';
                $meta_value = '';
@@ -2063,8 +2156,8 @@ function &get_pages($args = '') {
        $where = "$exclusions $inclusions ";
        if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) {
                $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
        $where = "$exclusions $inclusions ";
        if ( ! empty( $meta_key ) || ! empty( $meta_value ) ) {
                $join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
-               
-               // meta_key and met_value might be slashed 
+
+               // meta_key and meta_value might be slashed
                $meta_key = stripslashes($meta_key);
                $meta_value = stripslashes($meta_value);
                if ( ! empty( $meta_key ) )
                $meta_key = stripslashes($meta_key);
                $meta_value = stripslashes($meta_value);
                if ( ! empty( $meta_key ) )
@@ -2073,14 +2166,20 @@ function &get_pages($args = '') {
                        $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
 
        }
                        $where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
 
        }
+
+       if ( $parent >= 0 )
+               $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
+
        $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where ";
        $query .= $author_query;
        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
 
        $pages = $wpdb->get_results($query);
 
        $query = "SELECT * FROM $wpdb->posts $join WHERE (post_type = 'page' AND post_status = 'publish') $where ";
        $query .= $author_query;
        $query .= " ORDER BY " . $sort_column . " " . $sort_order ;
 
        $pages = $wpdb->get_results($query);
 
-       if ( empty($pages) )
-               return apply_filters('get_pages', array(), $r);
+       if ( empty($pages) ) {
+               $pages = apply_filters('get_pages', array(), $r);
+               return $pages;
+       }
 
        // Update cache.
        update_page_cache($pages);
 
        // Update cache.
        update_page_cache($pages);
@@ -2088,6 +2187,22 @@ function &get_pages($args = '') {
        if ( $child_of || $hierarchical )
                $pages = & get_page_children($child_of, $pages);
 
        if ( $child_of || $hierarchical )
                $pages = & get_page_children($child_of, $pages);
 
+       if ( !empty($exclude_tree) ) {
+               $exclude = array();
+
+               $exclude = (int) $exclude_tree;
+               $children = get_page_children($exclude, $pages);
+               $excludes = array();
+               foreach ( $children as $child )
+                       $excludes[] = $child->ID;
+               $excludes[] = $exclude;
+               $total = count($pages);
+               for ( $i = 0; $i < $total; $i++ ) {
+                       if ( in_array($pages[$i]->ID, $excludes) )
+                               unset($pages[$i]);
+               }
+       }
+
        $cache[ $key ] = $pages;
        wp_cache_set( 'get_pages', $cache, 'posts' );
 
        $cache[ $key ] = $pages;
        wp_cache_set( 'get_pages', $cache, 'posts' );
 
@@ -2101,16 +2216,12 @@ function &get_pages($args = '') {
 //
 
 /**
 //
 
 /**
- * is_local_attachment() - Check if the attachment URI is local one and is really an attachment.
+ * Check if the attachment URI is local one and is really an attachment.
  *
  *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
+ * @since 2.0.0
  *
  * @param string $url URL to check
  *
  * @param string $url URL to check
- * @return bool {@internal Missing Description}}
+ * @return bool True on success, false on failure.
  */
 function is_local_attachment($url) {
        if (strpos($url, get_bloginfo('url')) === false)
  */
 function is_local_attachment($url) {
        if (strpos($url, get_bloginfo('url')) === false)
@@ -2126,21 +2237,47 @@ function is_local_attachment($url) {
 }
 
 /**
 }
 
 /**
- * wp_insert_attachment() - Insert an attachment
- *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
- *
+ * Insert an attachment.
+ *
+ * If you set the 'ID' in the $object parameter, it will mean that you are
+ * updating and attempt to update the attachment. You can also set the
+ * attachment name or title by setting the key 'post_name' or 'post_title'.
+ *
+ * You can set the dates for the attachment manually by setting the 'post_date'
+ * and 'post_date_gmt' keys' values.
+ *
+ * By default, the comments will use the default settings for whether the
+ * comments are allowed. You can close them manually or keep them open by
+ * 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_content_filtered' - Attachment post content filtered.
+ *     'post_excerpt' - Attachment excerpt.
+ *
+ * @since 2.0.0
  * @uses $wpdb
  * @uses $user_ID
  *
  * @uses $wpdb
  * @uses $user_ID
  *
- * @param object $object attachment object
- * @param string $file filename
- * @param int $post_parent parent post ID
- * @return int {@internal Missing Description}}
+ * @param string|array $object Arguments to override defaults.
+ * @param string $file Optional filename.
+ * @param int $post_parent Parent post ID.
+ * @return int Attachment ID.
  */
 function wp_insert_attachment($object, $file = false, $parent = 0) {
        global $wpdb, $user_ID;
  */
 function wp_insert_attachment($object, $file = false, $parent = 0) {
        global $wpdb, $user_ID;
@@ -2148,7 +2285,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
                'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
                'menu_order' => 0, 'to_ping' =>  '', 'pinged' => '', 'post_password' => '',
        $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID,
                'ping_status' => get_option('default_ping_status'), 'post_parent' => 0,
                'menu_order' => 0, 'to_ping' =>  '', 'pinged' => '', 'post_password' => '',
-               'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '');
+               'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0);
 
        $object = wp_parse_args($object, $defaults);
        if ( !empty($parent) )
 
        $object = wp_parse_args($object, $defaults);
        if ( !empty($parent) )
@@ -2160,7 +2297,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
        extract($object, EXTR_SKIP);
 
        // Make sure we set a valid category
        extract($object, EXTR_SKIP);
 
        // Make sure we set a valid category
-       if (0 == count($post_category) || !is_array($post_category)) {
+       if ( !isset($post_category) || 0 == count($post_category) || !is_array($post_category)) {
                $post_category = array(get_option('default_category'));
        }
 
                $post_category = array(get_option('default_category'));
        }
 
@@ -2171,10 +2308,12 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
        $post_status = 'inherit';
 
        // Are we updating or creating?
        $post_status = 'inherit';
 
        // Are we updating or creating?
-       $update = false;
        if ( !empty($ID) ) {
                $update = true;
                $post_ID = (int) $ID;
        if ( !empty($ID) ) {
                $update = true;
                $post_ID = (int) $ID;
+       } else {
+               $update = false;
+               $post_ID = 0;
        }
 
        // Create a valid post name.
        }
 
        // Create a valid post name.
@@ -2184,14 +2323,14 @@ 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 = '$post_name' AND post_status = 'inherit' AND ID != %d LIMIT 1", $post_ID));
+       $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)
 
        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 = '$alt_post_name' AND post_status = 'inherit' AND ID != %d AND post_parent = %d LIMIT 1", $post_ID, $post_parent));
+                       $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;
                        $suffix++;
                }
                $post_name = $alt_post_name;
@@ -2203,9 +2342,9 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
                $post_date_gmt = current_time('mysql', 1);
 
        if ( empty($post_modified) )
                $post_date_gmt = current_time('mysql', 1);
 
        if ( empty($post_modified) )
-                $post_modified = $post_date;
+               $post_modified = $post_date;
        if ( empty($post_modified_gmt) )
        if ( empty($post_modified_gmt) )
-                $post_modified_gmt = $post_date_gmt;
+               $post_modified_gmt = $post_date_gmt;
 
        if ( empty($comment_status) ) {
                if ( $update )
 
        if ( empty($comment_status) ) {
                if ( $update )
@@ -2244,6 +2383,14 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
        if ( $update ) {
                $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) );
        } else {
        if ( $update ) {
                $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) );
        } else {
+               // If there is a suggested ID, use it if not already present
+               if ( !empty($import_id) ) {
+                       $import_id = (int) $import_id;
+                       if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) {
+                               $data['ID'] = $import_id;
+                       }
+               }
+
                $wpdb->insert( $wpdb->posts, $data );
                $post_ID = (int) $wpdb->insert_id;
        }
                $wpdb->insert( $wpdb->posts, $data );
                $post_ID = (int) $wpdb->insert_id;
        }
@@ -2257,7 +2404,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
 
        if ( $file )
                update_attached_file( $post_ID, $file );
 
        if ( $file )
                update_attached_file( $post_ID, $file );
-               
+
        clean_post_cache($post_ID);
 
        if ( $update) {
        clean_post_cache($post_ID);
 
        if ( $update) {
@@ -2270,17 +2417,18 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
 }
 
 /**
 }
 
 /**
- * wp_delete_attachment() - Delete an attachment
+ * Delete an attachment.
  *
  *
- * {@internal Missing Long Description}}
+ * Will remove the file also, when the attachment is removed. Removes all post
+ * meta fields, taxonomy, comments, etc associated with the attachment (except
+ * the main post).
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.0
+ * @since 2.0.0
  * @uses $wpdb
  * @uses $wpdb
+ * @uses do_action() Calls 'delete_attachment' hook on Attachment ID.
  *
  *
- * @param int $postid attachment Id
- * @return mixed {@internal Missing Description}}
+ * @param int $postid Attachment ID.
+ * @return mixed False on failure. Post data on success.
  */
 function wp_delete_attachment($postid) {
        global $wpdb;
  */
 function wp_delete_attachment($postid) {
        global $wpdb;
@@ -2303,21 +2451,23 @@ function wp_delete_attachment($postid) {
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
 
 
        $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
 
+       $uploadPath = wp_upload_dir();
+
        if ( ! empty($meta['thumb']) ) {
                // Don't delete the thumb if another attachment uses it
                if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$meta['thumb'].'%', $postid)) ) {
                        $thumbfile = str_replace(basename($file), $meta['thumb'], $file);
                        $thumbfile = apply_filters('wp_delete_file', $thumbfile);
        if ( ! empty($meta['thumb']) ) {
                // Don't delete the thumb if another attachment uses it
                if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$meta['thumb'].'%', $postid)) ) {
                        $thumbfile = str_replace(basename($file), $meta['thumb'], $file);
                        $thumbfile = apply_filters('wp_delete_file', $thumbfile);
-                       @ unlink($thumbfile);
+                       @ unlink( path_join($uploadPath['basedir'], $thumbfile) );
                }
        }
 
        // remove intermediate images if there are any
                }
        }
 
        // remove intermediate images if there are any
-       $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium'));
+       $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large'));
        foreach ( $sizes as $size ) {
                if ( $intermediate = image_get_intermediate_size($postid, $size) ) {
                        $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
        foreach ( $sizes as $size ) {
                if ( $intermediate = image_get_intermediate_size($postid, $size) ) {
                        $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']);
-                       @ unlink($intermediate_file);
+                       @ unlink( path_join($uploadPath['basedir'], $intermediate_file) );
                }
        }
 
                }
        }
 
@@ -2334,17 +2484,13 @@ function wp_delete_attachment($postid) {
 }
 
 /**
 }
 
 /**
- * wp_get_attachment_metadata() - Retrieve metadata for an attachment
+ * Retrieve attachment meta field for attachment ID.
  *
  *
- * {@internal Missing Long Description}}
+ * @since 2.1.0
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
- *
- * @param int $post_id attachment ID
- * @param bool $unfiltered Optional, default is false. If true, filters are not run
- * @return array {@internal Missing Description}}
+ * @param int $post_id Attachment ID
+ * @param bool $unfiltered Optional, default is false. If true, filters are not run.
+ * @return string|bool Attachment meta field. False on failure.
  */
 function wp_get_attachment_metadata( $post_id, $unfiltered = false ) {
        $post_id = (int) $post_id;
  */
 function wp_get_attachment_metadata( $post_id, $unfiltered = false ) {
        $post_id = (int) $post_id;
@@ -2358,17 +2504,13 @@ function wp_get_attachment_metadata( $post_id, $unfiltered = false ) {
 }
 
 /**
 }
 
 /**
- * wp_update_attachment_metadata() - Update metadata for an attachment
+ * Update metadata for an attachment.
  *
  *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  *
- * @param int $post_id attachment ID
- * @param array $data attachment data
- * @return int {@internal Missing Description}}
+ * @param int $post_id Attachment ID.
+ * @param array $data Attachment data.
+ * @return int
  */
 function wp_update_attachment_metadata( $post_id, $data ) {
        $post_id = (int) $post_id;
  */
 function wp_update_attachment_metadata( $post_id, $data ) {
        $post_id = (int) $post_id;
@@ -2381,41 +2523,46 @@ function wp_update_attachment_metadata( $post_id, $data ) {
 }
 
 /**
 }
 
 /**
- * wp_get_attachment_url() - Retrieve the URL for an attachment
- *
- * {@internal Missing Long Description}}
+ * Retrieve the URL for an attachment.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  *
- * @param int $post_id attachment ID
- * @return string {@internal Missing Description}}
+ * @param int $post_id Attachment ID.
+ * @return string
  */
 function wp_get_attachment_url( $post_id = 0 ) {
        $post_id = (int) $post_id;
        if ( !$post =& get_post( $post_id ) )
                return false;
 
  */
 function wp_get_attachment_url( $post_id = 0 ) {
        $post_id = (int) $post_id;
        if ( !$post =& get_post( $post_id ) )
                return false;
 
-       $url = get_the_guid( $post->ID );
+       $url = '';
+       if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true) ) { //Get attached file
+               if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) { //Get upload directory
+                       if ( 0 === strpos($file, $uploads['basedir']) ) //Check that the upload base exists in the file location
+                               $url = str_replace($uploads['basedir'], $uploads['baseurl'], $file); //replace file location with url location
+                       elseif ( false !== strpos($file, 'wp-content/uploads') )
+                               $url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
+                       else
+                               $url = $uploads['baseurl'] . "/$file"; //Its a newly uploaded file, therefor $file is relative to the basedir.
+               }
+       }
+
+       if ( empty($url) ) //If any of the above options failed, Fallback on the GUID as used pre-2.7, not recomended to rely upon this.
+               $url = get_the_guid( $post->ID );
 
 
-       if ( 'attachment' != $post->post_type || !$url )
+       if ( 'attachment' != $post->post_type || empty($url) )
                return false;
 
        return apply_filters( 'wp_get_attachment_url', $url, $post->ID );
 }
 
 /**
                return false;
 
        return apply_filters( 'wp_get_attachment_url', $url, $post->ID );
 }
 
 /**
- * wp_get_attachment_thumb_file() - Retrieve thumbnail for an attachment
- *
- * {@internal Missing Long Description}}
+ * Retrieve thumbnail for an attachment.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  *
- * @param int $post_id attachment ID
- * @return mixed {@internal Missing Description}}
+ * @param int $post_id Attachment ID.
+ * @return mixed False on failure. Thumbnail file path on success.
  */
 function wp_get_attachment_thumb_file( $post_id = 0 ) {
        $post_id = (int) $post_id;
  */
 function wp_get_attachment_thumb_file( $post_id = 0 ) {
        $post_id = (int) $post_id;
@@ -2432,16 +2579,12 @@ function wp_get_attachment_thumb_file( $post_id = 0 ) {
 }
 
 /**
 }
 
 /**
- * wp_get_attachment_thumb_url() - Retrieve URL for an attachment thumbnail
- *
- * {@internal Missing Long Description}}
+ * Retrieve URL for an attachment thumbnail.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  *
- * @param int $post_id attachment ID
- * @return string {@internal Missing Description}}
+ * @param int $post_id Attachment ID
+ * @return string|bool False on failure. Thumbnail URL on success.
  */
 function wp_get_attachment_thumb_url( $post_id = 0 ) {
        $post_id = (int) $post_id;
  */
 function wp_get_attachment_thumb_url( $post_id = 0 ) {
        $post_id = (int) $post_id;
@@ -2449,7 +2592,7 @@ function wp_get_attachment_thumb_url( $post_id = 0 ) {
                return false;
        if ( !$url = wp_get_attachment_url( $post->ID ) )
                return false;
                return false;
        if ( !$url = wp_get_attachment_url( $post->ID ) )
                return false;
-               
+
        $sized = image_downsize( $post_id, 'thumbnail' );
        if ( $sized )
                return $sized[0];
        $sized = image_downsize( $post_id, 'thumbnail' );
        if ( $sized )
                return $sized[0];
@@ -2463,16 +2606,12 @@ function wp_get_attachment_thumb_url( $post_id = 0 ) {
 }
 
 /**
 }
 
 /**
- * wp_attachment_is_image() - Check if the attachment is an image
+ * Check if the attachment is an image.
  *
  *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  *
- * @param int $post_id attachment ID
- * @return bool {@internal Missing Description}}
+ * @param int $post_id Attachment ID
+ * @return bool
  */
 function wp_attachment_is_image( $post_id = 0 ) {
        $post_id = (int) $post_id;
  */
 function wp_attachment_is_image( $post_id = 0 ) {
        $post_id = (int) $post_id;
@@ -2492,16 +2631,12 @@ function wp_attachment_is_image( $post_id = 0 ) {
 }
 
 /**
 }
 
 /**
- * wp_mime_type_icon() - Retrieve the icon for a MIME type
+ * Retrieve the icon for a MIME type.
  *
  *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * @since 2.1.0
  *
  * @param string $mime MIME type
  *
  * @param string $mime MIME type
- * @return string|bool {@internal Missing Description}}
+ * @return string|bool
  */
 function wp_mime_type_icon( $mime = 0 ) {
        if ( !is_numeric($mime) )
  */
 function wp_mime_type_icon( $mime = 0 ) {
        if ( !is_numeric($mime) )
@@ -2582,15 +2717,22 @@ function wp_mime_type_icon( $mime = 0 ) {
 }
 
 /**
 }
 
 /**
- * wp_check_for_changed_slugs() - {@internal Missing Short Description}}
+ * Checked for changed slugs for published posts and save old slug.
  *
  *
- * {@internal Missing Long Description}}
+ * The function is used along with form POST data. It checks for the wp-old-slug
+ * POST field. Will only be concerned with published posts and the slug actually
+ * changing.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.1
+ * If the slug was changed and not already part of the old slugs then it will be
+ * added to the post meta field ('_wp_old_slug') for storing old slugs for that
+ * post.
+ *
+ * The most logically usage of this function is redirecting changed posts, so
+ * that those that linked to an changed post will be redirected to the new post.
  *
  *
- * @param int $post_id The Post ID
+ * @since 2.1.0
+ *
+ * @param int $post_id Post ID.
  * @return int Same as $post_id
  */
 function wp_check_for_changed_slugs($post_id) {
  * @return int Same as $post_id
  */
 function wp_check_for_changed_slugs($post_id) {
@@ -2621,20 +2763,21 @@ function wp_check_for_changed_slugs($post_id) {
 }
 
 /**
 }
 
 /**
- * get_private_posts_cap_sql() - {@internal Missing Short Description}}
+ * Retrieve the private post SQL based on capability.
  *
  *
- * This function provides a standardized way to appropriately select on
- * the post_status of posts/pages. The function will return a piece of
- * SQL code that can be added to a WHERE clause; this SQL is constructed
- * to allow all published posts, and all private posts to which the user
- * has access.
+ * This function provides a standardized way to appropriately select on the
+ * post_status of posts/pages. The function will return a piece of SQL code that
+ * can be added to a WHERE clause; this SQL is constructed to allow all
+ * published posts, and all private posts to which the user has access.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.2
+ * It also allows plugins that define their own post type to control the cap by
+ * using the hook 'pub_priv_sql_capability'. The plugin is expected to return
+ * the capability the user must have to read the private post type.
+ *
+ * @since 2.2.0
  *
  * @uses $user_ID
  *
  * @uses $user_ID
- * @uses apply_filters() Call 'pub_priv_sql_capability' filter for plugins with different post types
+ * @uses apply_filters() Call 'pub_priv_sql_capability' filter for plugins with different post types.
  *
  * @param string $post_type currently only supports 'post' or 'page'.
  * @return string SQL code that can be added to a where clause.
  *
  * @param string $post_type currently only supports 'post' or 'page'.
  * @return string SQL code that can be added to a where clause.
@@ -2676,12 +2819,12 @@ function get_private_posts_cap_sql($post_type) {
 }
 
 /**
 }
 
 /**
- * get_lastpostdate() - {@internal Missing Short Description}}
+ * Retrieve the date the the last post was published.
  *
  *
- * {@internal Missing Long Description}}
+ * The server timezone is the default and is the difference between GMT and
+ * server time. The 'blog' value is the date when the last post was posted. The
+ * 'gmt' is when the last post was posted in GMT formatted date.
  *
  *
- * @package WordPress
- * @subpackage Post
  * @since 0.71
  *
  * @uses $wpdb
  * @since 0.71
  *
  * @uses $wpdb
@@ -2717,20 +2860,18 @@ function get_lastpostdate($timezone = 'server') {
 }
 
 /**
 }
 
 /**
- * get_lastpostmodified() - {@internal Missing Short Description}}
+ * Retrieve last post modified date depending on timezone.
  *
  *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 1.2
+ * The server timezone is the default and is the difference between GMT and
+ * server time. The 'blog' value is just when the last post was modified. The
+ * 'gmt' is when the last post was modified in GMT time.
  *
  *
+ * @since 1.2.0
  * @uses $wpdb
  * @uses $blog_id
  * @uses apply_filters() Calls 'get_lastpostmodified' filter
  *
  * @global mixed $cache_lastpostmodified Stores the date the last post was modified
  * @uses $wpdb
  * @uses $blog_id
  * @uses apply_filters() Calls 'get_lastpostmodified' filter
  *
  * @global mixed $cache_lastpostmodified Stores the date the last post was modified
- * @global mixed $pagenow The current page being viewed
  *
  * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
  * @return string The date the post was last modified.
  *
  * @param string $timezone The location to get the time. Can be 'gmt', 'blog', or 'server'.
  * @return string The date the post was last modified.
@@ -2762,9 +2903,9 @@ function get_lastpostmodified($timezone = 'server') {
 }
 
 /**
 }
 
 /**
- * update_post_cache() - Updates posts in cache
+ * Updates posts in cache.
  *
  *
- * @usedby update_page_cache() update_page_cache() aliased by this function.
+ * @usedby update_page_cache() Aliased by this function.
  *
  * @package WordPress
  * @subpackage Cache
  *
  * @package WordPress
  * @subpackage Cache
@@ -2781,21 +2922,25 @@ function update_post_cache(&$posts) {
 }
 
 /**
 }
 
 /**
- * clean_post_cache() - Will clean the post in the cache
+ * Will clean the post in the cache.
  *
  *
- * 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.
  *
  * @package WordPress
  * @subpackage Cache
  *
  * @package WordPress
  * @subpackage Cache
- * @since 2.0
+ * @since 2.0.0
  *
  * @uses do_action() Will call the 'clean_post_cache' hook action.
  *
  * @param int $id The Post ID in the cache to clean
  */
 function clean_post_cache($id) {
  *
  * @uses do_action() Will call the 'clean_post_cache' hook action.
  *
  * @param int $id The Post ID in the cache to clean
  */
 function clean_post_cache($id) {
-       global $wpdb;
+       global $_wp_suspend_cache_invalidation, $wpdb;
+
+       if ( !empty($_wp_suspend_cache_invalidation) )
+               return;
+
        $id = (int) $id;
 
        wp_cache_delete($id, 'posts');
        $id = (int) $id;
 
        wp_cache_delete($id, 'posts');
@@ -2814,7 +2959,7 @@ function clean_post_cache($id) {
 }
 
 /**
 }
 
 /**
- * update_page_cache() - Alias of update_post_cache()
+ * Alias of update_post_cache().
  *
  * @see update_post_cache() Posts and pages are the same, alias is intentional
  *
  *
  * @see update_post_cache() Posts and pages are the same, alias is intentional
  *
@@ -2829,14 +2974,14 @@ function update_page_cache(&$pages) {
 }
 
 /**
 }
 
 /**
- * clean_page_cache() - Will clean the page in the cache
+ * Will clean the page in the cache.
  *
  *
- * Clean (read: delete) page from cache that matches $id. Will also clean
- * cache associated with 'all_page_ids' and 'get_pages'.
+ * Clean (read: delete) page from cache that matches $id. Will also clean cache
+ * associated with 'all_page_ids' and 'get_pages'.
  *
  * @package WordPress
  * @subpackage Cache
  *
  * @package WordPress
  * @subpackage Cache
- * @since 2.0
+ * @since 2.0.0
  *
  * @uses do_action() Will call the 'clean_page_cache' hook action.
  *
  *
  * @uses do_action() Will call the 'clean_page_cache' hook action.
  *
@@ -2852,11 +2997,11 @@ function clean_page_cache($id) {
 }
 
 /**
 }
 
 /**
- * update_post_caches() - Call major cache updating functions for list of Post objects.
+ * Call major cache updating functions for list of Post objects.
  *
  * @package WordPress
  * @subpackage Cache
  *
  * @package WordPress
  * @subpackage Cache
- * @since 1.5
+ * @since 1.5.0
  *
  * @uses $wpdb
  * @uses update_post_cache()
  *
  * @uses $wpdb
  * @uses update_post_cache()
@@ -2883,18 +3028,20 @@ function update_post_caches(&$posts) {
 }
 
 /**
 }
 
 /**
- * update_postmeta_cache() - {@internal Missing Short Description}}
+ * Updates metadata cache for list of post IDs.
  *
  *
- * {@internal Missing Long Description}}
+ * Performs SQL query to retrieve the metadata for the post IDs and updates the
+ * metadata cache for the posts. Therefore, the functions, which call this
+ * function, do not need to perform SQL queries on their own.
  *
  * @package WordPress
  * @subpackage Cache
  *
  * @package WordPress
  * @subpackage Cache
- * @since 2.1
+ * @since 2.1.0
  *
  * @uses $wpdb
  *
  *
  * @uses $wpdb
  *
- * @param array $post_ids {@internal Missing Description}}
- * @return bool|array Returns false if there is nothing to update or an array of metadata
+ * @param array $post_ids List of post IDs.
+ * @return bool|array Returns false if there is nothing to update or an array of metadata.
  */
 function update_postmeta_cache($post_ids) {
        global $wpdb;
  */
 function update_postmeta_cache($post_ids) {
        global $wpdb;
@@ -2921,7 +3068,7 @@ function update_postmeta_cache($post_ids) {
        // Get post-meta info
        $id_list = join(',', $ids);
        $cache = array();
        // Get post-meta info
        $id_list = join(',', $ids);
        $cache = array();
-       if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN ($id_list) ORDER BY post_id, meta_key", ARRAY_A) ) {
+       if ( $meta_list = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM $wpdb->postmeta WHERE post_id IN ($id_list)", ARRAY_A) ) {
                foreach ( (array) $meta_list as $metarow) {
                        $mpid = (int) $metarow['post_id'];
                        $mkey = $metarow['meta_key'];
                foreach ( (array) $meta_list as $metarow) {
                        $mpid = (int) $metarow['post_id'];
                        $mkey = $metarow['meta_key'];
@@ -2943,7 +3090,7 @@ function update_postmeta_cache($post_ids) {
                        $cache[$id] = array();
        }
 
                        $cache[$id] = array();
        }
 
-       foreach ( array_keys($cache) as $post)
+       foreach ( (array) array_keys($cache) as $post)
                wp_cache_set($post, $cache[$post], 'post_meta');
 
        return $cache;
                wp_cache_set($post, $cache[$post], 'post_meta');
 
        return $cache;
@@ -2954,18 +3101,14 @@ function update_postmeta_cache($post_ids) {
 //
 
 /**
 //
 
 /**
- * _transition_post_status() - Hook {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * Hook for managing future post transitions to published.
  *
  *
+ * @since 2.3.0
+ * @access private
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param string $new_status {@internal Missing Description}}
- * @param string $old_status {@internal Missing Description}}
+ * @param string $new_status New post status
+ * @param string $old_status Previous post status
  * @param object $post Object type containing the post information
  */
 function _transition_post_status($new_status, $old_status, $post) {
  * @param object $post Object type containing the post information
  */
 function _transition_post_status($new_status, $old_status, $post) {
@@ -2983,15 +3126,13 @@ function _transition_post_status($new_status, $old_status, $post) {
 }
 
 /**
 }
 
 /**
- * _future_post_hook() - Hook used to schedule publication for a post marked for the future.
+ * Hook used to schedule publication for a post marked for the future.
  *
  * The $post properties used and must exist are 'ID' and 'post_date_gmt'.
  *
  *
  * The $post properties used and must exist are 'ID' and 'post_date_gmt'.
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * @since 2.3.0
  *
  *
- * @param int $post_id Not Used. Can be set to null.
+ * @param int $deprecated Not Used. Can be set to null.
  * @param object $post Object type containing the post information
  */
 function _future_post_hook($deprecated = '', $post) {
  * @param object $post Object type containing the post information
  */
 function _future_post_hook($deprecated = '', $post) {
@@ -3000,14 +3141,9 @@ function _future_post_hook($deprecated = '', $post) {
 }
 
 /**
 }
 
 /**
- * _publish_post_hook() - Hook {@internal Missing Short Description}}
- *
- * {@internal Missing Long Description}}
- *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * Hook to schedule pings and enclosures when a post is published.
  *
  *
+ * @since 2.3.0
  * @uses $wpdb
  * @uses XMLRPC_REQUEST
  * @uses APP_REQUEST
  * @uses $wpdb
  * @uses XMLRPC_REQUEST
  * @uses APP_REQUEST
@@ -3035,19 +3171,18 @@ function _publish_post_hook($post_id) {
 }
 
 /**
 }
 
 /**
- * _save_post_hook() - Hook used to prevent page/post cache and rewrite rules from staying dirty
- *
- * Does two things. If the post is a page and has a template then it will update/add that
- * template to the meta. For both pages and posts, it will clean the post cache to make sure
- * that the cache updates to the changes done recently. For pages, the rewrite rules of
- * WordPress are flushed to allow for any changes.
+ * Hook used to prevent page/post cache and rewrite rules from staying dirty.
  *
  *
- * The $post parameter, only uses 'post_type' property and 'page_template' property.
+ * Does two things. If the post is a page and has a template then it will
+ * update/add that template to the meta. For both pages and posts, it will clean
+ * the post cache to make sure that the cache updates to the changes done
+ * recently. For pages, the rewrite rules of WordPress are flushed to allow for
+ * any changes.
  *
  *
- * @package WordPress
- * @subpackage Post
- * @since 2.3
+ * The $post parameter, only uses 'post_type' property and 'page_template'
+ * property.
  *
  *
+ * @since 2.3.0
  * @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
@@ -3056,17 +3191,35 @@ function _publish_post_hook($post_id) {
 function _save_post_hook($post_id, $post) {
        if ( $post->post_type == 'page' ) {
                clean_page_cache($post_id);
 function _save_post_hook($post_id, $post) {
        if ( $post->post_type == 'page' ) {
                clean_page_cache($post_id);
-               global $wp_rewrite;
-               $wp_rewrite->flush_rules();
+               // Avoid flushing rules for every post during import.
+               if ( !defined('WP_IMPORTING') ) {
+                       global $wp_rewrite;
+                       $wp_rewrite->flush_rules();
+               }
        } else {
                clean_post_cache($post_id);
        }
 }
 
        } else {
                clean_post_cache($post_id);
        }
 }
 
-//
-// Private
-//
-
+/**
+ * Retrieve post ancestors and append to post ancestors property.
+ *
+ * Will only retrieve ancestors once, if property is already set, then nothing
+ * will be done. If there is not a parent post, or post ID and post parent ID
+ * are the same then nothing will be done.
+ *
+ * The parameter is passed by reference, so nothing needs to be returned. The
+ * property will be updated and can be referenced after the function is
+ * 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
+ * @uses $wpdb
+ *
+ * @param object $_post Post data.
+ * @return null When nothing needs to be done.
+ */
 function _get_post_ancestors(&$_post) {
        global $wpdb;
 
 function _get_post_ancestors(&$_post) {
        global $wpdb;
 
@@ -3086,22 +3239,21 @@ function _get_post_ancestors(&$_post) {
        }
 }
 
        }
 }
 
-/* Post Revisions */
-
 /**
 /**
- * _wp_post_revision_fields() - determines which fields of posts are to be saved in revisions
+ * Determines which fields of posts are to be saved in revisions.
  *
  *
- * Does two things. If passed a post *array*, it will return a post array ready to be
- * insterted into the posts table as a post revision.
- * Otherwise, returns an array whose keys are the post fields to be saved for post revisions.
+ * Does two things. If passed a post *array*, it will return a post array ready
+ * to be insterted into the posts table as a post revision. Otherwise, returns
+ * an array whose keys are the post fields to be saved for post revisions.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
+ * @access private
  *
  *
- * @param array $post optional a post array to be processed for insertion as a post revision
+ * @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 bool $autosave optional Is the revision an autosave?
- * @return array post array ready to be inserted as a post revision or array of fields that can be versioned
+ * @return array Post array ready to be inserted as a post revision or array of fields that can be versioned.
  */
 function _wp_post_revision_fields( $post = null, $autosave = false ) {
        static $fields = false;
  */
 function _wp_post_revision_fields( $post = null, $autosave = false ) {
        static $fields = false;
@@ -3133,23 +3285,25 @@ function _wp_post_revision_fields( $post = null, $autosave = false ) {
        $return['post_status']   = 'inherit';
        $return['post_type']     = 'revision';
        $return['post_name']     = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision";
        $return['post_status']   = 'inherit';
        $return['post_type']     = 'revision';
        $return['post_name']     = $autosave ? "$post[ID]-autosave" : "$post[ID]-revision";
-       $return['post_date']     = $post['post_modified'];
-       $return['post_date_gmt'] = $post['post_modified_gmt'];
+       $return['post_date']     = isset($post['post_modified']) ? $post['post_modified'] : '';
+       $return['post_date_gmt'] = isset($post['post_modified_gmt']) ? $post['post_modified_gmt'] : '';
 
        return $return;
 }
 
 /**
 
        return $return;
 }
 
 /**
- * wp_save_post_revision() - Saves an already existing post as a post revision.  Typically used immediately prior to post updates.
+ * Saves an already existing post as a post revision.
+ *
+ * Typically used immediately prior to post updates.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses _wp_put_post_revision()
  *
  *
  * @uses _wp_put_post_revision()
  *
- * @param int $post_id The ID of the post to save as a revision
- * @return mixed null or 0 if error, new revision ID if success
+ * @param int $post_id The ID of the post to save as a revision.
+ * @return mixed Null or 0 if error, new revision ID, if success.
  */
 function wp_save_post_revision( $post_id ) {
        // We do autosaves manually with wp_create_post_autosave()
  */
 function wp_save_post_revision( $post_id ) {
        // We do autosaves manually with wp_create_post_autosave()
@@ -3193,19 +3347,20 @@ function wp_save_post_revision( $post_id ) {
 }
 
 /**
 }
 
 /**
- * wp_get_post_autosave() - returns the autosaved data of the specified post.
+ * Retrieve the autosaved data of the specified post.
  *
  *
- * Returns a post object containing the information that was autosaved for the specified post.
+ * Returns a post object containing the information that was autosaved for the
+ * specified post.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  *
- * @param int $post_id The post ID
- * @return object|bool the autosaved data or false on failure or when no autosave exists
+ * @param int $post_id The post ID.
+ * @return object|bool The autosaved data or false on failure or when no autosave exists.
  */
 function wp_get_post_autosave( $post_id ) {
  */
 function wp_get_post_autosave( $post_id ) {
-       global $wpdb;
+
        if ( !$post = get_post( $post_id ) )
                return false;
 
        if ( !$post = get_post( $post_id ) )
                return false;
 
@@ -3229,21 +3384,28 @@ function wp_get_post_autosave( $post_id ) {
        return false;
 }
 
        return false;
 }
 
-// Internally used to hack WP_Query into submission
+/**
+ * Internally used to hack WP_Query into submission.
+ *
+ * @package WordPress
+ * @subpackage Post_Revisions
+ * @since 2.6.0
+ *
+ * @param object $query WP_Query object
+ */
 function _wp_get_post_autosave_hack( $query ) {
        $query->is_single = false;
 }
 
 function _wp_get_post_autosave_hack( $query ) {
        $query->is_single = false;
 }
 
-
 /**
 /**
- * wp_is_post_revision() - Determines if the specified post is a revision.
+ * Determines if the specified post is a revision.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  *
- * @param int|object $post post ID or post object
- * @return bool|int false if not a revision, ID of revision's parent otherwise
+ * @param int|object $post Post ID or post object.
+ * @return bool|int False if not a revision, ID of revision's parent otherwise.
  */
 function wp_is_post_revision( $post ) {
        if ( !$post = wp_get_post_revision( $post ) )
  */
 function wp_is_post_revision( $post ) {
        if ( !$post = wp_get_post_revision( $post ) )
@@ -3252,14 +3414,14 @@ function wp_is_post_revision( $post ) {
 }
 
 /**
 }
 
 /**
- * wp_is_post_autosave() - Determines if the specified post is an autosave.
+ * Determines if the specified post is an autosave.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  *
- * @param int|object $post post ID or post object
- * @return bool|int false if not a revision, ID of autosave's parent otherwise
+ * @param int|object $post Post ID or post object.
+ * @return bool|int False if not a revision, ID of autosave's parent otherwise
  */
 function wp_is_post_autosave( $post ) {
        if ( !$post = wp_get_post_revision( $post ) )
  */
 function wp_is_post_autosave( $post ) {
        if ( !$post = wp_get_post_revision( $post ) )
@@ -3270,17 +3432,17 @@ function wp_is_post_autosave( $post ) {
 }
 
 /**
 }
 
 /**
- * _wp_put_post_revision() - Inserts post data into the posts table as a post revision
+ * Inserts post data into the posts table as a post revision.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses wp_insert_post()
  *
  *
  * @uses wp_insert_post()
  *
- * @param int|object|array $post post ID, post object OR post array
- * @param bool $autosave optional Is the revision an autosave?
- * @return mixed null or 0 if error, new revision ID if success
+ * @param int|object|array $post Post ID, post object OR post array.
+ * @param bool $autosave Optional. Is the revision an autosave?
+ * @return mixed Null or 0 if error, new revision ID if success.
  */
 function _wp_put_post_revision( $post = null, $autosave = false ) {
        if ( is_object($post) )
  */
 function _wp_put_post_revision( $post = null, $autosave = false ) {
        if ( is_object($post) )
@@ -3305,18 +3467,18 @@ function _wp_put_post_revision( $post = null, $autosave = false ) {
 }
 
 /**
 }
 
 /**
- * wp_get_post_revision() - Gets a post revision
+ * Gets a post revision.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses get_post()
  *
  *
  * @uses get_post()
  *
- * @param int|object $post post ID or post object
- * @param $output optional OBJECT, ARRAY_A, or ARRAY_N
- * @param string $filter optional sanitation filter.  @see sanitize_post()
- * @return mixed null if error or post object if success
+ * @param int|object $post Post ID or post object
+ * @param string $output Optional. OBJECT, ARRAY_A, or ARRAY_N.
+ * @param string $filter Optional sanitation filter.  @see sanitize_post()
+ * @return mixed Null if error or post object if success
  */
 function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
        $null = null;
  */
 function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
        $null = null;
@@ -3339,20 +3501,21 @@ function &wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
 }
 
 /**
 }
 
 /**
- * wp_restore_post_revision() - 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 using all fields of the post revision, or only selected
+ * fields.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses wp_get_post_revision()
  * @uses wp_update_post()
  *
  *
  * @uses wp_get_post_revision()
  * @uses wp_update_post()
  *
- * @param int|object $revision_id revision ID or revision object
- * @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
+ * @param int|object $revision_id Revision ID or revision object.
+ * @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 ) {
        if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
  */
 function wp_restore_post_revision( $revision_id, $fields = null ) {
        if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
@@ -3381,20 +3544,20 @@ function wp_restore_post_revision( $revision_id, $fields = null ) {
 }
 
 /**
 }
 
 /**
- * wp_delete_post_revision() - Deletes a revision.
+ * Deletes a revision.
  *
  *
- * Deletes the row from the posts table corresponding to the specified revision
+ * Deletes the row from the posts table corresponding to the specified revision.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses wp_get_post_revision()
  * @uses wp_delete_post()
  *
  *
  * @uses wp_get_post_revision()
  * @uses wp_delete_post()
  *
- * @param int|object $revision_id revision ID or revision object
- * @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
+ * @param int|object $revision_id Revision ID or revision object.
+ * @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_delete_post_revision( $revision_id ) {
        if ( !$revision = wp_get_post_revision( $revision_id ) )
  */
 function wp_delete_post_revision( $revision_id ) {
        if ( !$revision = wp_get_post_revision( $revision_id ) )
@@ -3411,15 +3574,15 @@ function wp_delete_post_revision( $revision_id ) {
 }
 
 /**
 }
 
 /**
- * wp_get_post_revisions() - Returns all revisions of specified post
+ * Returns all revisions of specified post.
  *
  * @package WordPress
  *
  * @package WordPress
- * @subpackage Post Revisions
- * @since 2.6
+ * @subpackage Post_Revisions
+ * @since 2.6.0
  *
  * @uses get_children()
  *
  *
  * @uses get_children()
  *
- * @param int|object $post_id post ID or post object
+ * @param int|object $post_id Post ID or post object
  * @return array empty if no revisions
  */
 function wp_get_post_revisions( $post_id = 0, $args = null ) {
  * @return array empty if no revisions
  */
 function wp_get_post_revisions( $post_id = 0, $args = null ) {
@@ -3436,3 +3599,34 @@ function wp_get_post_revisions( $post_id = 0, $args = null ) {
                return array();
        return $revisions;
 }
                return array();
        return $revisions;
 }
+
+function _set_preview($post) {
+
+       if ( ! is_object($post) )
+               return $post;
+
+       $preview = wp_get_post_autosave($post->ID);
+
+       if ( ! is_object($preview) )
+               return $post;
+
+       $preview = sanitize_post($preview);
+
+       $post->post_content = $preview->post_content;
+       $post->post_title = $preview->post_title;
+       $post->post_excerpt = $preview->post_excerpt;
+
+       return $post;
+}
+
+function _show_post_preview() {
+
+       if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
+               $id = (int) $_GET['preview_id'];
+
+               if ( false == wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
+                       wp_die( __('You do not have permission to preview drafts.') );
+
+               add_filter('the_preview', '_set_preview');
+       }
+}
index 40208f338d22056b5ee15837871869a42e0bf969..96f795bbd96f13990af95c2e92bf7f99664476fa 100644 (file)
@@ -1,27 +1,77 @@
 <?php
 <?php
-
-/*
- * The Big Query.
+/**
+ * WordPress Query API
+ *
+ * The query API attempts to get which part of WordPress to the user is on. It
+ * also provides functionality to getting URL query information.
+ *
+ * @link http://codex.wordpress.org/The_Loop More information on The Loop.
+ *
+ * @package WordPress
+ * @subpackage Query
  */
 
  */
 
+/**
+ * Retrieve variable in the WP_Query class.
+ *
+ * @see WP_Query::get()
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @param string $var The variable key to retrieve.
+ * @return mixed
+ */
 function get_query_var($var) {
        global $wp_query;
 
        return $wp_query->get($var);
 }
 
 function get_query_var($var) {
        global $wp_query;
 
        return $wp_query->get($var);
 }
 
+/**
+ * Set query variable.
+ *
+ * @see WP_Query::set()
+ * @since 2.2.0
+ * @uses $wp_query
+ *
+ * @param string $var Query variable key.
+ * @param mixed $value
+ * @return null
+ */
 function set_query_var($var, $value) {
        global $wp_query;
 
        return $wp_query->set($var, $value);
 }
 
 function set_query_var($var, $value) {
        global $wp_query;
 
        return $wp_query->set($var, $value);
 }
 
+/**
+ * Setup The Loop with query parameters.
+ *
+ * This will override the current WordPress Loop and shouldn't be used more than
+ * once. This must not be used within the WordPress Loop.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @param string $query
+ * @return array List of posts
+ */
 function &query_posts($query) {
        unset($GLOBALS['wp_query']);
        $GLOBALS['wp_query'] =& new WP_Query();
        return $GLOBALS['wp_query']->query($query);
 }
 
 function &query_posts($query) {
        unset($GLOBALS['wp_query']);
        $GLOBALS['wp_query'] =& new WP_Query();
        return $GLOBALS['wp_query']->query($query);
 }
 
+/**
+ * Destroy the previous query and setup a new query.
+ *
+ * This should be used after {@link query_posts()} and before another {@link
+ * query_posts()}. This will remove obscure bugs that occur when the previous
+ * wp_query object is not destroyed properly before another is setup.
+ *
+ * @since 2.3.0
+ * @uses $wp_query
+ */
 function wp_reset_query() {
        unset($GLOBALS['wp_query']);
        $GLOBALS['wp_query'] =& $GLOBALS['wp_the_query'];
 function wp_reset_query() {
        unset($GLOBALS['wp_query']);
        $GLOBALS['wp_query'] =& $GLOBALS['wp_the_query'];
@@ -36,24 +86,70 @@ function wp_reset_query() {
  * Query type checks.
  */
 
  * Query type checks.
  */
 
+/**
+ * Whether the current request is in WordPress admin Panel
+ *
+ * Does not inform on whether the user is an admin! Use capability checks to
+ * tell if the user should be accessing a section or not.
+ *
+ * @since 1.5.1
+ *
+ * @return bool True if inside WordPress administration pages.
+ */
 function is_admin () {
        if ( defined('WP_ADMIN') )
                return WP_ADMIN;
        return false;
 }
 
 function is_admin () {
        if ( defined('WP_ADMIN') )
                return WP_ADMIN;
        return false;
 }
 
+/**
+ * Is query requesting an archive page.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool True if page is archive.
+ */
 function is_archive () {
        global $wp_query;
 
        return $wp_query->is_archive;
 }
 
 function is_archive () {
        global $wp_query;
 
        return $wp_query->is_archive;
 }
 
+/**
+ * Is query requesting an attachment page.
+ *
+ * @since 2.0.0
+ * @uses $wp_query
+ *
+ * @return bool True if page is attachment.
+ */
 function is_attachment () {
        global $wp_query;
 
        return $wp_query->is_attachment;
 }
 
 function is_attachment () {
        global $wp_query;
 
        return $wp_query->is_attachment;
 }
 
+/**
+ * Is query requesting an author page.
+ *
+ * If the $author parameter is specified then the check will be expanded to
+ * include whether the queried author matches the one given in the parameter.
+ * You can match against integers and against strings.
+ *
+ * If matching against an integer, the ID should be used of the author for the
+ * test. If the $author is an ID and matches the author page user ID, then
+ * 'true' will be returned.
+ *
+ * If matching against strings, then the test will be matched against both the
+ * nickname and user nicename and will return true on success.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @param string|int $author Optional. Is current page this author.
+ * @return bool True if page is author or $author (if set).
+ */
 function is_author ($author = '') {
        global $wp_query;
 
 function is_author ($author = '') {
        global $wp_query;
 
@@ -77,6 +173,18 @@ function is_author ($author = '') {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether current page query contains a category name or given category name.
+ *
+ * The category list can contain category IDs, names, or category slugs. If any
+ * of them are part of the query, then it will return true.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @param string|array $category Optional.
+ * @return bool
+ */
 function is_category ($category = '') {
        global $wp_query;
 
 function is_category ($category = '') {
        global $wp_query;
 
@@ -100,6 +208,15 @@ function is_category ($category = '') {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether the current page query has the given tag slug or contains tag.
+ *
+ * @since 2.3.0
+ * @uses $wp_query
+ *
+ * @param string|array $slug Optional. Single tag or list of tags to check for.
+ * @return bool
+ */
 function is_tag( $slug = '' ) {
        global $wp_query;
 
 function is_tag( $slug = '' ) {
        global $wp_query;
 
@@ -119,9 +236,18 @@ function is_tag( $slug = '' ) {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether the current page query has the given taxonomy slug or contains taxonomy.
+ *
+ * @since 2.5.0
+ * @uses $wp_query
+ *
+ * @param string|array $slug Optional. Slug or slugs to check in current query.
+ * @return bool
+ */
 function is_tax( $slug = '' ) {
        global $wp_query;
 function is_tax( $slug = '' ) {
        global $wp_query;
-       
+
        if ( !$wp_query->is_tax )
                return false;
 
        if ( !$wp_query->is_tax )
                return false;
 
@@ -138,24 +264,56 @@ function is_tax( $slug = '' ) {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether the current URL is within the comments popup window.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_comments_popup () {
        global $wp_query;
 
        return $wp_query->is_comments_popup;
 }
 
 function is_comments_popup () {
        global $wp_query;
 
        return $wp_query->is_comments_popup;
 }
 
+/**
+ * Whether current URL is based on a date.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_date () {
        global $wp_query;
 
        return $wp_query->is_date;
 }
 
 function is_date () {
        global $wp_query;
 
        return $wp_query->is_date;
 }
 
+/**
+ * Whether current blog URL contains a day.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_day () {
        global $wp_query;
 
        return $wp_query->is_day;
 }
 
 function is_day () {
        global $wp_query;
 
        return $wp_query->is_day;
 }
 
+/**
+ * Whether current page query is feed URL.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_feed () {
        global $wp_query;
 
 function is_feed () {
        global $wp_query;
 
@@ -163,13 +321,13 @@ function is_feed () {
 }
 
 /**
 }
 
 /**
- * is_front_page() - Is it the front of the site, whether blog view or a WP Page?
+ * Whether current page query is the front of the site.
  *
  *
- * @since 2.5
- * @uses is_home
- * @uses get_option
+ * @since 2.5.0
+ * @uses is_home()
+ * @uses get_option()
  *
  *
- * @return bool True if front of site
+ * @return bool True, if front of site.
  */
 function is_front_page () {
        // most likely case
  */
 function is_front_page () {
        // most likely case
@@ -182,12 +340,12 @@ function is_front_page () {
 }
 
 /**
 }
 
 /**
- * is_home() - Is it the blog view homepage?
+ * Whether current page view is the blog homepage.
  *
  *
- * @since 2.1
- * @global object $wp_query
+ * @since 1.5.0
+ * @uses $wp_query
  *
  *
- * @return bool True if blog view homepage
+ * @return bool True if blog view homepage.
  */
 function is_home () {
        global $wp_query;
  */
 function is_home () {
        global $wp_query;
@@ -195,12 +353,37 @@ function is_home () {
        return $wp_query->is_home;
 }
 
        return $wp_query->is_home;
 }
 
+/**
+ * Whether current page query contains a month.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_month () {
        global $wp_query;
 
        return $wp_query->is_month;
 }
 
 function is_month () {
        global $wp_query;
 
        return $wp_query->is_month;
 }
 
+/**
+ * Whether query is page or contains given page(s).
+ *
+ * Calls the function without any parameters will only test whether the current
+ * query is of the page type. Either a list or a single item can be tested
+ * against for whether the query is a page and also is the value or one of the
+ * values in the page parameter.
+ *
+ * The parameter can contain the page ID, page title, or page name. The
+ * parameter can also be an array of those three values.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @param mixed $page Either page or list of pages to test against.
+ * @return bool
+ */
 function is_page ($page = '') {
        global $wp_query;
 
 function is_page ($page = '') {
        global $wp_query;
 
@@ -214,7 +397,7 @@ function is_page ($page = '') {
 
        $page = (array) $page;
 
 
        $page = (array) $page;
 
-    if ( in_array( $page_obj->ID, $page ) )
+       if ( in_array( $page_obj->ID, $page ) )
                return true;
        elseif ( in_array( $page_obj->post_title, $page ) )
                return true;
                return true;
        elseif ( in_array( $page_obj->post_title, $page ) )
                return true;
@@ -224,12 +407,31 @@ function is_page ($page = '') {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether query contains multiple pages for the results.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_paged () {
        global $wp_query;
 
        return $wp_query->is_paged;
 }
 
 function is_paged () {
        global $wp_query;
 
        return $wp_query->is_paged;
 }
 
+/**
+ * Whether the current page was created by a plugin.
+ *
+ * The plugin can set this by using the global $plugin_page and setting it to
+ * true.
+ *
+ * @since 1.5.0
+ * @global bool $plugin_page Used by plugins to tell the query that current is a plugin page.
+ *
+ * @return bool
+ */
 function is_plugin_page() {
        global $plugin_page;
 
 function is_plugin_page() {
        global $plugin_page;
 
@@ -239,24 +441,63 @@ function is_plugin_page() {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether the current query is preview of post or page.
+ *
+ * @since 2.0.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_preview() {
        global $wp_query;
 
        return $wp_query->is_preview;
 }
 
 function is_preview() {
        global $wp_query;
 
        return $wp_query->is_preview;
 }
 
+/**
+ * Whether the current query post is robots.
+ *
+ * @since 2.1.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_robots() {
        global $wp_query;
 
        return $wp_query->is_robots;
 }
 
 function is_robots() {
        global $wp_query;
 
        return $wp_query->is_robots;
 }
 
+/**
+ * Whether current query is the result of a user search.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_search () {
        global $wp_query;
 
        return $wp_query->is_search;
 }
 
 function is_search () {
        global $wp_query;
 
        return $wp_query->is_search;
 }
 
+/**
+ * Whether the current page query is single page.
+ *
+ * The parameter can contain the post ID, post title, or post name. The
+ * parameter can also be an array of those three values.
+ *
+ * This applies to other post types, attachments, pages, posts. Just means that
+ * the current query has only a single object.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @param mixed $post Either post or list of posts to test against.
+ * @return bool
+ */
 function is_single ($post = '') {
        global $wp_query;
 
 function is_single ($post = '') {
        global $wp_query;
 
@@ -280,30 +521,70 @@ function is_single ($post = '') {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether is single post, is a page, or is an attachment.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_singular() {
        global $wp_query;
 
        return $wp_query->is_singular;
 }
 
 function is_singular() {
        global $wp_query;
 
        return $wp_query->is_singular;
 }
 
+/**
+ * Whether the query contains a time.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_time () {
        global $wp_query;
 
        return $wp_query->is_time;
 }
 
 function is_time () {
        global $wp_query;
 
        return $wp_query->is_time;
 }
 
+/**
+ * Whether the query is a trackback.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_trackback () {
        global $wp_query;
 
        return $wp_query->is_trackback;
 }
 
 function is_trackback () {
        global $wp_query;
 
        return $wp_query->is_trackback;
 }
 
+/**
+ * Whether the query contains a year.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function is_year () {
        global $wp_query;
 
        return $wp_query->is_year;
 }
 
 function is_year () {
        global $wp_query;
 
        return $wp_query->is_year;
 }
 
+/**
+ * Whether current page query is a 404 and no results for WordPress query.
+ *
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool True, if nothing is found matching WordPress Query.
+ */
 function is_404 () {
        global $wp_query;
 
 function is_404 () {
        global $wp_query;
 
@@ -314,24 +595,57 @@ function is_404 () {
  * The Loop.  Post loop control.
  */
 
  * The Loop.  Post loop control.
  */
 
+/**
+ * Whether current WordPress query has results to loop over.
+ *
+ * @see WP_Query::have_posts()
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function have_posts() {
        global $wp_query;
 
        return $wp_query->have_posts();
 }
 
 function have_posts() {
        global $wp_query;
 
        return $wp_query->have_posts();
 }
 
+/**
+ * Whether the caller is in the Loop.
+ *
+ * @since 2.0.0
+ * @uses $wp_query
+ *
+ * @return bool True if caller is within loop, false if loop hasn't started or ended.
+ */
 function in_the_loop() {
        global $wp_query;
 
        return $wp_query->in_the_loop;
 }
 
 function in_the_loop() {
        global $wp_query;
 
        return $wp_query->in_the_loop;
 }
 
+/**
+ * Rewind the loop posts.
+ *
+ * @see WP_Query::rewind_posts()
+ * @since 1.5.0
+ * @uses $wp_query
+ *
+ * @return null
+ */
 function rewind_posts() {
        global $wp_query;
 
        return $wp_query->rewind_posts();
 }
 
 function rewind_posts() {
        global $wp_query;
 
        return $wp_query->rewind_posts();
 }
 
+/**
+ * Iterate the post index in the loop.
+ *
+ * @see WP_Query::the_post()
+ * @since 1.5.0
+ * @uses $wp_query
+ */
 function the_post() {
        global $wp_query;
 
 function the_post() {
        global $wp_query;
 
@@ -342,11 +656,29 @@ function the_post() {
  * Comments loop.
  */
 
  * Comments loop.
  */
 
+/**
+ * Whether there are comments to loop over.
+ *
+ * @see WP_Query::have_comments()
+ * @since 2.2.0
+ * @uses $wp_query
+ *
+ * @return bool
+ */
 function have_comments() {
        global $wp_query;
        return $wp_query->have_comments();
 }
 
 function have_comments() {
        global $wp_query;
        return $wp_query->have_comments();
 }
 
+/**
+ * Iterate comment index in the comment loop.
+ *
+ * @see WP_Query::the_comment()
+ * @since 2.2.0
+ * @uses $wp_query
+ *
+ * @return object
+ */
 function the_comment() {
        global $wp_query;
        return $wp_query->the_comment();
 function the_comment() {
        global $wp_query;
        return $wp_query->the_comment();
@@ -356,53 +688,405 @@ function the_comment() {
  * WP_Query
  */
 
  * WP_Query
  */
 
+/**
+ * The WordPress Query class.
+ *
+ * @link http://codex.wordpress.org/Function_Reference/WP_Query Codex page.
+ *
+ * @since 1.5.0
+ */
 class WP_Query {
 class WP_Query {
+
+       /**
+        * Query string
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $query;
        var $query;
+
+       /**
+        * Query search variables set by the user.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var array
+        */
        var $query_vars = array();
        var $query_vars = array();
+
+       /**
+        * Holds the data for a single object that is queried.
+        *
+        * Holds the contents of a post, page, category, attachment.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var object|array
+        */
        var $queried_object;
        var $queried_object;
+
+       /**
+        * The ID of the queried object.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var int
+        */
        var $queried_object_id;
        var $queried_object_id;
+
+       /**
+        * Get post database query.
+        *
+        * @since 2.0.1
+        * @access public
+        * @var string
+        */
        var $request;
 
        var $request;
 
+       /**
+        * List of posts.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var array
+        */
        var $posts;
        var $posts;
+
+       /**
+        * The amount of posts for the current query.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var int
+        */
        var $post_count = 0;
        var $post_count = 0;
+
+       /**
+        * Index of the current item in the loop.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var int
+        */
        var $current_post = -1;
        var $current_post = -1;
+
+       /**
+        * Whether the loop has started and the caller is in the loop.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var bool
+        */
        var $in_the_loop = false;
        var $in_the_loop = false;
+
+       /**
+        * The current post ID.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var int
+        */
        var $post;
 
        var $post;
 
+       /**
+        * The list of comments for current post.
+        *
+        * @since 2.2.0
+        * @access public
+        * @var array
+        */
        var $comments;
        var $comments;
+
+       /**
+        * The amount of comments for the posts.
+        *
+        * @since 2.2.0
+        * @access public
+        * @var int
+        */
        var $comment_count = 0;
        var $comment_count = 0;
+
+       /**
+        * The index of the comment in the comment loop.
+        *
+        * @since 2.2.0
+        * @access public
+        * @var int
+        */
        var $current_comment = -1;
        var $current_comment = -1;
+
+       /**
+        * Current comment ID.
+        *
+        * @since 2.2.0
+        * @access public
+        * @var int
+        */
        var $comment;
 
        var $comment;
 
+       /**
+        * Amount of posts if limit clause was not used.
+        *
+        * @since 2.1.0
+        * @access public
+        * @var int
+        */
        var $found_posts = 0;
        var $found_posts = 0;
+
+       /**
+        * The amount of pages.
+        *
+        * @since 2.1.0
+        * @access public
+        * @var int
+        */
        var $max_num_pages = 0;
 
        var $max_num_pages = 0;
 
+       /**
+        * The amount of comment pages.
+        *
+        * @since 2.7.0
+        * @access public
+        * @var int
+        */
+       var $max_num_comment_pages = 0;
+
+       /**
+        * Set if query is single post.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_single = false;
        var $is_single = false;
+
+       /**
+        * Set if query is preview of blog.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var bool
+        */
        var $is_preview = false;
        var $is_preview = false;
+
+       /**
+        * Set if query returns a page.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_page = false;
        var $is_page = false;
+
+       /**
+        * Set if query is an archive list.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_archive = false;
        var $is_archive = false;
+
+       /**
+        * Set if query is part of a date.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_date = false;
        var $is_date = false;
+
+       /**
+        * Set if query contains a year.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_year = false;
        var $is_year = false;
+
+       /**
+        * Set if query contains a month.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_month = false;
        var $is_month = false;
+
+       /**
+        * Set if query contains a day.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_day = false;
        var $is_day = false;
+
+       /**
+        * Set if query contains time.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_time = false;
        var $is_time = false;
+
+       /**
+        * Set if query contains an author.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_author = false;
        var $is_author = false;
+
+       /**
+        * Set if query contains category.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_category = false;
        var $is_category = false;
+
+       /**
+        * Set if query contains tag.
+        *
+        * @since 2.3.0
+        * @access public
+        * @var bool
+        */
        var $is_tag = false;
        var $is_tag = false;
+
+       /**
+        * Set if query contains taxonomy.
+        *
+        * @since 2.5.0
+        * @access public
+        * @var bool
+        */
        var $is_tax = false;
        var $is_tax = false;
+
+       /**
+        * Set if query was part of a search result.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_search = false;
        var $is_search = false;
+
+       /**
+        * Set if query is feed display.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_feed = false;
        var $is_feed = false;
+
+       /**
+        * Set if query is comment feed display.
+        *
+        * @since 2.2.0
+        * @access public
+        * @var bool
+        */
        var $is_comment_feed = false;
        var $is_comment_feed = false;
+
+       /**
+        * Set if query is trackback.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_trackback = false;
        var $is_trackback = false;
+
+       /**
+        * Set if query is blog homepage.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_home = false;
        var $is_home = false;
+
+       /**
+        * Set if query couldn't found anything.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_404 = false;
        var $is_404 = false;
+
+       /**
+        * Set if query is within comments popup window.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_comments_popup = false;
        var $is_comments_popup = false;
+
+       /**
+        * Set if query is part of administration page.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var bool
+        */
        var $is_admin = false;
        var $is_admin = false;
+
+       /**
+        * Set if query is an attachment.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var bool
+        */
        var $is_attachment = false;
        var $is_attachment = false;
+
+       /**
+        * Set if is single, is a page, or is an attachment.
+        *
+        * @since 2.1.0
+        * @access public
+        * @var bool
+        */
        var $is_singular = false;
        var $is_singular = false;
+
+       /**
+        * Set if query is for robots.
+        *
+        * @since 2.1.0
+        * @access public
+        * @var bool
+        */
        var $is_robots = false;
        var $is_robots = false;
+
+       /**
+        * Set if query contains posts.
+        *
+        * Basically, the homepage if the option isn't set for the static homepage.
+        *
+        * @since 2.1.0
+        * @access public
+        * @var bool
+        */
        var $is_posts_page = false;
 
        var $is_posts_page = false;
 
+       /**
+        * Resets query flags to false.
+        *
+        * The query flags are what page info WordPress was able to figure out.
+        *
+        * @since 2.0.0
+        * @access private
+        */
        function init_query_flags() {
                $this->is_single = false;
                $this->is_page = false;
        function init_query_flags() {
                $this->is_single = false;
                $this->is_page = false;
@@ -430,6 +1114,12 @@ class WP_Query {
                $this->is_posts_page = false;
        }
 
                $this->is_posts_page = false;
        }
 
+       /**
+        * Initiates object properties and sets default values.
+        *
+        * @since 1.5.0
+        * @access public
+        */
        function init () {
                unset($this->posts);
                unset($this->query);
        function init () {
                unset($this->posts);
                unset($this->query);
@@ -443,11 +1133,25 @@ class WP_Query {
                $this->init_query_flags();
        }
 
                $this->init_query_flags();
        }
 
-       // Reparse the query vars.
+       /**
+        * Reparse the query vars.
+        *
+        * @since 1.5.0
+        * @access public
+        */
        function parse_query_vars() {
                $this->parse_query('');
        }
 
        function parse_query_vars() {
                $this->parse_query('');
        }
 
+       /**
+        * Fills in the query variables, which do not exist within the parameter.
+        *
+        * @since 2.1.0
+        * @access public
+        *
+        * @param array $array Defined query variables.
+        * @return array Complete query variables with undefined ones filled in empty.
+        */
        function fill_query_vars($array) {
                $keys = array(
                        'error'
        function fill_query_vars($array) {
                $keys = array(
                        'error'
@@ -472,6 +1176,7 @@ class WP_Query {
                        , 'w'
                        , 'category_name'
                        , 'tag'
                        , 'w'
                        , 'category_name'
                        , 'tag'
+                       , 'cat'
                        , 'tag_id'
                        , 'author_name'
                        , 'feed'
                        , 'tag_id'
                        , 'author_name'
                        , 'feed'
@@ -498,7 +1203,14 @@ class WP_Query {
                return $array;
        }
 
                return $array;
        }
 
-       // Parse a query string and set query type booleans.
+       /**
+        * Parse a query string and set query type booleans.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string|array $query
+        */
        function parse_query ($query) {
                if ( !empty($query) || !isset($this->query) ) {
                        $this->init();
        function parse_query ($query) {
                if ( !empty($query) || !isset($this->query) ) {
                        $this->init();
@@ -523,6 +1235,8 @@ class WP_Query {
                $qv['w'] = absint($qv['w']);
                $qv['m'] = absint($qv['m']);
                $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
                $qv['w'] = absint($qv['w']);
                $qv['m'] = absint($qv['m']);
                $qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
+               $qv['pagename'] = trim( $qv['pagename'] );
+               $qv['name'] = trim( $qv['name'] );
                if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
                if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
                if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
                if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
                if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
                if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
@@ -685,7 +1399,7 @@ class WP_Query {
                        if ( empty($qv['taxonomy']) || empty($qv['term']) ) {
                                $this->is_tax = false;
                                foreach ( $GLOBALS['wp_taxonomies'] as $t ) {
                        if ( empty($qv['taxonomy']) || empty($qv['term']) ) {
                                $this->is_tax = false;
                                foreach ( $GLOBALS['wp_taxonomies'] as $t ) {
-                                       if ( isset($t->query_var) && '' != $qv[$t->query_var] ) {
+                                       if ( isset($t->query_var) && isset($qv[$t->query_var]) && '' != $qv[$t->query_var] ) {
                                                $this->is_tax = true;
                                                break;
                                        }
                                                $this->is_tax = true;
                                                break;
                                        }
@@ -704,7 +1418,7 @@ class WP_Query {
                                $this->is_author = true;
                        }
 
                                $this->is_author = true;
                        }
 
-                       if ( ($this->is_date || $this->is_author || $this->is_category || $this->is_tag ) )
+                       if ( ($this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax) )
                                $this->is_archive = true;
                }
 
                                $this->is_archive = true;
                }
 
@@ -788,6 +1502,12 @@ class WP_Query {
                        do_action_ref_array('parse_query', array(&$this));
        }
 
                        do_action_ref_array('parse_query', array(&$this));
        }
 
+       /**
+        * Sets the 404 property and saves whether query is feed.
+        *
+        * @since 2.0.0
+        * @access public
+        */
        function set_404() {
                $is_feed = $this->is_feed;
 
        function set_404() {
                $is_feed = $this->is_feed;
 
@@ -797,6 +1517,15 @@ class WP_Query {
                $this->is_feed = $is_feed;
        }
 
                $this->is_feed = $is_feed;
        }
 
+       /**
+        * Retrieve query variable.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $query_var Query variable key.
+        * @return mixed
+        */
        function get($query_var) {
                if (isset($this->query_vars[$query_var])) {
                        return $this->query_vars[$query_var];
        function get($query_var) {
                if (isset($this->query_vars[$query_var])) {
                        return $this->query_vars[$query_var];
@@ -805,10 +1534,31 @@ class WP_Query {
                return '';
        }
 
                return '';
        }
 
+       /**
+        * Set query variable.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $query_var Query variable key.
+        * @param mixed $value Query variable value.
+        */
        function set($query_var, $value) {
                $this->query_vars[$query_var] = $value;
        }
 
        function set($query_var, $value) {
                $this->query_vars[$query_var] = $value;
        }
 
+       /**
+        * Retrieve the posts based on query variables.
+        *
+        * There are a few filters and actions that can be used to modify the post
+        * database query.
+        *
+        * @since 1.5.0
+        * @access public
+        * @uses do_action_ref_array() Calls 'pre_get_posts' hook before retrieving posts.
+        *
+        * @return array List of posts.
+        */
        function &get_posts() {
                global $wpdb, $user_ID;
 
        function &get_posts() {
                global $wpdb, $user_ID;
 
@@ -833,6 +1583,9 @@ class WP_Query {
                $post_status_join = false;
                $page = 1;
 
                $post_status_join = false;
                $page = 1;
 
+               if ( !isset($q['caller_get_posts']) )
+                       $q['caller_get_posts'] = false;
+
                if ( !isset($q['suppress_filters']) )
                        $q['suppress_filters'] = false;
 
                if ( !isset($q['suppress_filters']) )
                        $q['suppress_filters'] = false;
 
@@ -868,6 +1621,9 @@ class WP_Query {
                else if ( $q['posts_per_page'] == 0 )
                        $q['posts_per_page'] = 1;
 
                else if ( $q['posts_per_page'] == 0 )
                        $q['posts_per_page'] = 1;
 
+               if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 )
+                       $q['comments_per_page'] = get_option('comments_per_page');
+
                if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
                        $this->is_page = true;
                        $this->is_home = false;
                if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
                        $this->is_page = true;
                        $this->is_home = false;
@@ -935,7 +1691,7 @@ class WP_Query {
                                $q['name'] = $q['pagename'];
                                $where .= " AND ($wpdb->posts.ID = '$reqpage')";
                                $reqpage_obj = get_page($reqpage);
                                $q['name'] = $q['pagename'];
                                $where .= " AND ($wpdb->posts.ID = '$reqpage')";
                                $reqpage_obj = get_page($reqpage);
-                               if ( 'attachment' == $reqpage_obj->post_type ) {
+                               if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) {
                                        $this->is_attachment = true;
                                        $this->is_page = true;
                                        $q['attachment_id'] = $reqpage;
                                        $this->is_attachment = true;
                                        $this->is_page = true;
                                        $q['attachment_id'] = $reqpage;
@@ -970,7 +1726,7 @@ class WP_Query {
                        $where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
                }
 
                        $where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
                }
 
-               if ( $q['post_parent'] )
+               if ( is_numeric($q['post_parent']) )
                        $where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] );
 
                if ( $q['page_id'] ) {
                        $where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] );
 
                if ( $q['page_id'] ) {
@@ -984,21 +1740,21 @@ class WP_Query {
                if ( !empty($q['s']) ) {
                        // added slashes screw with quote grouping when done early, so done later
                        $q['s'] = stripslashes($q['s']);
                if ( !empty($q['s']) ) {
                        // added slashes screw with quote grouping when done early, so done later
                        $q['s'] = stripslashes($q['s']);
-                       if ($q['sentence']) {
+                       if ( !empty($q['sentence']) ) {
                                $q['search_terms'] = array($q['s']);
                        } else {
                                $q['search_terms'] = array($q['s']);
                        } else {
-                               preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q[s], $matches);
+                               preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $q['s'], $matches);
                                $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
                        }
                                $q['search_terms'] = array_map(create_function('$a', 'return trim($a, "\\"\'\\n\\r ");'), $matches[0]);
                        }
-                       $n = ($q['exact']) ? '' : '%';
+                       $n = !empty($q['exact']) ? '' : '%';
                        $searchand = '';
                        $searchand = '';
-                       foreach((array)$q['search_terms'] as $term) {
+                       foreach( (array) $q['search_terms'] as $term) {
                                $term = addslashes_gpc($term);
                                $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))";
                                $searchand = ' AND ';
                        }
                        $term = $wpdb->escape($q['s']);
                                $term = addslashes_gpc($term);
                                $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))";
                                $searchand = ' AND ';
                        }
                        $term = $wpdb->escape($q['s']);
-                       if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] )
+                       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) )
                                $search .= " OR ($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}')";
 
                        if ( !empty($search) )
@@ -1017,7 +1773,7 @@ class WP_Query {
                        $cat_array = preg_split('/[,\s]+/', $q['cat']);
                        $q['cat'] = '';
                        $req_cats = array();
                        $cat_array = preg_split('/[,\s]+/', $q['cat']);
                        $q['cat'] = '';
                        $req_cats = array();
-                       foreach ( $cat_array as $cat ) {
+                       foreach ( (array) $cat_array as $cat ) {
                                $cat = intval($cat);
                                $req_cats[] = $cat;
                                $in = ($cat > 0);
                                $cat = intval($cat);
                                $req_cats[] = $cat;
                                $in = ($cat > 0);
@@ -1033,7 +1789,7 @@ class WP_Query {
                        $q['cat'] = implode(',', $req_cats);
                }
 
                        $q['cat'] = implode(',', $req_cats);
                }
 
-               if ( !empty($q['category__in']) || !empty($q['category__not_in']) || !empty($q['category__and']) ) {
+               if ( !empty($q['category__in']) ) {
                        $groupby = "{$wpdb->posts}.ID";
                }
 
                        $groupby = "{$wpdb->posts}.ID";
                }
 
@@ -1045,12 +1801,17 @@ class WP_Query {
                }
 
                if ( !empty($q['category__not_in']) ) {
                }
 
                if ( !empty($q['category__not_in']) ) {
-                       $ids = get_objects_in_term($q['category__not_in'], 'category');
-                       if ( is_wp_error( $ids ) )
-                               return $ids;
-                       if ( is_array($ids) && count($ids > 0) ) {
-                               $out_posts = "'" . implode("', '", $ids) . "'";
-                               $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)";
+                       if ( $wpdb->has_cap( 'subqueries' ) ) {
+                               $cat_string = "'" . implode("', '", $q['category__not_in']) . "'";
+                               $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)";
+                               }
                        }
                }
 
                        }
                }
 
@@ -1108,8 +1869,7 @@ class WP_Query {
                        }
                }
 
                        }
                }
 
-               if ( !empty($q['tag__in']) || !empty($q['tag__not_in']) || !empty($q['tag__and']) ||
-                       !empty($q['tag_slug__in']) || !empty($q['tag_slug__and']) ) {
+               if ( !empty($q['tag__in']) || !empty($q['tag_slug__in']) ) {
                        $groupby = "{$wpdb->posts}.ID";
                }
 
                        $groupby = "{$wpdb->posts}.ID";
                }
 
@@ -1134,10 +1894,17 @@ class WP_Query {
                }
 
                if ( !empty($q['tag__not_in']) ) {
                }
 
                if ( !empty($q['tag__not_in']) ) {
-                       $ids = get_objects_in_term($q['tag__not_in'], 'post_tag');
-                       if ( is_array($ids) && count($ids > 0) ) {
-                               $out_posts = "'" . implode("', '", $ids) . "'";
-                               $whichcat .= " AND $wpdb->posts.ID NOT IN ($out_posts)";
+                       if ( $wpdb->has_cap( 'subqueries' ) ) {
+                               $tag_string = "'" . implode("', '", $q['tag__not_in']) . "'";
+                               $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)";
+                               }
                        }
                }
 
                        }
                }
 
@@ -1257,6 +2024,10 @@ class WP_Query {
                } else {
                        // Used to filter values
                        $allowed_keys = array('author', 'date', 'category', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand');
                } else {
                        // Used to filter values
                        $allowed_keys = array('author', 'date', 'category', 'title', 'modified', 'menu_order', 'parent', 'ID', 'rand');
+                       if ( !empty($q['meta_key']) ) {
+                               $allowed_keys[] = $q['meta_key'];
+                               $allowed_keys[] = 'meta_value';
+                       }
                        $q['orderby'] = urldecode($q['orderby']);
                        $q['orderby'] = addslashes_gpc($q['orderby']);
                        $orderby_array = explode(' ',$q['orderby']);
                        $q['orderby'] = urldecode($q['orderby']);
                        $q['orderby'] = addslashes_gpc($q['orderby']);
                        $orderby_array = explode(' ',$q['orderby']);
@@ -1275,6 +2046,10 @@ class WP_Query {
                                        case 'rand':
                                                $orderby = 'RAND()';
                                                break;
                                        case 'rand':
                                                $orderby = 'RAND()';
                                                break;
+                                       case $q['meta_key']:
+                                       case 'meta_value':
+                                               $orderby = "$wpdb->postmeta.meta_value";
+                                               break;
                                        default:
                                                $orderby = "$wpdb->posts.post_" . $orderby;
                                }
                                        default:
                                                $orderby = "$wpdb->posts.post_" . $orderby;
                                }
@@ -1359,10 +2134,14 @@ class WP_Query {
                // postmeta queries
                if ( ! empty($q['meta_key']) || ! empty($q['meta_value']) )
                        $join .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
                // postmeta queries
                if ( ! empty($q['meta_key']) || ! empty($q['meta_value']) )
                        $join .= " LEFT 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']) )
-                       $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value = %s ", $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']) ) {
+                       if ( ! isset($q['meta_compare']) || empty($q['meta_compare']) || ! in_array($q['meta_compare'], array('=', '!=', '>', '>=', '<', '<=')) )
+                               $q['meta_compare'] = '=';
+
+                       $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value {$q['meta_compare']} %s ", $q['meta_value']);
+               }
 
                // Apply filters on where and join prior to paging so that any
                // manipulations to them are reflected in the paging by day queries.
 
                // Apply filters on where and join prior to paging so that any
                // manipulations to them are reflected in the paging by day queries.
@@ -1433,8 +2212,12 @@ class WP_Query {
                        $join = apply_filters('posts_join_paged', $join);
                        $orderby = apply_filters('posts_orderby', $orderby);
                        $distinct = apply_filters('posts_distinct', $distinct);
                        $join = apply_filters('posts_join_paged', $join);
                        $orderby = apply_filters('posts_orderby', $orderby);
                        $distinct = apply_filters('posts_distinct', $distinct);
-                       $fields = apply_filters('posts_fields', $fields);
                        $limits = apply_filters( 'post_limits', $limits );
                        $limits = apply_filters( 'post_limits', $limits );
+
+                       if ( ! empty($q['meta_key']) )
+                               $fields = "$fields, $wpdb->postmeta.meta_value";
+
+                       $fields = apply_filters('posts_fields', $fields);
                }
 
                // Announce current selection parameters.  For use by caching plugins.
                }
 
                // Announce current selection parameters.  For use by caching plugins.
@@ -1511,6 +2294,44 @@ class WP_Query {
                                        }
                                }
                        }
                                        }
                                }
                        }
+
+                       if ( $this->is_preview && current_user_can( "edit_{$post_type}", $this->posts[0]->ID ) )
+                               $this->posts[0] = apply_filters('the_preview', $this->posts[0]);
+               }
+
+               // 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'] ) {
+                       $num_posts = count($this->posts);
+                       $sticky_offset = 0;
+                       // Loop over posts and relocate stickies to the front.
+                       for ( $i = 0; $i < $num_posts; $i++ ) {
+                               if ( in_array($this->posts[$i]->ID, $sticky_posts) ) {
+                                       $sticky_post = $this->posts[$i];
+                                       // Remove sticky from current position
+                                       array_splice($this->posts, $i, 1);
+                                       // Move to front, after other stickies
+                                       array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
+                                       // Increment the sticky offset.  The next sticky will be placed at this offset.
+                                       $sticky_offset++;
+                                       // Remove post from sticky posts array
+                                       $offset = array_search($sticky_post->ID, $sticky_posts);
+                                       array_splice($sticky_posts, $offset, 1);
+                               }
+                       }
+
+                       // Fetch sticky posts that weren't in the query results
+                       if ( !empty($sticky_posts) ) {
+                               $stickies__in = implode(',', array_map( 'absint', $sticky_posts ));
+                               $stickies = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE $wpdb->posts.ID IN ($stickies__in)" );
+                               /** @todo Make sure post is published or viewable by the current user */
+                               foreach ( $stickies as $sticky_post ) {
+                                       if ( 'publish' != $sticky_post->post_status )
+                                               continue;
+                                               array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
+                                               $sticky_offset++;
+                               }
+                       }
                }
 
                if ( !$q['suppress_filters'] )
                }
 
                if ( !$q['suppress_filters'] )
@@ -1526,6 +2347,14 @@ class WP_Query {
                return $this->posts;
        }
 
                return $this->posts;
        }
 
+       /**
+        * Setup the next post and iterate current post index.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return object Next post.
+        */
        function next_post() {
 
                $this->current_post++;
        function next_post() {
 
                $this->current_post++;
@@ -1534,6 +2363,17 @@ class WP_Query {
                return $this->post;
        }
 
                return $this->post;
        }
 
+       /**
+        * Sets up the current post.
+        *
+        * Retrieves the next post, sets up the post, sets the 'in the loop'
+        * property to true.
+        *
+        * @since 1.5.0
+        * @access public
+        * @uses $post
+        * @uses do_action() 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;
@@ -1544,6 +2384,17 @@ class WP_Query {
                        do_action('loop_start');
        }
 
                        do_action('loop_start');
        }
 
+       /**
+        * Whether there are more posts available in the loop.
+        *
+        * Calls action 'loop_end', when the loop is complete.
+        *
+        * @since 1.5.0
+        * @access public
+        * @uses do_action() Calls 'loop_start' if loop has just started
+        *
+        * @return bool True if posts are available, false if end of loop.
+        */
        function have_posts() {
                if ($this->current_post + 1 < $this->post_count) {
                        return true;
        function have_posts() {
                if ($this->current_post + 1 < $this->post_count) {
                        return true;
@@ -1557,6 +2408,12 @@ class WP_Query {
                return false;
        }
 
                return false;
        }
 
+       /**
+        * Rewind the posts and reset post index.
+        *
+        * @since 1.5.0
+        * @access public
+        */
        function rewind_posts() {
                $this->current_post = -1;
                if ($this->post_count > 0) {
        function rewind_posts() {
                $this->current_post = -1;
                if ($this->post_count > 0) {
@@ -1564,6 +2421,14 @@ class WP_Query {
                }
        }
 
                }
        }
 
+       /**
+        * Iterate current comment index and return comment object.
+        *
+        * @since 2.2.0
+        * @access public
+        *
+        * @return object Comment object.
+        */
        function next_comment() {
                $this->current_comment++;
 
        function next_comment() {
                $this->current_comment++;
 
@@ -1571,6 +2436,14 @@ class WP_Query {
                return $this->comment;
        }
 
                return $this->comment;
        }
 
+       /**
+        * Sets up the current comment.
+        *
+        * @since 2.2.0
+        * @access public
+        * @global object $comment Current comment.
+        * @uses do_action() Calls 'comment_loop_start' hook when first comment is processed.
+        */
        function the_comment() {
                global $comment;
 
        function the_comment() {
                global $comment;
 
@@ -1581,6 +2454,16 @@ class WP_Query {
                }
        }
 
                }
        }
 
+       /**
+        * Whether there are more comments available.
+        *
+        * Automatically rewinds comments when finished.
+        *
+        * @since 2.2.0
+        * @access public
+        *
+        * @return bool True, if more comments. False, if no more posts.
+        */
        function have_comments() {
                if ($this->current_comment + 1 < $this->comment_count) {
                        return true;
        function have_comments() {
                if ($this->current_comment + 1 < $this->comment_count) {
                        return true;
@@ -1591,6 +2474,12 @@ class WP_Query {
                return false;
        }
 
                return false;
        }
 
+       /**
+        * Rewind the comments, resets the comment index and comment to first.
+        *
+        * @since 2.2.0
+        * @access public
+        */
        function rewind_comments() {
                $this->current_comment = -1;
                if ($this->comment_count > 0) {
        function rewind_comments() {
                $this->current_comment = -1;
                if ($this->comment_count > 0) {
@@ -1598,11 +2487,32 @@ class WP_Query {
                }
        }
 
                }
        }
 
+       /**
+        * Sets up the WordPress query by parsing query string.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $query URL query string.
+        * @return array List of posts.
+        */
        function &query($query) {
                $this->parse_query($query);
                return $this->get_posts();
        }
 
        function &query($query) {
                $this->parse_query($query);
                return $this->get_posts();
        }
 
+       /**
+        * Retrieve queried object.
+        *
+        * If queried object is not set, then the queried object will be set from
+        * the category, tag, taxonomy, posts page, single post, page, or author
+        * query variable. After it is set up, it will be returned.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return object
+        */
        function get_queried_object() {
                if (isset($this->queried_object)) {
                        return $this->queried_object;
        function get_queried_object() {
                if (isset($this->queried_object)) {
                        return $this->queried_object;
@@ -1614,13 +2524,15 @@ class WP_Query {
                if ($this->is_category) {
                        $cat = $this->get('cat');
                        $category = &get_category($cat);
                if ($this->is_category) {
                        $cat = $this->get('cat');
                        $category = &get_category($cat);
+                       if ( is_wp_error( $category ) )
+                               return NULL;
                        $this->queried_object = &$category;
                        $this->queried_object_id = (int) $cat;
                } else if ($this->is_tag) {
                        $tag_id = $this->get('tag_id');
                        $tag = &get_term($tag_id, 'post_tag');
                        if ( is_wp_error( $tag ) )
                        $this->queried_object = &$category;
                        $this->queried_object_id = (int) $cat;
                } else if ($this->is_tag) {
                        $tag_id = $this->get('tag_id');
                        $tag = &get_term($tag_id, 'post_tag');
                        if ( is_wp_error( $tag ) )
-                               return $tag;
+                               return NULL;
                        $this->queried_object = &$tag;
                        $this->queried_object_id = (int) $tag_id;
                } else if ($this->is_tax) {
                        $this->queried_object = &$tag;
                        $this->queried_object_id = (int) $tag_id;
                } else if ($this->is_tax) {
@@ -1628,7 +2540,7 @@ class WP_Query {
                        $slug = $this->get('term');
                        $term = &get_terms($tax, array('slug'=>$slug));
                        if ( is_wp_error($term) || empty($term) )
                        $slug = $this->get('term');
                        $term = &get_terms($tax, array('slug'=>$slug));
                        if ( is_wp_error($term) || empty($term) )
-                               return $term;
+                               return NULL;
                        $term = $term[0];
                        $this->queried_object = $term;
                        $this->queried_object_id = $term->term_id;
                        $term = $term[0];
                        $this->queried_object = $term;
                        $this->queried_object_id = $term->term_id;
@@ -1651,6 +2563,14 @@ class WP_Query {
                return $this->queried_object;
        }
 
                return $this->queried_object;
        }
 
+       /**
+        * Retrieve ID of the current queried object.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return int
+        */
        function get_queried_object_id() {
                $this->get_queried_object();
 
        function get_queried_object_id() {
                $this->get_queried_object();
 
@@ -1661,6 +2581,17 @@ class WP_Query {
                return 0;
        }
 
                return 0;
        }
 
+       /**
+        * PHP4 type constructor.
+        *
+        * Sets up the WordPress query, if parameter is not empty.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $query URL query string.
+        * @return WP_Query
+        */
        function WP_Query ($query = '') {
                if (! empty($query)) {
                        $this->query($query);
        function WP_Query ($query = '') {
                if (! empty($query)) {
                        $this->query($query);
@@ -1668,8 +2599,17 @@ class WP_Query {
        }
 }
 
        }
 }
 
-
-// Redirect old slugs
+/**
+ * Redirect old slugs to the correct permalink.
+ *
+ * Attempts to find the current slug from the past slugs.
+ *
+ * @since 2.1.0
+ * @uses $wp_query
+ * @uses $wpdb
+ *
+ * @return null If no link is found, null is returned.
+ */
 function wp_old_slug_redirect () {
        global $wp_query;
        if ( is_404() && '' != $wp_query->query_vars['name'] ) :
 function wp_old_slug_redirect () {
        global $wp_query;
        if ( is_404() && '' != $wp_query->query_vars['name'] ) :
@@ -1701,12 +2641,14 @@ function wp_old_slug_redirect () {
        endif;
 }
 
        endif;
 }
 
-
-//
-// Private helper functions
-//
-
-// Setup global post data.
+/**
+ * Setup global post data.
+ *
+ * @since 1.5.0
+ *
+ * @param object $post Post data.
+ * @return bool True when finished.
+ */
 function setup_postdata($post) {
        global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages;
 
 function setup_postdata($post) {
        global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages;
 
@@ -1723,7 +2665,7 @@ function setup_postdata($post) {
        if ( is_single() || is_page() || is_feed() )
                $more = 1;
        $content = $post->post_content;
        if ( is_single() || is_page() || is_feed() )
                $more = 1;
        $content = $post->post_content;
-       if ( preg_match('/<!--nextpage-->/', $content) ) {
+       if ( strpos( $content, '<!--nextpage-->' ) ) {
                if ( $page > 1 )
                        $more = 1;
                $multipage = 1;
                if ( $page > 1 )
                        $more = 1;
                $multipage = 1;
@@ -1739,4 +2681,4 @@ function setup_postdata($post) {
        return true;
 }
 
        return true;
 }
 
-?>
+?>
\ No newline at end of file
index 8e822834ddd657e65fa40704116f08d387b71801..aee3ae149f4e0decb686f646c3e264c986fb65d5 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /**
  */
 
 /**
- * username_exists() - Checks whether the given username exists.
+ * Checks whether the given username exists.
  *
  * @since 2.0.0
  *
  *
  * @since 2.0.0
  *
@@ -22,7 +22,7 @@ function username_exists( $username ) {
 }
 
 /**
 }
 
 /**
- * email_exists() - Checks whether the given email exists.
+ * Checks whether the given email exists.
  *
  * @since 2.1.0
  * @uses $wpdb
  *
  * @since 2.1.0
  * @uses $wpdb
@@ -38,7 +38,7 @@ function email_exists( $email ) {
 }
 
 /**
 }
 
 /**
- * validate_username() - Checks whether an username is valid.
+ * Checks whether an username is valid.
  *
  * @since 2.0.1
  * @uses apply_filters() Calls 'validate_username' hook on $valid check and $username as parameters
  *
  * @since 2.0.1
  * @uses apply_filters() Calls 'validate_username' hook on $valid check and $username as parameters
@@ -53,21 +53,19 @@ function validate_username( $username ) {
 }
 
 /**
 }
 
 /**
- * wp_insert_user() - Insert an user into the database.
+ * Insert an user into the database.
  *
  *
- * Can update a current user or insert a new user based on whether
- * the user's ID is present.
+ * Can update a current user or insert a new user based on whether the user's ID
+ * is present.
  *
  *
- * Can be used to update the user's info (see below), set the user's
- * role, and set the user's preference on whether they want the rich
- * editor on.
+ * Can be used to update the user's info (see below), set the user's role, and
+ * set the user's preference on whether they want the rich editor on.
  *
  *
- * Most of the $userdata array fields have filters associated with
- * the values. The exceptions are 'rich_editing', 'role', 'jabber',
- * 'aim', 'yim', 'user_registered', and 'ID'. The filters have the
- * prefix 'pre_user_' followed by the field name. An example using
- * 'description' would have the filter called, 'pre_user_description'
- * that can be hooked into.
+ * Most of the $userdata array fields have filters associated with the values.
+ * The exceptions are 'rich_editing', 'role', 'jabber', 'aim', 'yim',
+ * 'user_registered', and 'ID'. The filters have the prefix 'pre_user_' followed
+ * by the field name. An example using 'description' would have the filter
+ * called, 'pre_user_description' that can be hooked into.
  *
  * The $userdata array can contain the following fields:
  * 'ID' - An integer that will be used for updating an existing user.
  *
  * The $userdata array can contain the following fields:
  * 'ID' - An integer that will be used for updating an existing user.
@@ -77,15 +75,16 @@ function validate_username( $username ) {
  *             The default is the user's username.
  * 'user_url' - A string containing the user's URL for the user's web site.
  * 'user_email' - A string containing the user's email address.
  *             The default is the user's username.
  * 'user_url' - A string containing the user's URL for the user's web site.
  * 'user_email' - A string containing the user's email address.
- * 'display_name' - A string that will be shown on the site. Defaults to user's username.
- *             It is likely that you will want to change this, for both appearance and security
- *             through obscurity (that is if you don't use and delete the default 'admin' user).
+ * 'display_name' - A string that will be shown on the site. Defaults to user's
+ *             username. It is likely that you will want to change this, for both
+ *             appearance and security through obscurity (that is if you don't use and
+ *             delete the default 'admin' user).
  * 'nickname' - The user's nickname, defaults to the user's username.
  * 'first_name' - The user's first name.
  * 'last_name' - The user's last name.
  * 'description' - A string containing content about the user.
  * 'nickname' - The user's nickname, defaults to the user's username.
  * 'first_name' - The user's first name.
  * 'last_name' - The user's last name.
  * 'description' - A string containing content about the user.
- * 'rich_editing' - A string for whether to enable the rich editor or not. False if not
- *             empty.
+ * 'rich_editing' - A string for whether to enable the rich editor or not. False
+ *             if not empty.
  * 'user_registered' - The date the user registered. Format is 'Y-m-d H:i:s'.
  * 'role' - A string used to set the user's role.
  * 'jabber' - User's Jabber account.
  * 'user_registered' - The date the user registered. Format is 'Y-m-d H:i:s'.
  * 'role' - A string used to set the user's role.
  * 'jabber' - User's Jabber account.
@@ -110,6 +109,7 @@ function wp_insert_user($userdata) {
        if ( !empty($ID) ) {
                $ID = (int) $ID;
                $update = true;
        if ( !empty($ID) ) {
                $ID = (int) $ID;
                $update = true;
+               $old_user_data = get_userdata($ID);
        } else {
                $update = false;
                // Hash the password
        } else {
                $update = false;
                // Hash the password
@@ -154,10 +154,25 @@ function wp_insert_user($userdata) {
        if ( empty($rich_editing) )
                $rich_editing = 'true';
 
        if ( empty($rich_editing) )
                $rich_editing = 'true';
 
+       if ( empty($comment_shortcuts) )
+               $comment_shortcuts = 'false';
+
        if ( empty($admin_color) )
                $admin_color = 'fresh';
        $admin_color = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
 
        if ( empty($admin_color) )
                $admin_color = 'fresh';
        $admin_color = preg_replace('|[^a-z0-9 _.\-@]|i', '', $admin_color);
 
+       if ( empty($use_ssl) )
+               $use_ssl = 0;
+
+       if ( empty($jabber) )
+               $jabber = '';
+
+       if ( empty($aim) )
+               $aim = '';
+
+       if ( empty($yim) )
+               $yim = '';
+
        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');
 
@@ -180,7 +195,9 @@ function wp_insert_user($userdata) {
        update_usermeta( $user_id, 'aim', $aim );
        update_usermeta( $user_id, 'yim', $yim );
        update_usermeta( $user_id, 'rich_editing', $rich_editing);
        update_usermeta( $user_id, 'aim', $aim );
        update_usermeta( $user_id, 'yim', $yim );
        update_usermeta( $user_id, 'rich_editing', $rich_editing);
+       update_usermeta( $user_id, 'comment_shortcuts', $comment_shortcuts);
        update_usermeta( $user_id, 'admin_color', $admin_color);
        update_usermeta( $user_id, 'admin_color', $admin_color);
+       update_usermeta( $user_id, 'use_ssl', $use_ssl);
 
        if ( $update && isset($role) ) {
                $user = new WP_User($user_id);
 
        if ( $update && isset($role) ) {
                $user = new WP_User($user_id);
@@ -196,7 +213,7 @@ function wp_insert_user($userdata) {
        wp_cache_delete($user_login, 'userlogins');
 
        if ( $update )
        wp_cache_delete($user_login, 'userlogins');
 
        if ( $update )
-               do_action('profile_update', $user_id);
+               do_action('profile_update', $user_id, $old_user_data);
        else
                do_action('user_register', $user_id);
 
        else
                do_action('user_register', $user_id);
 
@@ -204,16 +221,16 @@ function wp_insert_user($userdata) {
 }
 
 /**
 }
 
 /**
- * wp_update_user() - Update an user in the database
+ * Update an user in the database.
  *
  *
- * It is possible to update a user's password by specifying the
- * 'user_pass' value in the $userdata parameter array.
+ * It is possible to update a user's password by specifying the 'user_pass'
+ * value in the $userdata parameter array.
  *
  *
- * If $userdata does not contain an 'ID' key, then a new user
- * will be created and the new user's ID will be returned.
+ * If $userdata does not contain an 'ID' key, then a new user will be created
+ * and the new user's ID will be returned.
  *
  *
- * If current user's password is being updated, then the cookies
- * will be cleared.
+ * If current user's password is being updated, then the cookies will be
+ * cleared.
  *
  * @since 2.0.0
  * @see wp_insert_user() For what fields can be set in $userdata
  *
  * @since 2.0.0
  * @see wp_insert_user() For what fields can be set in $userdata
@@ -254,7 +271,7 @@ function wp_update_user($userdata) {
 }
 
 /**
 }
 
 /**
- * wp_create_user() - A simpler way of inserting an user into the database.
+ * A simpler way of inserting an user into the database.
  *
  * Creates a new user with just the username, password, and email. For a more
  * detail creation of a user, use wp_insert_user() to specify more infomation.
  *
  * Creates a new user with just the username, password, and email. For a more
  * detail creation of a user, use wp_insert_user() to specify more infomation.
index 15247d8031eef436e62f6e090dde657c92f2dc97..116c7f933c2be6e3ec7271becedb7276436dbff0 100644 (file)
@@ -1,16 +1,37 @@
 <?php
 <?php
+/**
+ * WordPress Rewrite API
+ *
+ * @package WordPress
+ * @subpackage Rewrite
+ */
 
 
-/* WP_Rewrite API
-*******************************************************************************/
-
-//Add a straight rewrite rule
+/**
+ * Add a straight rewrite rule.
+ *
+ * @see WP_Rewrite::add_rule() for long description.
+ * @since 2.1.0
+ *
+ * @param string $regex Regular Expression to match request against.
+ * @param string $redirect Page to redirect to.
+ * @param string $after Optional, default is 'bottom'. Where to add rule, can also be 'top'.
+ */
 function add_rewrite_rule($regex, $redirect, $after = 'bottom') {
        global $wp_rewrite;
        $wp_rewrite->add_rule($regex, $redirect, $after);
 }
 
 function add_rewrite_rule($regex, $redirect, $after = 'bottom') {
        global $wp_rewrite;
        $wp_rewrite->add_rule($regex, $redirect, $after);
 }
 
-//Add a new tag (like %postname%)
-//warning: you must call this on init or earlier, otherwise the query var addition stuff won't work
+/**
+ * Add a new tag (like %postname%).
+ *
+ * Warning: you must call this on init or earlier, otherwise the query var
+ * addition stuff won't work.
+ *
+ * @since 2.1.0
+ *
+ * @param string $tagname
+ * @param string $regex
+ */
 function add_rewrite_tag($tagname, $regex) {
        //validation
        if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') {
 function add_rewrite_tag($tagname, $regex) {
        //validation
        if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') {
@@ -24,7 +45,15 @@ function add_rewrite_tag($tagname, $regex) {
        $wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
 }
 
        $wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
 }
 
-//Add a new feed type like /atom1/
+/**
+ * Add a new feed type like /atom1/.
+ *
+ * @since 2.1.0
+ *
+ * @param string $feedname
+ * @param callback $function Callback to run on feed display.
+ * @return string Feed action name.
+ */
 function add_feed($feedname, $function) {
        global $wp_rewrite;
        if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is
 function add_feed($feedname, $function) {
        global $wp_rewrite;
        if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is
@@ -37,35 +66,142 @@ function add_feed($feedname, $function) {
        return $hook;
 }
 
        return $hook;
 }
 
-define('EP_PERMALINK',  1   );
-define('EP_ATTACHMENT', 2   );
-define('EP_DATE',       4   );
-define('EP_YEAR',       8   );
-define('EP_MONTH',      16  );
-define('EP_DAY',        32  );
-define('EP_ROOT',       64  );
-define('EP_COMMENTS',   128 );
-define('EP_SEARCH',     256 );
-define('EP_CATEGORIES', 512 );
-define('EP_TAGS', 1024 );
-define('EP_AUTHORS',    2048);
-define('EP_PAGES',      4096);
+/**
+ * Endpoint Mask for Permalink.
+ *
+ * @since 2.1.0
+ */
+define('EP_PERMALINK', 1);
+
+/**
+ * Endpoint Mask for Attachment.
+ *
+ * @since 2.1.0
+ */
+define('EP_ATTACHMENT', 2);
+
+/**
+ * Endpoint Mask for date.
+ *
+ * @since 2.1.0
+ */
+define('EP_DATE', 4);
+
+/**
+ * Endpoint Mask for year
+ *
+ * @since 2.1.0
+ */
+define('EP_YEAR', 8);
+
+/**
+ * Endpoint Mask for month.
+ *
+ * @since 2.1.0
+ */
+define('EP_MONTH', 16);
+
+/**
+ * Endpoint Mask for day.
+ *
+ * @since 2.1.0
+ */
+define('EP_DAY', 32);
+
+/**
+ * Endpoint Mask for root.
+ *
+ * @since 2.1.0
+ */
+define('EP_ROOT', 64);
+
+/**
+ * Endpoint Mask for comments.
+ *
+ * @since 2.1.0
+ */
+define('EP_COMMENTS', 128);
+
+/**
+ * Endpoint Mask for searches.
+ *
+ * @since 2.1.0
+ */
+define('EP_SEARCH', 256);
+
+/**
+ * Endpoint Mask for categories.
+ *
+ * @since 2.1.0
+ */
+define('EP_CATEGORIES', 512);
+
+/**
+ * Endpoint Mask for tags.
+ *
+ * @since 2.3.0
+ */
+define('EP_TAGS', 1024);
+
+/**
+ * Endpoint Mask for authors.
+ *
+ * @since 2.1.0
+ */
+define('EP_AUTHORS', 2048);
+
+/**
+ * Endpoint Mask for pages.
+ *
+ * @since 2.1.0
+ */
+define('EP_PAGES', 4096);
+
 //pseudo-places
 //pseudo-places
-define('EP_NONE',       0  );
-define('EP_ALL',        8191);
+/**
+ * Endpoint Mask for default, which is nothing.
+ *
+ * @since 2.1.0
+ */
+define('EP_NONE', 0);
+
+/**
+ * Endpoint Mask for everything.
+ *
+ * @since 2.1.0
+ */
+define('EP_ALL', 8191);
 
 
-//and an endpoint, like /trackback/
+/**
+ * Add an endpoint, like /trackback/.
+ *
+ * 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/".
+ *
+ * @since 2.1.0
+ * @see WP_Rewrite::add_endpoint() Parameters and more description.
+ * @uses $wp_rewrite
+ *
+ * @param unknown_type $name
+ * @param unknown_type $places
+ */
 function add_rewrite_endpoint($name, $places) {
        global $wp_rewrite;
        $wp_rewrite->add_endpoint($name, $places);
 }
 
 /**
 function add_rewrite_endpoint($name, $places) {
        global $wp_rewrite;
        $wp_rewrite->add_endpoint($name, $places);
 }
 
 /**
-  * _wp_filter_taxonomy_base() - filter the URL base for taxonomies, to remove any manually prepended /index.php/
-  * @param string $base the taxonomy base that we're going to filter
-  * @return string
-  * @author Mark Jaquith 
-  */
+ * Filter the URL base for taxonomies.
+ *
+ * To remove any manually prepended /index.php/.
+ *
+ * @access private
+ * @since 2.6.0
+ * @author Mark Jaquith
+ *
+ * @param string $base The taxonomy base that we're going to filter
+ * @return string
+ */
 function _wp_filter_taxonomy_base( $base ) {
        if ( !empty( $base ) ) {
                $base = preg_replace( '|^/index\.php/|', '', $base );
 function _wp_filter_taxonomy_base( $base ) {
        if ( !empty( $base ) ) {
                $base = preg_replace( '|^/index\.php/|', '', $base );
@@ -74,8 +210,16 @@ function _wp_filter_taxonomy_base( $base ) {
        return $base;
 }
 
        return $base;
 }
 
-// examine a url (supposedly from this blog) and try to
-// determine the post ID it represents.
+/**
+ * Examine a url and try to determine the post ID it represents.
+ *
+ * Checks are supposedly from the hosted site blog.
+ *
+ * @since 1.0.0
+ *
+ * @param string $url Permalink to check.
+ * @return int Post ID, or 0 on failure.
+ */
 function url_to_postid($url) {
        global $wp_rewrite;
 
 function url_to_postid($url) {
        global $wp_rewrite;
 
@@ -157,7 +301,7 @@ function url_to_postid($url) {
                        global $wp;
                        parse_str($query, $query_vars);
                        $query = array();
                        global $wp;
                        parse_str($query, $query_vars);
                        $query = array();
-                       foreach ( $query_vars as $key => $value ) {
+                       foreach ( (array) $query_vars as $key => $value ) {
                                if ( in_array($key, $wp->public_query_vars) )
                                        $query[$key] = $value;
                        }
                                if ( in_array($key, $wp->public_query_vars) )
                                        $query[$key] = $value;
                        }
@@ -172,38 +316,298 @@ function url_to_postid($url) {
        return 0;
 }
 
        return 0;
 }
 
-/* WP_Rewrite class
-*******************************************************************************/
-
+/**
+ * WordPress Rewrite Component.
+ *
+ * The WordPress Rewrite class writes the rewrite module rules to the .htaccess
+ * file. It also handles parsing the request to get the correct setup for the
+ * WordPress Query class.
+ *
+ * The Rewrite along with WP class function as a front controller for WordPress.
+ * You can add rules to trigger your page view and processing using this
+ * component. The full functionality of a front controller does not exist,
+ * meaning you can't define how the template files load based on the rewrite
+ * rules.
+ *
+ * @since 1.5.0
+ */
 class WP_Rewrite {
 class WP_Rewrite {
+       /**
+        * Default permalink structure for WordPress.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $permalink_structure;
        var $permalink_structure;
+
+       /**
+        * Whether to add trailing slashes.
+        *
+        * @since 2.2.0
+        * @access private
+        * @var bool
+        */
        var $use_trailing_slashes;
        var $use_trailing_slashes;
+
+       /**
+        * Customized or default category permalink base ( example.com/xx/tagname ).
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $category_base;
        var $category_base;
+
+       /**
+        * Customized or default tag permalink base ( example.com/xx/tagname ).
+        *
+        * @since 2.3.0
+        * @access private
+        * @var string
+        */
        var $tag_base;
        var $tag_base;
+
+       /**
+        * Permalink request structure for categories.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $category_structure;
        var $category_structure;
+
+       /**
+        * Permalink request structure for tags.
+        *
+        * @since 2.3.0
+        * @access private
+        * @var string
+        */
        var $tag_structure;
        var $tag_structure;
+
+       /**
+        * Permalink author request base ( example.com/author/authorname ).
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $author_base = 'author';
        var $author_base = 'author';
+
+       /**
+        * Permalink request structure for author pages.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $author_structure;
        var $author_structure;
+
+       /**
+        * Permalink request structure for dates.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $date_structure;
        var $date_structure;
+
+       /**
+        * Permalink request structure for pages.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $page_structure;
        var $page_structure;
+
+       /**
+        * Search permalink base ( example.com/search/query ).
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $search_base = 'search';
        var $search_base = 'search';
+
+       /**
+        * Permalink request structure for searches.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $search_structure;
        var $search_structure;
+
+       /**
+        * Comments permalink base.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $comments_base = 'comments';
        var $comments_base = 'comments';
+
+       /**
+        * Feed permalink base.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $feed_base = 'feed';
        var $feed_base = 'feed';
+
+       /**
+        * Comments feed request structure permalink.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $comments_feed_structure;
        var $comments_feed_structure;
+
+       /**
+        * Feed request structure permalink.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $feed_structure;
        var $feed_structure;
+
+       /**
+        * Front URL path.
+        *
+        * The difference between the root property is that WordPress might be
+        * located at example/WordPress/index.php, if permalinks are turned off. The
+        * WordPress/index.php will be the front portion. If permalinks are turned
+        * on, this will most likely be empty or not set.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $front;
        var $front;
+
+       /**
+        * Root URL path to WordPress (without domain).
+        *
+        * The difference between front property is that WordPress might be located
+        * at example.com/WordPress/. The root is the 'WordPress/' portion.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $root = '';
        var $root = '';
+
+       /**
+        * Permalink to the home page.
+        *
+        * @since 1.5.0
+        * @access public
+        * @var string
+        */
        var $index = 'index.php';
        var $index = 'index.php';
+
+       /**
+        * Request match string.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var string
+        */
        var $matches = '';
        var $matches = '';
+
+       /**
+        * Rewrite rules to match against the request to find the redirect or query.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var array
+        */
        var $rules;
        var $rules;
-       var $extra_rules = array(); //those not generated by the class, see add_rewrite_rule()
-       var $extra_rules_top = array(); //those not generated by the class, see add_rewrite_rule()
-       var $non_wp_rules = array(); //rules that don't redirect to WP's index.php
+
+       /**
+        * Additional rules added external to the rewrite class.
+        *
+        * Those not generated by the class, see add_rewrite_rule().
+        *
+        * @since 2.1.0
+        * @access private
+        * @var array
+        */
+       var $extra_rules = array(); //
+
+       /**
+        * Additional rules that belong at the beginning to match first.
+        *
+        * Those not generated by the class, see add_rewrite_rule().
+        *
+        * @since 2.3.0
+        * @access private
+        * @var array
+        */
+       var $extra_rules_top = array(); //
+
+       /**
+        * Rules that don't redirect to WP's index.php.
+        *
+        * These rules are written to the mod_rewrite portion of the .htaccess.
+        *
+        * @since 2.1.0
+        * @access private
+        * @var array
+        */
+       var $non_wp_rules = array(); //
+
+       /**
+        * Extra permalink structures.
+        *
+        * @since 2.1.0
+        * @access private
+        * @var array
+        */
        var $extra_permastructs = array();
        var $extra_permastructs = array();
+
+       /**
+        * Endpoints permalinks
+        *
+        * @since unknown
+        * @access private
+        * @var array
+        */
        var $endpoints;
        var $endpoints;
+
+       /**
+        * Whether to write every mod_rewrite rule for WordPress.
+        *
+        * This is off by default, turning it on might print a lot of rewrite rules
+        * to the .htaccess file.
+        *
+        * @since 2.0.0
+        * @access public
+        * @var bool
+        */
        var $use_verbose_rules = false;
        var $use_verbose_rules = false;
+
+       /**
+        * Whether to write every mod_rewrite rule for WordPress pages.
+        *
+        * @since 2.5.0
+        * @access public
+        * @var bool
+        */
        var $use_verbose_page_rules = true;
        var $use_verbose_page_rules = true;
+
+       /**
+        * Permalink structure search for preg_replace.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var array
+        */
        var $rewritecode =
                array(
                                        '%year%',
        var $rewritecode =
                array(
                                        '%year%',
@@ -221,6 +625,13 @@ class WP_Rewrite {
                                        '%search%'
                                        );
 
                                        '%search%'
                                        );
 
+       /**
+        * Preg_replace values for the search, see {@link WP_Rewrite::$rewritecode}.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var array
+        */
        var $rewritereplace =
                array(
                                        '([0-9]{4})',
        var $rewritereplace =
                array(
                                        '([0-9]{4})',
@@ -238,6 +649,13 @@ class WP_Rewrite {
                                        '(.+)'
                                        );
 
                                        '(.+)'
                                        );
 
+       /**
+        * Search for the query to look for replacing.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var array
+        */
        var $queryreplace =
                array (
                                        'year=',
        var $queryreplace =
                array (
                                        'year=',
@@ -255,8 +673,25 @@ class WP_Rewrite {
                                        's='
                                        );
 
                                        's='
                                        );
 
+       /**
+        * Supported default feeds.
+        *
+        * @since 1.5.0
+        * @access private
+        * @var array
+        */
        var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
 
        var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
 
+       /**
+        * Whether permalinks are being used.
+        *
+        * This can be either rewrite module or permalink in the HTTP query string.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool True, if permalinks are enabled.
+        */
        function using_permalinks() {
                if (empty($this->permalink_structure))
                        return false;
        function using_permalinks() {
                if (empty($this->permalink_structure))
                        return false;
@@ -264,6 +699,16 @@ class WP_Rewrite {
                        return true;
        }
 
                        return true;
        }
 
+       /**
+        * Whether permalinks are being used and rewrite module is not enabled.
+        *
+        * Means that permalink links are enabled and index.php is in the URL.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool
+        */
        function using_index_permalinks() {
                if (empty($this->permalink_structure)) {
                        return false;
        function using_index_permalinks() {
                if (empty($this->permalink_structure)) {
                        return false;
@@ -277,6 +722,16 @@ class WP_Rewrite {
                return false;
        }
 
                return false;
        }
 
+       /**
+        * Whether permalinks are being used and rewrite module is enabled.
+        *
+        * Using permalinks and index.php is not in the URL.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool
+        */
        function using_mod_rewrite_permalinks() {
                if ( $this->using_permalinks() && ! $this->using_index_permalinks())
                        return true;
        function using_mod_rewrite_permalinks() {
                if ( $this->using_permalinks() && ! $this->using_index_permalinks())
                        return true;
@@ -284,11 +739,27 @@ class WP_Rewrite {
                        return false;
        }
 
                        return false;
        }
 
+       /**
+        * Index for matches for usage in preg_*() functions.
+        *
+        * The format of the string is, with empty matches property value, '$NUM'.
+        * The 'NUM' will be replaced with the value in the $number parameter. With
+        * the matches property not empty, the value of the returned string will
+        * contain that value of the matches property. The format then will be
+        * '$MATCHES[NUM]', with MATCHES as the value in the property and NUM the
+        * value of the $number parameter.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param int $number Index number.
+        * @return string
+        */
        function preg_index($number) {
                $match_prefix = '$';
                $match_suffix = '';
 
        function preg_index($number) {
                $match_prefix = '$';
                $match_suffix = '';
 
-               if (! empty($this->matches)) {
+               if ( ! empty($this->matches) ) {
                        $match_prefix = '$' . $this->matches . '[';
                        $match_suffix = ']';
                }
                        $match_prefix = '$' . $this->matches . '[';
                        $match_suffix = ']';
                }
@@ -296,6 +767,17 @@ class WP_Rewrite {
                return "$match_prefix$number$match_suffix";
        }
 
                return "$match_prefix$number$match_suffix";
        }
 
+       /**
+        * Retrieve all page and attachments for pages URIs.
+        *
+        * The attachments are for those that have pages as parents and will be
+        * retrieved.
+        *
+        * @since 2.5.0
+        * @access public
+        *
+        * @return array Array of page URIs as first element and attachment URIs as second element.
+        */
        function page_uri_index() {
                global $wpdb;
 
        function page_uri_index() {
                global $wpdb;
 
@@ -310,7 +792,6 @@ class WP_Rewrite {
                if ( !$posts )
                        return array( array(), array() );
 
                if ( !$posts )
                        return array( array(), array() );
 
-
                foreach ($posts as $id => $post) {
                        // URL => page name
                        $uri = get_page_uri($id);
                foreach ($posts as $id => $post) {
                        // URL => page name
                        $uri = get_page_uri($id);
@@ -328,6 +809,19 @@ class WP_Rewrite {
                return array( $page_uris, $page_attachment_uris );
        }
 
                return array( $page_uris, $page_attachment_uris );
        }
 
+       /**
+        * Retrieve all of the rewrite rules for pages.
+        *
+        * If the 'use_verbose_page_rules' property is false, then there will only
+        * be a single rewrite rule for pages for those matching '%pagename%'. With
+        * the property set to true, the attachments and the pages will be added for
+        * each individual attachment URI and page URI, respectively.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return array
+        */
        function page_rewrite_rules() {
                $rewrite_rules = array();
                $page_structure = $this->get_page_permastruct();
        function page_rewrite_rules() {
                $rewrite_rules = array();
                $page_structure = $this->get_page_permastruct();
@@ -342,7 +836,6 @@ class WP_Rewrite {
                $uris = $page_uris[0];
                $attachment_uris = $page_uris[1];
 
                $uris = $page_uris[0];
                $attachment_uris = $page_uris[1];
 
-
                if( is_array( $attachment_uris ) ) {
                        foreach ($attachment_uris as $uri => $pagename) {
                                $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment=');
                if( is_array( $attachment_uris ) ) {
                        foreach ($attachment_uris as $uri => $pagename) {
                                $this->add_rewrite_tag('%pagename%', "($uri)", 'attachment=');
@@ -359,6 +852,26 @@ class WP_Rewrite {
                return $rewrite_rules;
        }
 
                return $rewrite_rules;
        }
 
+       /**
+        * Retrieve date permalink structure, with year, month, and day.
+        *
+        * The permalink structure for the date, if not set already depends on the
+        * permalink structure. It can be one of three formats. The first is year,
+        * month, day; the second is day, month, year; and the last format is month,
+        * day, year. These are matched against the permalink structure for which
+        * one is used. If none matches, then the default will be used, which is
+        * year, month, day.
+        *
+        * Prevents post ID and date permalinks from overlapping. In the case of
+        * post_id, the date permalink will be prepended with front permalink with
+        * 'date/' before the actual permalink to form the complete date permalink
+        * structure.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool|string False on no permalink structure. Date permalink structure.
+        */
        function get_date_permastruct() {
                if (isset($this->date_structure)) {
                        return $this->date_structure;
        function get_date_permastruct() {
                if (isset($this->date_structure)) {
                        return $this->date_structure;
@@ -390,7 +903,7 @@ class WP_Rewrite {
                $front = $this->front;
                preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
                $tok_index = 1;
                $front = $this->front;
                preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
                $tok_index = 1;
-               foreach ($tokens[0] as $token) {
+               foreach ( (array) $tokens[0] as $token) {
                        if ( ($token == '%post_id%') && ($tok_index <= 3) ) {
                                $front = $front . 'date/';
                                break;
                        if ( ($token == '%post_id%') && ($tok_index <= 3) ) {
                                $front = $front . 'date/';
                                break;
@@ -403,6 +916,17 @@ class WP_Rewrite {
                return $this->date_structure;
        }
 
                return $this->date_structure;
        }
 
+       /**
+        * Retrieve the year permalink structure without month and day.
+        *
+        * Gets the date permalink structure and strips out the month and day
+        * permalink structures.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool|string False on failure. Year structure on success.
+        */
        function get_year_permastruct() {
                $structure = $this->get_date_permastruct($this->permalink_structure);
 
        function get_year_permastruct() {
                $structure = $this->get_date_permastruct($this->permalink_structure);
 
@@ -418,6 +942,17 @@ class WP_Rewrite {
                return $structure;
        }
 
                return $structure;
        }
 
+       /**
+        * Retrieve the month permalink structure without day and with year.
+        *
+        * Gets the date permalink structure and strips out the day permalink
+        * structures. Keeps the year permalink structure.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool|string False on failure. Year/Month structure on success.
+        */
        function get_month_permastruct() {
                $structure = $this->get_date_permastruct($this->permalink_structure);
 
        function get_month_permastruct() {
                $structure = $this->get_date_permastruct($this->permalink_structure);
 
@@ -432,10 +967,33 @@ class WP_Rewrite {
                return $structure;
        }
 
                return $structure;
        }
 
+       /**
+        * Retrieve the day permalink structure with month and year.
+        *
+        * Keeps date permalink structure with all year, month, and day.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool|string False on failure. Year/Month/Day structure on success.
+        */
        function get_day_permastruct() {
                return $this->get_date_permastruct($this->permalink_structure);
        }
 
        function get_day_permastruct() {
                return $this->get_date_permastruct($this->permalink_structure);
        }
 
+       /**
+        * Retrieve the permalink structure for categories.
+        *
+        * If the category_base property has no value, then the category structure
+        * will have the front property value, followed by 'category', and finally
+        * '%category%'. If it does, then the root property will be used, along with
+        * the category_base property value.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return bool|string False on failure. Category permalink structure.
+        */
        function get_category_permastruct() {
                if (isset($this->category_structure)) {
                        return $this->category_structure;
        function get_category_permastruct() {
                if (isset($this->category_structure)) {
                        return $this->category_structure;
@@ -456,6 +1014,19 @@ class WP_Rewrite {
                return $this->category_structure;
        }
 
                return $this->category_structure;
        }
 
+       /**
+        * Retrieve the permalink structure for tags.
+        *
+        * If the tag_base property has no value, then the tag structure will have
+        * the front property value, followed by 'tag', and finally '%tag%'. If it
+        * does, then the root property will be used, along with the tag_base
+        * property value.
+        *
+        * @since 2.3.0
+        * @access public
+        *
+        * @return bool|string False on failure. Tag permalink structure.
+        */
        function get_tag_permastruct() {
                if (isset($this->tag_structure)) {
                        return $this->tag_structure;
        function get_tag_permastruct() {
                if (isset($this->tag_structure)) {
                        return $this->tag_structure;
@@ -476,12 +1047,33 @@ class WP_Rewrite {
                return $this->tag_structure;
        }
 
                return $this->tag_structure;
        }
 
+       /**
+        * Retrieve extra permalink structure by name.
+        *
+        * @since unknown
+        * @access public
+        *
+        * @param string $name Permalink structure name.
+        * @return string|bool False if not found. Permalink structure string.
+        */
        function get_extra_permastruct($name) {
                if ( isset($this->extra_permastructs[$name]) )
                        return $this->extra_permastructs[$name];
                return false;
        }
 
        function get_extra_permastruct($name) {
                if ( isset($this->extra_permastructs[$name]) )
                        return $this->extra_permastructs[$name];
                return false;
        }
 
+       /**
+        * Retrieve the author permalink structure.
+        *
+        * The permalink structure is front property, author base, and finally
+        * '/%author%'. Will set the author_structure property and then return it
+        * without attempting to set the value again.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return string|bool False if not found. Permalink structure string.
+        */
        function get_author_permastruct() {
                if (isset($this->author_structure)) {
                        return $this->author_structure;
        function get_author_permastruct() {
                if (isset($this->author_structure)) {
                        return $this->author_structure;
@@ -497,6 +1089,18 @@ class WP_Rewrite {
                return $this->author_structure;
        }
 
                return $this->author_structure;
        }
 
+       /**
+        * Retrieve the search permalink structure.
+        *
+        * The permalink structure is root property, search base, and finally
+        * '/%search%'. Will set the search_structure property and then return it
+        * without attempting to set the value again.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return string|bool False if not found. Permalink structure string.
+        */
        function get_search_permastruct() {
                if (isset($this->search_structure)) {
                        return $this->search_structure;
        function get_search_permastruct() {
                if (isset($this->search_structure)) {
                        return $this->search_structure;
@@ -512,6 +1116,18 @@ class WP_Rewrite {
                return $this->search_structure;
        }
 
                return $this->search_structure;
        }
 
+       /**
+        * Retrieve the page permalink structure.
+        *
+        * The permalink structure is root property, and '%pagename%'. Will set the
+        * page_structure property and then return it without attempting to set the
+        * value again.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return string|bool False if not found. Permalink structure string.
+        */
        function get_page_permastruct() {
                if (isset($this->page_structure)) {
                        return $this->page_structure;
        function get_page_permastruct() {
                if (isset($this->page_structure)) {
                        return $this->page_structure;
@@ -527,6 +1143,18 @@ class WP_Rewrite {
                return $this->page_structure;
        }
 
                return $this->page_structure;
        }
 
+       /**
+        * Retrieve the feed permalink structure.
+        *
+        * The permalink structure is root property, feed base, and finally
+        * '/%feed%'. Will set the feed_structure property and then return it
+        * without attempting to set the value again.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return string|bool False if not found. Permalink structure string.
+        */
        function get_feed_permastruct() {
                if (isset($this->feed_structure)) {
                        return $this->feed_structure;
        function get_feed_permastruct() {
                if (isset($this->feed_structure)) {
                        return $this->feed_structure;
@@ -542,6 +1170,18 @@ class WP_Rewrite {
                return $this->feed_structure;
        }
 
                return $this->feed_structure;
        }
 
+       /**
+        * Retrieve the comment feed permalink structure.
+        *
+        * The permalink structure is root property, comment base property, feed
+        * base and finally '/%feed%'. Will set the comment_feed_structure property
+        * and then return it without attempting to set the value again.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return string|bool False if not found. Permalink structure string.
+        */
        function get_comment_feed_permastruct() {
                if (isset($this->comment_feed_structure)) {
                        return $this->comment_feed_structure;
        function get_comment_feed_permastruct() {
                if (isset($this->comment_feed_structure)) {
                        return $this->comment_feed_structure;
@@ -557,12 +1197,26 @@ class WP_Rewrite {
                return $this->comment_feed_structure;
        }
 
                return $this->comment_feed_structure;
        }
 
+       /**
+        * Append or update tag, pattern, and query for replacement.
+        *
+        * If the tag already exists, replace the existing pattern and query for
+        * that tag, otherwise add the new tag, pattern, and query to the end of the
+        * arrays.
+        *
+        * @internal What is the purpose of this function again? Need to finish long
+        *           description.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $tag Append tag to rewritecode property array.
+        * @param string $pattern Append pattern to rewritereplace property array.
+        * @param string $query Append query to queryreplace property array.
+        */
        function add_rewrite_tag($tag, $pattern, $query) {
        function add_rewrite_tag($tag, $pattern, $query) {
-               // If the tag already exists, replace the existing pattern and query for
-               // that tag, otherwise add the new tag, pattern, and query to the end of
-               // the arrays.
                $position = array_search($tag, $this->rewritecode);
                $position = array_search($tag, $this->rewritecode);
-               if (FALSE !== $position && NULL !== $position) {
+               if ( false !== $position && null !== $position ) {
                        $this->rewritereplace[$position] = $pattern;
                        $this->queryreplace[$position] = $query;
                } else {
                        $this->rewritereplace[$position] = $pattern;
                        $this->queryreplace[$position] = $query;
                } else {
@@ -572,11 +1226,29 @@ class WP_Rewrite {
                }
        }
 
                }
        }
 
-       //the main WP_Rewrite function. generate the rules from permalink structure
+       /**
+        * Generate the rules from permalink structure.
+        *
+        * The main WP_Rewrite function for building the rewrite rule list. The
+        * contents of the function is a mix of black magic and regular expressions,
+        * so best just ignore the contents and move to the parameters.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $permalink_structure The permalink structure.
+        * @param int $ep_mask Optional, default is EP_NONE. Endpoint constant, see EP_* constants.
+        * @param bool $paged Optional, default is true. Whether permalink request is paged.
+        * @param bool $feed Optional, default is true. Whether for feed.
+        * @param bool $forcomments Optional, default is false. Whether for comments.
+        * @param bool $walk_dirs Optional, default is true. Whether to create list of directories to walk over.
+        * @param bool $endpoints Optional, default is true. Whether endpoints are enabled.
+        * @return array Rewrite rule list.
+        */
        function generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true) {
                //build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/?
                $feedregex2 = '';
        function generate_rewrite_rules($permalink_structure, $ep_mask = EP_NONE, $paged = true, $feed = true, $forcomments = false, $walk_dirs = true, $endpoints = true) {
                //build a regex to match the feed section of URLs, something like (feed|atom|rss|rss2)/?
                $feedregex2 = '';
-               foreach ($this->feeds as $feed_name) {
+               foreach ( (array) $this->feeds as $feed_name) {
                        $feedregex2 .= $feed_name . '|';
                }
                $feedregex2 = '(' . trim($feedregex2, '|') .  ')/?$';
                        $feedregex2 .= $feed_name . '|';
                }
                $feedregex2 = '(' . trim($feedregex2, '|') .  ')/?$';
@@ -587,11 +1259,12 @@ class WP_Rewrite {
                //build a regex to match the trackback and page/xx parts of URLs
                $trackbackregex = 'trackback/?$';
                $pageregex = 'page/?([0-9]{1,})/?$';
                //build a regex to match the trackback and page/xx parts of URLs
                $trackbackregex = 'trackback/?$';
                $pageregex = 'page/?([0-9]{1,})/?$';
+               $commentregex = 'comment-page-([0-9]{1,})/?$';
 
                //build up an array of endpoint regexes to append => queries to append
                if ($endpoints) {
                        $ep_query_append = array ();
 
                //build up an array of endpoint regexes to append => queries to append
                if ($endpoints) {
                        $ep_query_append = array ();
-                       foreach ($this->endpoints as $endpoint) {
+                       foreach ( (array) $this->endpoints as $endpoint) {
                                //match everything after the endpoint name, but allow for nothing to appear there
                                $epmatch = $endpoint[1] . '(/(.*))?/?$';
                                //this will be appended on to the rest of the query for each dir
                                //match everything after the endpoint name, but allow for nothing to appear there
                                $epmatch = $endpoint[1] . '(/(.*))?/?$';
                                //this will be appended on to the rest of the query for each dir
@@ -667,6 +1340,10 @@ class WP_Rewrite {
                        $pagematch = $match . $pageregex;
                        $pagequery = $index . '?' . $query . '&paged=' . $this->preg_index($num_toks + 1);
 
                        $pagematch = $match . $pageregex;
                        $pagequery = $index . '?' . $query . '&paged=' . $this->preg_index($num_toks + 1);
 
+                       //create query for /comment-page-xx
+                       $commentmatch = $match . $commentregex;
+                       $commentquery = $index . '?' . $query . '&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);
@@ -688,9 +1365,13 @@ class WP_Rewrite {
                        if ($paged) //...and /page/xx ones
                                $rewrite = array_merge($rewrite, array($pagematch => $pagequery));
 
                        if ($paged) //...and /page/xx ones
                                $rewrite = array_merge($rewrite, array($pagematch => $pagequery));
 
+                       //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));
+
                        //do endpoints
                        if ($endpoints) {
                        //do endpoints
                        if ($endpoints) {
-                               foreach ($ep_query_append as $regex => $ep) {
+                               foreach ( (array) $ep_query_append as $regex => $ep) {
                                        //add the endpoints on if the mask fits
                                        if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) {
                                                $rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2);
                                        //add the endpoints on if the mask fits
                                        if ($ep[0] & $ep_mask || $ep[0] & $ep_mask_specific) {
                                                $rewrite[$match . $regex] = $index . '?' . $query . $ep[1] . $this->preg_index($num_toks + 2);
@@ -731,6 +1412,7 @@ class WP_Rewrite {
                                        $sub1tb = $sub1 . $trackbackregex; //add trackback regex <permalink>/trackback/...
                                        $sub1feed = $sub1 . $feedregex; //and <permalink>/feed/(atom|...)
                                        $sub1feed2 = $sub1 . $feedregex2; //and <permalink>/(feed|atom...)
                                        $sub1tb = $sub1 . $trackbackregex; //add trackback regex <permalink>/trackback/...
                                        $sub1feed = $sub1 . $feedregex; //and <permalink>/feed/(atom|...)
                                        $sub1feed2 = $sub1 . $feedregex2; //and <permalink>/(feed|atom...)
+                                       $sub1comment = $sub1 . $commentregex; //and <permalink>/comment-page-xx
                                        //add an ? as we don't have to match that last slash, and finally a $ so we
                                        //match to the end of the URL
 
                                        //add an ? as we don't have to match that last slash, and finally a $ so we
                                        //match to the end of the URL
 
@@ -740,14 +1422,16 @@ class WP_Rewrite {
                                        $sub2tb = $sub2 . $trackbackregex; //and add trackbacks <permalink>/attachment/trackback
                                        $sub2feed = $sub2 . $feedregex;    //feeds, <permalink>/attachment/feed/(atom|...)
                                        $sub2feed2 = $sub2 . $feedregex2;  //and feeds again on to this <permalink>/attachment/(feed|atom...)
                                        $sub2tb = $sub2 . $trackbackregex; //and add trackbacks <permalink>/attachment/trackback
                                        $sub2feed = $sub2 . $feedregex;    //feeds, <permalink>/attachment/feed/(atom|...)
                                        $sub2feed2 = $sub2 . $feedregex2;  //and feeds again on to this <permalink>/attachment/(feed|atom...)
+                                       $sub2comment = $sub2 . $commentregex; //and <permalink>/comment-page-xx
 
                                        //create queries for these extra tag-ons we've just dealt with
                                        $subquery = $index . '?attachment=' . $this->preg_index(1);
                                        $subtbquery = $subquery . '&tb=1';
                                        $subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
 
                                        //create queries for these extra tag-ons we've just dealt with
                                        $subquery = $index . '?attachment=' . $this->preg_index(1);
                                        $subtbquery = $subquery . '&tb=1';
                                        $subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
+                                       $subcommentquery = $subquery . '&cpage=' . $this->preg_index(2);
 
                                        //do endpoints for attachments
 
                                        //do endpoints for attachments
-                                       if (! empty($endpoint) ) { foreach ($ep_query_append as $regex => $ep) {
+                                       if ( !empty($endpoint) ) { foreach ( (array) $ep_query_append as $regex => $ep ) {
                                                if ($ep[0] & EP_ATTACHMENT) {
                                                        $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
                                                        $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
                                                if ($ep[0] & EP_ATTACHMENT) {
                                                        $rewrite[$sub1 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
                                                        $rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
@@ -779,8 +1463,8 @@ class WP_Rewrite {
 
                                        //add regexes/queries for attachments, attachment trackbacks and so on
                                        if ( ! $page ) //require <permalink>/attachment/stuff form for pages because of confusion with subpages
 
                                        //add regexes/queries for attachments, attachment trackbacks and so on
                                        if ( ! $page ) //require <permalink>/attachment/stuff form for pages because of confusion with subpages
-                                               $rewrite = array_merge($rewrite, array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery));
-                                       $rewrite = array_merge(array($sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery), $rewrite);
+                                               $rewrite = array_merge($rewrite, array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery, $sub1comment => $subcommentquery));
+                                       $rewrite = array_merge(array($sub2 => $subquery, $sub2tb => $subtbquery, $sub2feed => $subfeedquery, $sub2feed2 => $subfeedquery, $sub2comment => $subcommentquery), $rewrite);
                                }
                        } //if($num_toks)
                        //add the rules for this dir to the accumulating $post_rewrite
                                }
                        } //if($num_toks)
                        //add the rules for this dir to the accumulating $post_rewrite
@@ -789,13 +1473,42 @@ class WP_Rewrite {
                return $post_rewrite; //the finished rules. phew!
        }
 
                return $post_rewrite; //the finished rules. phew!
        }
 
+       /**
+        * Generate Rewrite rules with permalink structure and walking directory only.
+        *
+        * Shorten version of {@link WP_Rewrite::generate_rewrite_rules()} that
+        * allows for shorter list of parameters. See the method for longer
+        * description of what generating rewrite rules does.
+        *
+        * @uses WP_Rewrite::generate_rewrite_rules() See for long description and rest of parameters.
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $permalink_structure The permalink structure to generate rules.
+        * @param bool $walk_dirs Optional, default is false. Whether to create list of directories to walk over.
+        * @return array
+        */
        function generate_rewrite_rule($permalink_structure, $walk_dirs = false) {
                return $this->generate_rewrite_rules($permalink_structure, EP_NONE, false, false, false, $walk_dirs);
        }
 
        function generate_rewrite_rule($permalink_structure, $walk_dirs = false) {
                return $this->generate_rewrite_rules($permalink_structure, EP_NONE, false, false, false, $walk_dirs);
        }
 
-       /* rewrite_rules
+       /**
         * Construct rewrite matches and queries from permalink structure.
         * Construct rewrite matches and queries from permalink structure.
-        * Returns an associate array of matches and queries.
+        *
+        * Runs the action 'generate_rewrite_rules' with the parameter that is an
+        * reference to the current WP_Rewrite instance to further manipulate the
+        * permalink structures and rewrite rules. Runs the 'rewrite_rules_array'
+        * filter on the full rewrite rule array.
+        *
+        * There are two ways to manipulate the rewrite rules, one by hooking into
+        * the 'generate_rewrite_rules' action and gaining full control of the
+        * object or just manipulating the rewrite rule array before it is passed
+        * from the function.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return array An associate array of matches and queries.
         */
        function rewrite_rules() {
                $rewrite = array();
         */
        function rewrite_rules() {
                $rewrite = array();
@@ -805,7 +1518,7 @@ class WP_Rewrite {
                }
 
                // robots.txt
                }
 
                // robots.txt
-               $robots_rewrite = array('robots.txt$' => $this->index . '?robots=1');
+               $robots_rewrite = array('robots\.txt$' => $this->index . '?robots=1');
 
                //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category%
                $default_feeds = array( '.*wp-atom.php$'        =>      $this->index .'?feed=atom',
 
                //Default Feed rules - These are require to allow for the direct access files to work with permalink structure starting with %category%
                $default_feeds = array( '.*wp-atom.php$'        =>      $this->index .'?feed=atom',
@@ -868,6 +1581,20 @@ class WP_Rewrite {
                return $this->rules;
        }
 
                return $this->rules;
        }
 
+       /**
+        * Retrieve the rewrite rules.
+        *
+        * The difference between this method and {@link
+        * WP_Rewrite::rewrite_rules()} is that this method stores the rewrite rules
+        * in the 'rewrite_rules' option and retrieves it. This prevents having to
+        * process all of the permalinks to get the rewrite rules in the form of
+        * caching.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return array Rewrite rules.
+        */
        function wp_rewrite_rules() {
                $this->rules = get_option('rewrite_rules');
                if ( empty($this->rules) ) {
        function wp_rewrite_rules() {
                $this->rules = get_option('rewrite_rules');
                if ( empty($this->rules) ) {
@@ -879,23 +1606,43 @@ class WP_Rewrite {
                return $this->rules;
        }
 
                return $this->rules;
        }
 
+       /**
+        * Retrieve mod_rewrite formatted rewrite rules to write to .htaccess.
+        *
+        * Does not actually write to the .htaccess file, but creates the rules for
+        * the process that will.
+        *
+        * Will add  the non_wp_rules property rules to the .htaccess file before
+        * the WordPress rewrite rules one.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return string
+        */
        function mod_rewrite_rules() {
                if ( ! $this->using_permalinks()) {
                        return '';
                }
 
                $site_root = parse_url(get_option('siteurl'));
        function mod_rewrite_rules() {
                if ( ! $this->using_permalinks()) {
                        return '';
                }
 
                $site_root = parse_url(get_option('siteurl'));
-               $site_root = trailingslashit($site_root['path']);
+               if ( isset( $site_root['path'] ) ) {
+                       $site_root = trailingslashit($site_root['path']);
+               }
 
                $home_root = parse_url(get_option('home'));
 
                $home_root = parse_url(get_option('home'));
-               $home_root = trailingslashit($home_root['path']);
+               if ( isset( $home_root['path'] ) ) {
+                       $home_root = trailingslashit($home_root['path']);
+               } else {
+                       $home_root = '/';
+               }
 
                $rules = "<IfModule mod_rewrite.c>\n";
                $rules .= "RewriteEngine On\n";
                $rules .= "RewriteBase $home_root\n";
 
                //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
 
                $rules = "<IfModule mod_rewrite.c>\n";
                $rules .= "RewriteEngine On\n";
                $rules .= "RewriteBase $home_root\n";
 
                //add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
-               foreach ($this->non_wp_rules as $match => $query) {
+               foreach ( (array) $this->non_wp_rules as $match => $query) {
                        // Apache 1.3 does not support the reluctant (non-greedy) modifier.
                        $match = str_replace('.+?', '.+', $match);
 
                        // Apache 1.3 does not support the reluctant (non-greedy) modifier.
                        $match = str_replace('.+?', '.+', $match);
 
@@ -916,7 +1663,7 @@ class WP_Rewrite {
                                "RewriteCond %{REQUEST_FILENAME} -d\n" .
                                "RewriteRule ^.*$ - [S=$num_rules]\n";
 
                                "RewriteCond %{REQUEST_FILENAME} -d\n" .
                                "RewriteRule ^.*$ - [S=$num_rules]\n";
 
-                       foreach ($rewrite as $match => $query) {
+                       foreach ( (array) $rewrite as $match => $query) {
                                // Apache 1.3 does not support the reluctant (non-greedy) modifier.
                                $match = str_replace('.+?', '.+', $match);
 
                                // Apache 1.3 does not support the reluctant (non-greedy) modifier.
                                $match = str_replace('.+?', '.+', $match);
 
@@ -946,7 +1693,19 @@ class WP_Rewrite {
                return $rules;
        }
 
                return $rules;
        }
 
-       //Add a straight rewrite rule
+       /**
+        * Add a straight rewrite rule.
+        *
+        * Any value in the $after parameter that isn't 'bottom' will be placed at
+        * the top of the rules.
+        *
+        * @since 2.1.0
+        * @access public
+        *
+        * @param string $regex Regular expression to match against request.
+        * @param string $redirect URL regex redirects to when regex matches request.
+        * @param string $after Optional, default is bottom. Location to place rule.
+        */
        function add_rule($regex, $redirect, $after = 'bottom') {
                //get everything up to the first ?
                $index = (strpos($redirect, '?') == false ? strlen($redirect) : strpos($redirect, '?'));
        function add_rule($regex, $redirect, $after = 'bottom') {
                //get everything up to the first ?
                $index = (strpos($redirect, '?') == false ? strlen($redirect) : strpos($redirect, '?'));
@@ -962,24 +1721,67 @@ class WP_Rewrite {
                }
        }
 
                }
        }
 
-       //add a rule that doesn't redirect to index.php
+       /**
+        * Add a rule that doesn't redirect to index.php.
+        *
+        * Can redirect to any place.
+        *
+        * @since 2.1.0
+        * @access public
+        *
+        * @param string $regex Regular expression to match against request.
+        * @param string $redirect URL regex redirects to when regex matches request.
+        */
        function add_external_rule($regex, $redirect) {
                $this->non_wp_rules[$regex] = $redirect;
        }
 
        function add_external_rule($regex, $redirect) {
                $this->non_wp_rules[$regex] = $redirect;
        }
 
-       //add an endpoint, like /trackback/, to be inserted after certain URL types (specified in $places)
+       /**
+        * Add an endpoint, like /trackback/.
+        *
+        * To be inserted after certain URL types (specified in $places).
+        *
+        * @since 2.1.0
+        * @access public
+        *
+        * @param string $name Name of endpoint.
+        * @param array $places URL types that endpoint can be used.
+        */
        function add_endpoint($name, $places) {
                global $wp;
                $this->endpoints[] = array ( $places, $name );
                $wp->add_query_var($name);
        }
 
        function add_endpoint($name, $places) {
                global $wp;
                $this->endpoints[] = array ( $places, $name );
                $wp->add_query_var($name);
        }
 
+       /**
+        * Add permalink structure.
+        *
+        * These are added along with the extra rewrite rules that are merged to the
+        * top.
+        *
+        * @since unknown
+        * @access public
+        *
+        * @param string $name Name for permalink structure.
+        * @param string $struct Permalink structure.
+        * @param bool $with_front Prepend front base to permalink structure.
+        */
        function add_permastruct($name, $struct, $with_front = true) {
                if ( $with_front )
                        $struct = $this->front . $struct;
                $this->extra_permastructs[$name] = $struct;
        }
 
        function add_permastruct($name, $struct, $with_front = true) {
                if ( $with_front )
                        $struct = $this->front . $struct;
                $this->extra_permastructs[$name] = $struct;
        }
 
+       /**
+        * Remove rewrite rules and then recreate rewrite rules.
+        *
+        * Calls {@link WP_Rewrite::wp_rewrite_rules()} after removing the
+        * 'rewrite_rules' option. If the function named 'save_mod_rewrite_rules'
+        * exists, it will be called.
+        *
+        * @since 2.0.1
+        * @access public
+        */
        function flush_rules() {
                delete_option('rewrite_rules');
                $this->wp_rewrite_rules();
        function flush_rules() {
                delete_option('rewrite_rules');
                $this->wp_rewrite_rules();
@@ -987,6 +1789,16 @@ class WP_Rewrite {
                        save_mod_rewrite_rules();
        }
 
                        save_mod_rewrite_rules();
        }
 
+       /**
+        * 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%',
+        * '%tag%', or '%author%'.
+        *
+        * @since 1.5.0
+        * @access public
+        */
        function init() {
                $this->extra_rules = $this->non_wp_rules = $this->endpoints = array();
                $this->permalink_structure = get_option('permalink_structure');
        function init() {
                $this->extra_rules = $this->non_wp_rules = $this->endpoints = array();
                $this->permalink_structure = get_option('permalink_structure');
@@ -1019,6 +1831,18 @@ class WP_Rewrite {
                        $this->use_verbose_page_rules = false;
        }
 
                        $this->use_verbose_page_rules = false;
        }
 
+       /**
+        * Set the main permalink structure for the blog.
+        *
+        * Will update the 'permalink_structure' option, if there is a difference
+        * between the current permalink structure and the parameter value. Calls
+        * {@link WP_Rewrite::init()} after the option is updated.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $permalink_structure Permalink structure.
+        */
        function set_permalink_structure($permalink_structure) {
                if ($permalink_structure != $this->permalink_structure) {
                        update_option('permalink_structure', $permalink_structure);
        function set_permalink_structure($permalink_structure) {
                if ($permalink_structure != $this->permalink_structure) {
                        update_option('permalink_structure', $permalink_structure);
@@ -1026,6 +1850,18 @@ class WP_Rewrite {
                }
        }
 
                }
        }
 
+       /**
+        * Set the category base for the category permalink.
+        *
+        * Will update the 'category_base' option, if there is a difference between
+        * the current category base and the parameter value. Calls
+        * {@link WP_Rewrite::init()} after the option is updated.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @param string $category_base Category permalink structure base.
+        */
        function set_category_base($category_base) {
                if ($category_base != $this->category_base) {
                        update_option('category_base', $category_base);
        function set_category_base($category_base) {
                if ($category_base != $this->category_base) {
                        update_option('category_base', $category_base);
@@ -1033,6 +1869,18 @@ class WP_Rewrite {
                }
        }
 
                }
        }
 
+       /**
+        * Set the tag base for the tag permalink.
+        *
+        * Will update the 'tag_base' option, if there is a difference between the
+        * current tag base and the parameter value. Calls
+        * {@link WP_Rewrite::init()} after the option is updated.
+        *
+        * @since 2.3.0
+        * @access public
+        *
+        * @param string $tag_base Tag permalink structure base.
+        */
        function set_tag_base( $tag_base ) {
                if ( $tag_base != $this->tag_base ) {
                        update_option( 'tag_base', $tag_base );
        function set_tag_base( $tag_base ) {
                if ( $tag_base != $this->tag_base ) {
                        update_option( 'tag_base', $tag_base );
@@ -1040,6 +1888,14 @@ class WP_Rewrite {
                }
        }
 
                }
        }
 
+       /**
+        * PHP4 Constructor - Calls init(), which runs setup.
+        *
+        * @since 1.5.0
+        * @access public
+        *
+        * @return WP_Rewrite
+        */
        function WP_Rewrite() {
                $this->init();
        }
        function WP_Rewrite() {
                $this->init();
        }
index 15b0a8dd78e34bca2df38c9f5376a2714176693a..9962773486de233bbd9d54779e1f443326186978 100644 (file)
@@ -17,7 +17,7 @@
  */
 do_action('load_feed_engine');
 
  */
 do_action('load_feed_engine');
 
-
+/** RSS feed constant. */
 define('RSS', 'RSS');
 define('ATOM', 'Atom');
 define('MAGPIE_USER_AGENT', 'WordPress/' . $GLOBALS['wp_version']);
 define('RSS', 'RSS');
 define('ATOM', 'Atom');
 define('MAGPIE_USER_AGENT', 'WordPress/' . $GLOBALS['wp_version']);
@@ -384,9 +384,18 @@ class MagpieRSS {
        }
 
 }
        }
 
 }
-require_once( dirname(__FILE__) . '/class-snoopy.php');
 
 if ( !function_exists('fetch_rss') ) :
 
 if ( !function_exists('fetch_rss') ) :
+/**
+ * Build Magpie object based on RSS from URL.
+ *
+ * @since unknown
+ * @package External
+ * @subpackage MagpieRSS
+ *
+ * @param string $url URL to retrieve feed
+ * @return bool|MagpieRSS false on failure or MagpieRSS object on success.
+ */
 function fetch_rss ($url) {
        // initialize constants
        init();
 function fetch_rss ($url) {
        // initialize constants
        init();
@@ -450,7 +459,7 @@ function fetch_rss ($url) {
                // setup headers
                if ( $cache_status == 'STALE' ) {
                        $rss = $cache->get( $url );
                // setup headers
                if ( $cache_status == 'STALE' ) {
                        $rss = $cache->get( $url );
-                       if ( $rss->etag and $rss->last_modified ) {
+                       if ( isset($rss->etag) and $rss->last_modified ) {
                                $request_headers['If-None-Match'] = $rss->etag;
                                $request_headers['If-Last-Modified'] = $rss->last_modified;
                        }
                                $request_headers['If-None-Match'] = $rss->etag;
                                $request_headers['If-Last-Modified'] = $rss->last_modified;
                        }
@@ -515,29 +524,55 @@ function fetch_rss ($url) {
 } // end fetch_rss()
 endif;
 
 } // end fetch_rss()
 endif;
 
+/**
+ * Retrieve URL headers and content using WP HTTP Request API.
+ *
+ * @since unknown
+ * @package External
+ * @subpackage MagpieRSS
+ *
+ * @param string $url URL to retrieve
+ * @param array $headers Optional. Headers to send to the URL.
+ * @return Snoopy style response
+ */
 function _fetch_remote_file ($url, $headers = "" ) {
 function _fetch_remote_file ($url, $headers = "" ) {
-       // Snoopy is an HTTP client in PHP
-       $client = new Snoopy();
-       $client->agent = MAGPIE_USER_AGENT;
-       $client->read_timeout = MAGPIE_FETCH_TIME_OUT;
-       $client->use_gzip = MAGPIE_USE_GZIP;
-       if (is_array($headers) ) {
-               $client->rawheaders = $headers;
-       }
-
-       @$client->fetch($url);
-       return $client;
-
+       $resp = wp_remote_request($url, array('headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT));
+       if ( is_wp_error($resp) ) {
+               $error = array_shift($resp->errors);
+
+               $resp = new stdClass;
+               $resp->status = 500;
+               $resp->response_code = 500;
+               $resp->error = $error[0] . "\n"; //\n = Snoopy compatibility
+               return $resp;
+       }
+       $response = new stdClass;
+       $response->status = $resp['response']['code'];
+       $response->response_code = $resp['response']['code'];
+       $response->headers = $resp['headers'];
+       $response->results = $resp['body'];
+
+       return $response;
 }
 
 }
 
+/**
+ * Retrieve
+ *
+ * @since unknown
+ * @package External
+ * @subpackage MagpieRSS
+ *
+ * @param unknown_type $resp
+ * @return unknown
+ */
 function _response_to_rss ($resp) {
        $rss = new MagpieRSS( $resp->results );
 
        // if RSS parsed successfully
 function _response_to_rss ($resp) {
        $rss = new MagpieRSS( $resp->results );
 
        // if RSS parsed successfully
-       if ( $rss and !$rss->ERROR) {
+       if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) {
 
                // find Etag, and Last-Modified
 
                // find Etag, and Last-Modified
-               foreach($resp->headers as $h) {
+               foreach( (array) $resp->headers as $h) {
                        // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
                        if (strpos($h, ": ")) {
                                list($field, $val) = explode(": ", $h, 2);
                        // 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
                        if (strpos($h, ": ")) {
                                list($field, $val) = explode(": ", $h, 2);
@@ -570,11 +605,13 @@ function _response_to_rss ($resp) {
        } // end if ($rss and !$rss->error)
 }
 
        } // end if ($rss and !$rss->error)
 }
 
-/*=======================================================================*\
-       Function:       init
-       Purpose:        setup constants with default values
-                               check for user overrides
-\*=======================================================================*/
+/**
+ * Setup constants with default values, unless user overrides.
+ *
+ * @since unknown
+ * @package External
+ * @subpackage MagpieRSS
+ */
 function init () {
        if ( defined('MAGPIE_INITALIZED') ) {
                return;
 function init () {
        if ( defined('MAGPIE_INITALIZED') ) {
                return;
@@ -835,6 +872,16 @@ function parse_w3cdtf ( $date_str ) {
 endif;
 
 if ( !function_exists('wp_rss') ) :
 endif;
 
 if ( !function_exists('wp_rss') ) :
+/**
+ * Display all RSS items in a HTML ordered list.
+ *
+ * @since unknown
+ * @package External
+ * @subpackage MagpieRSS
+ *
+ * @param string $url URL of feed to display. Will not auto sense feed URL.
+ * @param int $num_items Optional. Number of items to display, default is all.
+ */
 function wp_rss( $url, $num_items = -1 ) {
        if ( $rss = fetch_rss( $url ) ) {
                echo '<ul>';
 function wp_rss( $url, $num_items = -1 ) {
        if ( $rss = fetch_rss( $url ) ) {
                echo '<ul>';
@@ -843,7 +890,7 @@ function wp_rss( $url, $num_items = -1 ) {
                        $rss->items = array_slice( $rss->items, 0, $num_items );
                }
 
                        $rss->items = array_slice( $rss->items, 0, $num_items );
                }
 
-               foreach ( $rss->items as $item ) {
+               foreach ( (array) $rss->items as $item ) {
                        printf(
                                '<li><a href="%1$s" title="%2$s">%3$s</a></li>',
                                clean_url( $item['link'] ),
                        printf(
                                '<li><a href="%1$s" title="%2$s">%3$s</a></li>',
                                clean_url( $item['link'] ),
@@ -860,11 +907,27 @@ function wp_rss( $url, $num_items = -1 ) {
 endif;
 
 if ( !function_exists('get_rss') ) :
 endif;
 
 if ( !function_exists('get_rss') ) :
+/**
+ * Display RSS items in HTML list items.
+ *
+ * You have to specify which HTML list you want, either ordered or unordered
+ * before using the function. You also have to specify how many items you wish
+ * to display. You can't display all of them like you can with wp_rss()
+ * function.
+ *
+ * @since unknown
+ * @package External
+ * @subpackage MagpieRSS
+ *
+ * @param string $url URL of feed to display. Will not auto sense feed URL.
+ * @param int $num_items Optional. Number of items to display, default is all.
+ * @return bool False on failure.
+ */
 function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS
        $rss = fetch_rss($url);
        if ( $rss ) {
                $rss->items = array_slice($rss->items, 0, $num_items);
 function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS
        $rss = fetch_rss($url);
        if ( $rss ) {
                $rss->items = array_slice($rss->items, 0, $num_items);
-               foreach ($rss->items as $item ) {
+               foreach ( (array) $rss->items as $item ) {
                        echo "<li>\n";
                        echo "<a href='$item[link]' title='$item[description]'>";
                        echo htmlentities($item['title']);
                        echo "<li>\n";
                        echo "<a href='$item[link]' title='$item[description]'>";
                        echo htmlentities($item['title']);
@@ -877,4 +940,4 @@ function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS
 }
 endif;
 
 }
 endif;
 
-?>
\ No newline at end of file
+?>
index 0d9f966d2dccc671dc9e74485b31d97a531072dc..32b1bd29e25212a0da5aea04f4fda4017136f390 100644 (file)
@@ -1,21 +1,50 @@
 <?php
 <?php
-
+/**
+ * WordPress scripts and styles default loader.
+ *
+ * Most of the functionality that existed here was moved to
+ * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
+ * plugins will only be concerned about the filters and actions set in this
+ * file.
+ *
+ * @package WordPress
+ */
+
+/** BackPress: WordPress Dependencies Class */
 require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
 require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
+
+/** BackPress: WordPress Scripts Class */
 require( ABSPATH . WPINC . '/class.wp-scripts.php' );
 require( ABSPATH . WPINC . '/class.wp-scripts.php' );
+
+/** BackPress: WordPress Scripts Functions */
 require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
 require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
+
+/** BackPress: WordPress Styles Class */
 require( ABSPATH . WPINC . '/class.wp-styles.php' );
 require( ABSPATH . WPINC . '/class.wp-styles.php' );
+
+/** BackPress: WordPress Styles Functions */
 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
 
 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
 
+/**
+ * Setup WordPress scripts to load by default for Administration Panels.
+ *
+ * Localizes a few of the scripts.
+ *
+ * @since 2.6.0
+ *
+ * @param object $scripts WP_Scripts object.
+ */
 function wp_default_scripts( &$scripts ) {
        if (!$guessurl = site_url())
                $guessurl = wp_guess_url();
 function wp_default_scripts( &$scripts ) {
        if (!$guessurl = site_url())
                $guessurl = wp_guess_url();
+
        $scripts->base_url = $guessurl;
        $scripts->default_version = get_bloginfo( 'version' );
 
        $scripts->base_url = $guessurl;
        $scripts->default_version = get_bloginfo( 'version' );
 
-       $scripts->add( 'common', '/wp-admin/js/common.js', array('jquery'), '20080318' );
+       $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( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
 
-       $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' );
+       $scripts->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '20081210' );
        $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:'),
@@ -25,37 +54,37 @@ function wp_default_scripts( &$scripts ) {
                'closeTags' => attribute_escape(__('close tags')),
                'enterURL' => __('Enter the URL'),
                'enterImageURL' => __('Enter the URL of the image'),
                'closeTags' => attribute_escape(__('close tags')),
                'enterURL' => __('Enter the URL'),
                'enterImageURL' => __('Enter the URL of the image'),
-               'enterImageDescription' => __('Enter a description 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' );
 
        ) );
 
        $scripts->add( 'colorpicker', '/wp-includes/js/colorpicker.js', array('prototype'), '3517' );
 
-       // Let a plugin replace the visual editor
-       $visual_editor = apply_filters('visual_editor', array('tiny_mce'));
-       $scripts->add( 'editor', false, $visual_editor, '20080321' );
-
-       $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' );
-
        // Modify this version when tinyMCE plugins are changed.
        // Modify this version when tinyMCE plugins are changed.
-       $mce_version = apply_filters('tiny_mce_version', '20080810');
-       $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
+       function mce_version() {
+               return '20081129';
+       }
+       add_filter( 'tiny_mce_version', 'mce_version' );
+
+       $scripts->add( 'editor', '/wp-admin/js/editor.js', false, mce_version() );
 
        $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'), '20080316' );
+       $scripts->add( 'wp-ajax-response', '/wp-includes/js/wp-ajax-response.js', array('jquery'), '20081210' );
        $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
                'noPerm' => __('You do not have permission to do that.'),
        $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
                'noPerm' => __('You do not have permission to do that.'),
-               'broken' => __('An unidentified error has occurred.')
+               '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'), '20080622' );
+       $scripts->add( 'autosave', '/wp-includes/js/autosave.js', array('schedule', 'wp-ajax-response'), '20081210' );
 
 
-       $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20080729' );
+       $scripts->add( 'wp-lists', '/wp-includes/js/wp-lists.js', array('wp-ajax-response'), '20081210' );
        $scripts->localize( 'wp-lists', 'wpListL10n', array(
                'url' => admin_url('admin-ajax.php')
        ) );
 
        $scripts->localize( 'wp-lists', 'wpListL10n', array(
                'url' => admin_url('admin-ajax.php')
        ) );
 
-       $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.8.0');
+       $scripts->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.8.0');
        $scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
        $scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
        $scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
        $scripts->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.8.0');
        $scripts->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.8.0');
        $scripts->add( 'scriptaculous-effects', '/wp-includes/js/scriptaculous/effects.js', array('scriptaculous-root'), '1.8.0');
@@ -72,14 +101,17 @@ function wp_default_scripts( &$scripts ) {
        $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( '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( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array('jquery'), '3.1-20080430');
-       $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', false, '2.0.2-20080430');
-       $scripts->add( 'swfupload-degrade', '/wp-includes/js/swfupload/plugins/swfupload.graceful_degradation.js', array('swfupload'), '2.0.2');
+       $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->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.0.2');
-       $scripts->add( 'swfupload-handlers', '/wp-includes/js/swfupload/handlers.js', array('swfupload'), '2.0.2-20080407');
+       $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');
        // 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.'),
@@ -98,47 +130,56 @@ function wp_default_scripts( &$scripts ) {
                        'dismiss' => __('Dismiss'),
                        'crunching' => __('Crunching&hellip;'),
                        'deleted' => __('Deleted'),
                        'dismiss' => __('Dismiss'),
                        'crunching' => __('Crunching&hellip;'),
                        'deleted' => __('Deleted'),
+                       'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
        ) );
 
        ) );
 
-       $scripts->add( 'jquery-ui-core', '/wp-includes/js/jquery/ui.core.js', array('jquery'), '1.5.1' );
-       $scripts->add( 'jquery-ui-tabs', '/wp-includes/js/jquery/ui.tabs.js', array('jquery-ui-core'), '1.5.1' );
-       $scripts->add( 'jquery-ui-sortable', '/wp-includes/js/jquery/ui.sortable.js', array('jquery-ui-core'), '1.5.1' );
+       $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');
 
        if ( is_admin() ) {
 
        if ( is_admin() ) {
-               $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20071101' );
+               $scripts->add( 'ajaxcat', '/wp-admin/js/cat.js', array( 'wp-lists' ), '20081210' );
                $scripts->localize( 'ajaxcat', 'catL10n', array(
                        'add' => attribute_escape(__('Add')),
                $scripts->localize( 'ajaxcat', 'catL10n', array(
                        'add' => attribute_escape(__('Add')),
-                       'how' => __('Separate multiple categories with commas.')
+                       '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'), '20071031' );
-               $scripts->add( 'admin-tags', '/wp-admin/js/tags.js', array('wp-lists'), '20071031' );
-               $scripts->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' );
-               $scripts->add( 'password-strength-meter', '/wp-admin/js/password-strength-meter.js', array('jquery'), '20070405' );
+               $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->localize( 'password-strength-meter', 'pwsL10n', array(
                $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
-                       'short' => __('Too short'),
-                       'bad' => __('Bad'),
-                       'good' => __('Good'),
-                       'strong' => __('Strong')
+                       'empty' => __('Strength indicator'),
+                       'short' => __('Very weak'),
+                       'bad' => __('Weak'),
+                       'good' => _c('Medium|password strength'),
+                       'strong' => __('Strong'),
+                       'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
                ) );
                ) );
-               $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20080311' );
+               $scripts->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists', 'jquery-ui-resizable', 'quicktags'), '20081210' );
                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
-                       'pending' => __('%i% pending') // must look like: "# blah blah"
+                       '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'), '20070823' );
-               $scripts->add( 'admin-forms', '/wp-admin/js/forms.js', array('jquery'), '20080729');
+               $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( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
-               $scripts->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' );
-               $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery'), '20080128' );
+               $scripts->add( 'postbox', '/wp-admin/js/postbox.js', array('jquery-ui-sortable'), '20081210' );
                $scripts->localize( 'postbox', 'postboxL10n', array(
                $scripts->localize( 'postbox', 'postboxL10n', array(
-                       'requestFile' => admin_url('admin-ajax.php'),
+                       'requestFile' => admin_url('admin-ajax.php')
                ) );
                ) );
-               $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20080208' );
+               $scripts->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20081210' );
                $scripts->localize( 'slug', 'slugL10n', array(
                        'requestFile' => admin_url('admin-ajax.php'),
                        'save' => __('Save'),
                        'cancel' => __('Cancel'),
                $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'), '20080629' );
+               $scripts->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20081210' );
                $scripts->localize( 'post', 'postL10n', array(
                        'tagsUsed' =>  __('Tags used on this post:'),
                        'add' => attribute_escape(__('Add')),
                $scripts->localize( 'post', 'postL10n', array(
                        'tagsUsed' =>  __('Tags used on this post:'),
                        'add' => attribute_escape(__('Add')),
@@ -146,99 +187,172 @@ function wp_default_scripts( &$scripts ) {
                        'separate' => __('Separate tags with commas'),
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
                        'separate' => __('Separate tags with commas'),
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
+                       'publishOn' => __('Publish on:'),
+                       'publishOnFuture' =>  __('Schedule for:'),
+                       'publishOnPast' => __('Published on:'),
+                       'showcomm' => __('Show more comments'),
+                       'endcomm' => __('No more comments found.'),
+                       'publish' => __('Publish'),
+                       'schedule' => __('Schedule'),
+                       'update' => __('Update Post'),
+                       'savePending' => __('Save as Pending'),
+                       'saveDraft' => __('Save Draft'),
+                       'private' => __('Private'),
+                       'public' => __('Public'),
+                       'publicSticky' => __('Public, Sticky'),
+                       'password' => __('Password Protected'),
+                       'privatelyPublished' => __('Privately Published'),
+                       'published' => __('Published'),
+                       'l10n_print_after' => 'try{convertEntities(postL10n);}catch(e){};'
                ) );
                ) );
-               $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080318' );
+               $scripts->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'wp-lists', 'postbox'), '20081210' );
                $scripts->localize( 'page', 'postL10n', array(
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
                $scripts->localize( 'page', 'postL10n', array(
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
+                       'publishOn' => __('Publish on:'),
+                       'publishOnFuture' =>  __('Schedule for:'),
+                       'publishOnPast' => __('Published on:'),
+                       'showcomm' => __('Show more comments'),
+                       'endcomm' => __('No more comments found.'),
+                       'publish' => __('Publish'),
+                       'schedule' => __('Schedule'),
+                       'update' => __('Update Page'),
+                       'savePending' => __('Save as Pending'),
+                       'saveDraft' => __('Save Draft'),
+                       'private' => __('Private'),
+                       'public' => __('Public'),
+                       'password' => __('Password Protected'),
+                       'privatelyPublished' => __('Privately Published'),
+                       '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'), '20080131' );
-               $scripts->add( 'comment', '/wp-admin/js/comment.js', array('postbox'), '20080219' );
+               $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->localize( 'comment', 'commentL10n', array(
                        'cancel' => __('Cancel'),
                        'edit' => __('Edit'),
                $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' ), '20080709' );
-               $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080710' );
-               $scripts->localize( 'upload', 'uploadL10n', array(
-                       'browseTitle' => attribute_escape(__('Browse your files')),
-                       'back' => __('&laquo; Back'),
-                       'directTitle' => attribute_escape(__('Direct link to file')),
-                       'edit' => __('Edit'),
-                       'thumb' => __('Thumbnail'),
-                       'full' => __('Full size'),
-                       'icon' => __('Icon'),
-                       'title' => __('Title'),
-                       'show' => __('Show:'),
-                       'link' => __('Link to:'),
-                       'file' => __('File'),
-                       'page' => __('Page'),
-                       'none' => __('None'),
-                       'editorText' => attribute_escape(__('Send to editor &raquo;')),
-                       'insert' => __('Insert'),
-                       'urlText' => __('URL'),
-                       'desc' => __('Description'),
-                       'deleteText' => attribute_escape(__('Delete File')),
-                       'saveText' => attribute_escape(__('Save &raquo;')),
-                       'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
-               ) );
-               $scripts->add( 'admin-widgets', '/wp-admin/js/widgets.js', array( 'interface' ), '20080503' );
+               $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'),
                $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( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20080423' );
+               $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20081210' );
                $scripts->localize( 'word-count', 'wordCountL10n', array(
                $scripts->localize( 'word-count', 'wordCountL10n', array(
-                       'count' => __('Word count: %d')
+                       'count' => __('Word count: %d'),
+                       'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};'
                ));
                ));
-               
-               $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20080721' );
+
+               $scripts->add( 'wp-gears', '/wp-admin/js/wp-gears.js', false, '20081210' );
                $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
                        'updateCompleted' => __('Update completed.'),
                $scripts->localize( 'wp-gears', 'wpGearsL10n', array(
                        'updateCompleted' => __('Update completed.'),
-                       'error' => __('Error:')
+                       'error' => __('Error:'),
+                       'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};'
                ));
                ));
-               
-               $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' );
+
+               $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20081210' );
+
+               $scripts->add( 'inline-edit-post', '/wp-admin/js/inline-edit-post.js', array( 'jquery', 'jquery-form', 'suggest' ), '20081210' );
+               $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
+                       'error' => __('Error while saving the changes.'),
+                       'ntdeltitle' => __('Remove From Bulk Edit'),
+                       'notitle' => __('(no title)'),
+                       '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->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->localize( 'plugin-install', 'plugininstallL10n', array(
+                       'plugin_information' => __('Plugin Information:'),
+                       'l10n_print_after' => 'try{convertEntities(plugininstallL10n);}catch(e){};'
+               ) );
+
+               $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( 'hoverIntent', '/wp-includes/js/hoverIntent.js', array('jquery'), '20081210' );
+
        }
 }
 
        }
 }
 
+/**
+ * Assign default styles to $styles object.
+ *
+ * Nothing is returned, because the $styles parameter is passed by reference.
+ * Meaning that whatever object is passed will be updated without having to
+ * reassign the variable that was passed back to the same value. This saves
+ * memory.
+ *
+ * Adding default styles is not the only task, it also assigns the base_url
+ * property, the default version, and text direction for the object.
+ *
+ * @since 2.6.0
+ *
+ * @param object $styles
+ */
 function wp_default_styles( &$styles ) {
 function wp_default_styles( &$styles ) {
-       if (!$guessurl = site_url())
+       // This checks to see if site_url() returns something and if it does not
+       // 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->default_version = get_bloginfo( 'version' );
        $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
 
                $guessurl = wp_guess_url();
        $styles->base_url = $guessurl;
        $styles->default_version = get_bloginfo( 'version' );
        $styles->text_direction = 'rtl' == get_bloginfo( 'text_direction' ) ? 'rtl' : 'ltr';
 
-       $rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'press-this-ie' );
+       $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' );
+       $styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20081210' );
        $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' );
+       $styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20081210' );
        $styles->add_data( 'ie', 'conditional', 'gte IE 6' );
 
        $styles->add_data( 'ie', 'conditional', 'gte IE 6' );
 
-       $styles->add( 'colors', true ); // Register "meta" stylesheet for admin colors
-       $styles->add( 'colors-fresh', '/wp-admin/css/colors-fresh.css' ); // for login.php.  Is there a better way?
+       $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?
        $styles->add_data( 'colors-fresh', 'rtl', true );
        $styles->add_data( 'colors-fresh', 'rtl', true );
-
-       $styles->add( 'global', '/wp-admin/css/global.css' );
-       $styles->add( 'media', '/wp-admin/css/media.css', array(), '20080709' );
-       $styles->add( 'widgets', '/wp-admin/css/widgets.css' );
-       $styles->add( 'dashboard', '/wp-admin/css/dashboard.css' );
-       $styles->add( 'install', '/wp-admin/css/install.css', array(), '20080708' );
-       $styles->add( 'theme-editor', '/wp-admin/css/theme-editor.css' );
-       $styles->add( 'press-this', '/wp-admin/css/press-this.css', array(), '20080710' );
-       $styles->add( 'press-this-ie', '/wp-admin/css/press-this-ie.css', array(), '20080710' );
-       $styles->add_data( 'press-this-ie', 'conditional', 'gte IE 6' );
-       $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20080613' );
-       $styles->add( 'login', '/wp-admin/css/login.css' );
+       $styles->add( 'colors-classic', '/wp-admin/css/colors-classic.css', array(), '20081210');
+       $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( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
 
        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 );
 }
 
+/**
+ * Reorder JavaScript scripts array to place prototype before jQuery.
+ *
+ * @since 2.3.1
+ *
+ * @param array $js_array JavaScript scripst array
+ * @return array Reordered array, if needed.
+ */
 function wp_prototype_before_jquery( $js_array ) {
        if ( false === $jquery = array_search( 'jquery', $js_array ) )
                return $js_array;
 function wp_prototype_before_jquery( $js_array ) {
        if ( false === $jquery = array_search( 'jquery', $js_array ) )
                return $js_array;
@@ -256,18 +370,53 @@ function wp_prototype_before_jquery( $js_array ) {
        return $js_array;
 }
 
        return $js_array;
 }
 
-// These localizations require information that may not be loaded even by init
+/**
+ * Load localized script just in time for MCE.
+ *
+ * These localizations require information that may not be loaded even by init.
+ *
+ * @since 2.5.0
+ */
 function wp_just_in_time_script_localization() {
 function wp_just_in_time_script_localization() {
-       wp_localize_script( 'tiny_mce', 'wpTinyMCEConfig', array( 'defaultEditor' => wp_default_editor() ) );
+       global $current_user;
+
        wp_localize_script( 'autosave', 'autosaveL10n', array(
                'autosaveInterval' => AUTOSAVE_INTERVAL,
                'previewPageText' => __('Preview this Page'),
                'previewPostText' => __('Preview this Post'),
                'requestFile' => admin_url('admin-ajax.php'),
        wp_localize_script( 'autosave', 'autosaveL10n', array(
                'autosaveInterval' => AUTOSAVE_INTERVAL,
                'previewPageText' => __('Preview this Page'),
                'previewPostText' => __('Preview this Post'),
                'requestFile' => admin_url('admin-ajax.php'),
-               'savingText' => __('Saving Draft&#8230;')
+               'savingText' => __('Saving Draft&#8230;'),
+               '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()
        ) );
 }
 
        ) );
 }
 
+/**
+ * Administration Panel CSS for changing the styles.
+ *
+ * If installing the 'wp-admin/' directory will be replaced with './'.
+ *
+ * The $_wp_admin_css_colors global manages the Administration Panels CSS
+ * stylesheet that is loaded. The option that is set is 'admin_color' and is the
+ * color and key for the array. The value for the color key is an object with
+ * a 'url' parameter that has the URL path to the CSS file.
+ *
+ * The query from $src parameter will be appended to the URL that is given from
+ * the $_wp_admin_css_colors array value URL.
+ *
+ * @since 2.6.0
+ * @uses $_wp_admin_css_colors
+ *
+ * @param string $src Source URL.
+ * @param string $handle Either 'colors' or 'colors-rtl'.
+ * @return string URL path to CSS stylesheet for Administration Panels.
+ */
 function wp_style_loader_src( $src, $handle ) {
        if ( defined('WP_INSTALLING') )
                return preg_replace( '#^wp-admin/#', './', $src );
 function wp_style_loader_src( $src, $handle ) {
        if ( defined('WP_INSTALLING') )
                return preg_replace( '#^wp-admin/#', './', $src );
index 2cc808ce481b36c11f36413d3f2a7d1ff6013713..c1c6862ba2b5b663ddf9f7912c4382c43ef76ce6 100644 (file)
@@ -48,7 +48,7 @@ $shortcode_tags = array();
  * There can only be one hook for each shortcode. Which means that if another
  * plugin has a similar shortcode, it will override yours or yours will override
  * theirs depending on which order the plugins are included and/or ran.
  * There can only be one hook for each shortcode. Which means that if another
  * plugin has a similar shortcode, it will override yours or yours will override
  * theirs depending on which order the plugins are included and/or ran.
- * 
+ *
  * Simplest example of a shortcode tag using the API:
  *
  * <code>
  * Simplest example of a shortcode tag using the API:
  *
  * <code>
@@ -188,10 +188,10 @@ function do_shortcode_tag($m) {
 
        if ( isset($m[4]) ) {
                // enclosing tag - extra parameter
 
        if ( isset($m[4]) ) {
                // enclosing tag - extra parameter
-               return call_user_func($shortcode_tags[$tag], $attr, $m[4]);
+               return call_user_func($shortcode_tags[$tag], $attr, $m[4], $tag);
        } else {
                // self-closing tag
        } else {
                // self-closing tag
-               return call_user_func($shortcode_tags[$tag], $attr);
+               return call_user_func($shortcode_tags[$tag], $attr, NULL, $tag);
        }
 }
 
        }
 }
 
@@ -204,7 +204,7 @@ function do_shortcode_tag($m) {
  *
  * @since 2.5
  *
  *
  * @since 2.5
  *
- * @param string $text 
+ * @param string $text
  * @return array List of attributes and their value.
  */
 function shortcode_parse_atts($text) {
  * @return array List of attributes and their value.
  */
 function shortcode_parse_atts($text) {
@@ -278,6 +278,6 @@ function strip_shortcodes( $content ) {
        return preg_replace('/'.$pattern.'/s', '', $content);
 }
 
        return preg_replace('/'.$pattern.'/s', '', $content);
 }
 
-add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop() 
+add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()
 
 ?>
\ No newline at end of file
 
 ?>
\ No newline at end of file
index e8da100c7fbf3990f7dbea9e412ed8354fbf7845..12fd8b7cb823ba45679e258f4b86615f76a3648b 100644 (file)
@@ -1,8 +1,10 @@
 <?php
 /**
 <?php
 /**
+ * Taxonomy API
+ *
  * @package WordPress
  * @subpackage Taxonomy
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  */
 
 //
  */
 
 //
@@ -11,7 +13,7 @@
 
 /**
  * Default Taxonomy Objects
 
 /**
  * Default Taxonomy Objects
- * @since 2.3
+ * @since 2.3.0
  * @global array $wp_taxonomies
  */
 $wp_taxonomies = array();
  * @global array $wp_taxonomies
  */
 $wp_taxonomies = array();
@@ -30,7 +32,7 @@ $wp_taxonomies['link_category'] = (object) array('name' => 'link_category', 'obj
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wp_taxonomies
  *
  *
  * @uses $wp_taxonomies
  *
@@ -49,7 +51,7 @@ function get_object_taxonomies($object) {
        $object = (array) $object;
 
        $taxonomies = array();
        $object = (array) $object;
 
        $taxonomies = array();
-       foreach ( $wp_taxonomies as $taxonomy ) {
+       foreach ( (array) $wp_taxonomies as $taxonomy ) {
                if ( array_intersect($object, (array) $taxonomy->object_type) )
                        $taxonomies[] = $taxonomy->name;
        }
                if ( array_intersect($object, (array) $taxonomy->object_type) )
                        $taxonomies[] = $taxonomy->name;
        }
@@ -65,7 +67,7 @@ function get_object_taxonomies($object) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wp_taxonomies
  * @uses is_taxonomy() Checks whether taxonomy exists
  *
  * @uses $wp_taxonomies
  * @uses is_taxonomy() Checks whether taxonomy exists
@@ -87,7 +89,7 @@ function get_taxonomy( $taxonomy ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wp_taxonomies
  *
  *
  * @uses $wp_taxonomies
  *
@@ -110,7 +112,7 @@ function is_taxonomy( $taxonomy ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses is_taxonomy() Checks whether taxonomy exists
  * @uses get_taxonomy() Used to get the taxonomy object
  *
  * @uses is_taxonomy() Checks whether taxonomy exists
  * @uses get_taxonomy() Used to get the taxonomy object
@@ -153,7 +155,7 @@ function is_taxonomy_hierarchical($taxonomy) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wp_taxonomies Inserts new taxonomy object into the list
  * @uses $wp_rewrite Adds rewrite tags and permastructs
  * @uses $wp Adds query vars
  * @uses $wp_taxonomies Inserts new taxonomy object into the list
  * @uses $wp_rewrite Adds rewrite tags and permastructs
  * @uses $wp Adds query vars
@@ -210,7 +212,7 @@ function register_taxonomy( $taxonomy, $object_type, $args = array() ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses wp_parse_args() Creates an array from string $args.
  *
  * @uses $wpdb
  * @uses wp_parse_args() Creates an array from string $args.
@@ -230,7 +232,7 @@ function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
        if ( !is_array($taxonomies) )
                $taxonomies = array($taxonomies);
 
        if ( !is_array($taxonomies) )
                $taxonomies = array($taxonomies);
 
-       foreach ( $taxonomies as $taxonomy ) {
+       foreach ( (array) $taxonomies as $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'));
        }
@@ -281,7 +283,7 @@ function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses sanitize_term() Cleanses the term based on $filter context before returning.
  *
  * @uses $wpdb
  * @uses sanitize_term() Cleanses the term based on $filter context before returning.
@@ -297,16 +299,22 @@ function get_objects_in_term( $terms, $taxonomies, $args = array() ) {
 function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
        global $wpdb;
 
 function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
        global $wpdb;
 
-       if ( empty($term) )
-               return null;
+       if ( empty($term) ) {
+               $error = new WP_Error('invalid_term', __('Empty Term'));
+               return $error;
+       }
 
 
-       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;
+       }
 
 
-       if ( is_object($term) ) {
+       if ( is_object($term) && empty($term->filter) ) {
                wp_cache_add($term->term_id, $term, $taxonomy);
                $_term = $term;
        } else {
                wp_cache_add($term->term_id, $term, $taxonomy);
                $_term = $term;
        } else {
+               if ( is_object($term) )
+                       $term = $term->term_id;
                $term = (int) $term;
                if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
                        $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) );
                $term = (int) $term;
                if ( ! $_term = wp_cache_get($term, $taxonomy) ) {
                        $_term = $wpdb->get_row( $wpdb->prepare( "SELECT t.*, tt.* FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy = %s AND t.term_id = %s LIMIT 1", $taxonomy, $term) );
@@ -321,9 +329,11 @@ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
        if ( $output == OBJECT ) {
                return $_term;
        } elseif ( $output == ARRAY_A ) {
        if ( $output == OBJECT ) {
                return $_term;
        } elseif ( $output == ARRAY_A ) {
-               return get_object_vars($_term);
+               $__term = get_object_vars($_term);
+               return $__term;
        } elseif ( $output == ARRAY_N ) {
        } elseif ( $output == ARRAY_N ) {
-               return array_values(get_object_vars($_term));
+               $__term = array_values(get_object_vars($_term));
+               return $__term;
        } else {
                return $_term;
        }
        } else {
                return $_term;
        }
@@ -343,7 +353,7 @@ function &get_term($term, $taxonomy, $output = OBJECT, $filter = 'raw') {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses sanitize_term() Cleanses the term based on $filter context before returning.
  *
  * @uses $wpdb
  * @uses sanitize_term() Cleanses the term based on $filter context before returning.
@@ -369,6 +379,7 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
                        return false;
        } else if ( 'name' == $field ) {
                // Assume already escaped
                        return false;
        } else if ( 'name' == $field ) {
                // Assume already escaped
+               $value = stripslashes($value);
                $field = 't.name';
        } else {
                $field = 't.term_id';
                $field = 't.name';
        } else {
                $field = 't.term_id';
@@ -404,7 +415,7 @@ function get_term_by($field, $value, $taxonomy, $output = OBJECT, $filter = 'raw
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses _get_term_hierarchy()
  *
  * @uses $wpdb
  * @uses _get_term_hierarchy()
@@ -425,7 +436,7 @@ function get_term_children( $term, $taxonomy ) {
 
        $children = $terms[$term];
 
 
        $children = $terms[$term];
 
-       foreach ( $terms[$term] as $child ) {
+       foreach ( (array) $terms[$term] 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));
        }
@@ -442,7 +453,7 @@ function get_term_children( $term, $taxonomy ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses sanitize_term_field() Passes the return value in sanitize_term_field on success.
  *
  *
  * @uses sanitize_term_field() Passes the return value in sanitize_term_field on success.
  *
@@ -475,7 +486,7 @@ function get_term_field( $field, $term, $taxonomy, $context = 'display' ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses sanitize_term() Passes the return value on success
  *
  *
  * @uses sanitize_term() Passes the return value on success
  *
@@ -496,7 +507,7 @@ function get_term_to_edit( $id, $taxonomy ) {
 }
 
 /**
 }
 
 /**
- * Retrieve the terms in taxonomy or list of taxonomies.
+ * Retrieve the terms in a given taxonomy or list of taxonomies.
  *
  * You can fully inject any customizations to the query before it is sent, as
  * well as control the output with a filter.
  *
  * You can fully inject any customizations to the query before it is sent, as
  * well as control the output with a filter.
@@ -509,37 +520,68 @@ 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 list 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).
  *
  * order - Default is ASC. Can use DESC.
  *
  * orderby - Default is 'name'. Can be name, count, or nothing (will use
  * term_id).
  *
  * order - Default is ASC. Can use DESC.
- * hide_empty - Default is true. Will not return empty $terms.
- * fields - Default is all.
- * slug - Any terms that has this value. Default is empty string.
- * hierarchical - Whether to return hierarchical taxonomy. Default is true.
- * name__like - Default is empty string.
  *
  *
- * The argument 'pad_counts' will count all of the children along with the
- * $terms.
+ * hide_empty - Default is true. Will not return empty terms, which means
+ * terms whose count is 0 according to the given taxonomy.
+ *
+ * exclude - Default is an empty string.  A comma- or space-delimited string
+ * of term ids to exclude from the return array.  If 'include' is non-empty,
+ * '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 
+ * the primary taxonomy.  If 'include' is non-empty, 'exclude_tree' is ignored.
+ *
+ * include - Default is an empty string.  A comma- or space-delimited string
+ * of term ids to include in the return array.
+ *
+ * number - The maximum number of terms to return.  Default is empty.
+ *
+ * offset - The number by which to offset the terms query.
+ *
+ * fields - Default is 'all', which returns an array of term objects.
+ * If 'fields' is 'ids' or 'names', returns an array of
+ * integers or strings, respectively.
+ *
+ * slug - Returns terms whose "slug" matches this value. Default is empty string.
+ *
+ * hierarchical - Whether to include terms that have non-empty descendants
+ * (even if 'hide_empty' is set to true).
+ *
+ * search - Returned terms' names will contain the value of 'search',
+ * case-insensitive.  Default is an empty string.
+ *
+ * name__like - Returned terms' names will begin with the value of 'name__like',
+ * case-insensitive. Default is empty string.
+ *
+ * The argument 'pad_counts', if set to true will include the quantity of a term's
+ * children in the quantity of each term's "count" object variable.
  *
  *
- * The 'get' argument allows for overwriting 'hide_empty' and 'child_of', which
- * can be done by setting the value to 'all', instead of its default empty
- * string value.
+ * The 'get' argument, if set to 'all' instead of its default empty string,
+ * returns terms regardless of ancestry or whether the terms are empty.
  *
  *
- * The 'child_of' argument will be used if you use multiple taxonomy or the
- * first $taxonomy isn't hierarchical or 'parent' isn't used. The default is 0,
- * which will be translated to a false value. If 'child_of' is set, then
- * 'child_of' value will be tested against $taxonomy to see if 'child_of' is
- * contained within. Will return an empty array if test fails.
+ * The 'child_of' argument, when used, should be set to the integer of a term ID.  Its default
+ * is 0.  If set to a non-zero value, all returned terms will be descendants
+ * of that term according to the given taxonomy.  Hence 'child_of' is set to 0
+ * if more than one taxonomy is passed in $taxonomies, because multiple taxonomies
+ * make term ancestry ambiguous.
  *
  *
- * If 'parent' is set, then it will be used to test against the first taxonomy.
- * Much like 'child_of'. Will return an empty array if the test fails.
+ * The 'parent' argument, when used, should be set to the integer of a term ID.  Its default is
+ * the empty string '', which has a different meaning from the integer 0.
+ * If set to an integer value, all returned terms will have as an immediate
+ * ancestor the term whose ID is specified by that integer according to the given taxonomy.
+ * The 'parent' argument is different from 'child_of' in that a term X is considered a 'parent'
+ * of term Y only if term X is the father of term Y, not its grandfather or great-grandfather, etc.
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings.
  *
  * @uses $wpdb
  * @uses wp_parse_args() Merges the defaults with those defined by $args and allows for strings.
@@ -558,7 +600,7 @@ function &get_terms($taxonomies, $args = '') {
                $taxonomies = array($taxonomies);
        }
 
                $taxonomies = array($taxonomies);
        }
 
-       foreach ( $taxonomies as $taxonomy ) {
+       foreach ( (array) $taxonomies as $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'));
        }
@@ -566,7 +608,7 @@ function &get_terms($taxonomies, $args = '') {
        $in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
 
        $defaults = array('orderby' => 'name', 'order' => 'ASC',
        $in_taxonomies = "'" . implode("', '", $taxonomies) . "'";
 
        $defaults = array('orderby' => 'name', 'order' => 'ASC',
-               'hide_empty' => true, 'exclude' => '', 'include' => '',
+               'hide_empty' => true, 'exclude' => '', 'exclude_tree' => '', 'include' => '',
                'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
                'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
                'pad_counts' => false, 'offset' => '', 'search' => '');
                'number' => '', 'fields' => 'all', 'slug' => '', 'parent' => '',
                'hierarchical' => true, 'child_of' => 0, 'get' => '', 'name__like' => '',
                'pad_counts' => false, 'offset' => '', 'search' => '');
@@ -603,10 +645,16 @@ function &get_terms($taxonomies, $args = '') {
        // $args can be whatever, only use the args defined in defaults to compute the key
        $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
        $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
        // $args can be whatever, only use the args defined in defaults to compute the key
        $filter_key = ( has_filter('list_terms_exclusions') ) ? serialize($GLOBALS['wp_filter']['list_terms_exclusions']) : '';
        $key = md5( serialize( compact(array_keys($defaults)) ) . serialize( $taxonomies ) . $filter_key );
+       $last_changed = wp_cache_get('last_changed', 'terms');
+       if ( !$last_changed ) {
+               $last_changed = time();
+               wp_cache_set('last_changed', $last_changed, 'terms');
+       }
+       $cache_key = "get_terms:$key:$last_changed";
 
 
-       if ( $cache = wp_cache_get( 'get_terms', 'terms' ) ) {
-               if ( isset( $cache[ $key ] ) )
-                       return apply_filters('get_terms', $cache[$key], $taxonomies, $args);
+       if ( $cache = wp_cache_get( $cache_key, 'terms' ) ) {
+               $terms = apply_filters('get_terms', $cache, $taxonomies, $args);
+               return $terms;
        }
 
        if ( 'count' == $orderby )
        }
 
        if ( 'count' == $orderby )
@@ -624,9 +672,10 @@ function &get_terms($taxonomies, $args = '') {
        $inclusions = '';
        if ( !empty($include) ) {
                $exclude = '';
        $inclusions = '';
        if ( !empty($include) ) {
                $exclude = '';
+               $exclude_tree = '';
                $interms = preg_split('/[\s,]+/',$include);
                if ( count($interms) ) {
                $interms = preg_split('/[\s,]+/',$include);
                if ( count($interms) ) {
-                       foreach ( $interms as $interm ) {
+                       foreach ( (array) $interms as $interm ) {
                                if (empty($inclusions))
                                        $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
                                else
                                if (empty($inclusions))
                                        $inclusions = ' AND ( t.term_id = ' . intval($interm) . ' ';
                                else
@@ -640,11 +689,25 @@ function &get_terms($taxonomies, $args = '') {
        $where .= $inclusions;
 
        $exclusions = '';
        $where .= $inclusions;
 
        $exclusions = '';
+       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[] = $extrunk;
+                       foreach( (array) $excluded_children as $exterm ) {
+                               if ( empty($exclusions) )
+                                       $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
+                               else
+                                       $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
+
+                       }
+               }
+       }
        if ( !empty($exclude) ) {
                $exterms = preg_split('/[\s,]+/',$exclude);
                if ( count($exterms) ) {
        if ( !empty($exclude) ) {
                $exterms = preg_split('/[\s,]+/',$exclude);
                if ( count($exterms) ) {
-                       foreach ( $exterms as $exterm ) {
-                               if (empty($exclusions))
+                       foreach ( (array) $exterms as $exterm ) {
+                               if ( empty($exclusions) )
                                        $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
                                else
                                        $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
                                        $exclusions = ' AND ( t.term_id <> ' . intval($exterm) . ' ';
                                else
                                        $exclusions .= ' AND t.term_id <> ' . intval($exterm) . ' ';
@@ -673,14 +736,15 @@ function &get_terms($taxonomies, $args = '') {
        if ( $hide_empty && !$hierarchical )
                $where .= ' AND tt.count > 0';
 
        if ( $hide_empty && !$hierarchical )
                $where .= ' AND tt.count > 0';
 
-       if ( !empty($number) ) {
+       // don't limit the query results when we have to descend the family tree 
+       if ( ! empty($number) && ! $hierarchical && empty( $child_of ) && '' == $parent ) {
                if( $offset )
                if( $offset )
-                       $number = 'LIMIT ' . $offset . ',' . $number;
+                       $limit = 'LIMIT ' . $offset . ',' . $number;
                else
                else
-                       $number = 'LIMIT ' . $number;
+                       $limit = 'LIMIT ' . $number;
 
        } else
 
        } else
-               $number = '';
+               $limit = '';
 
        if ( !empty($search) ) {
                $search = like_escape($search);
 
        if ( !empty($search) ) {
                $search = like_escape($search);
@@ -691,43 +755,43 @@ function &get_terms($taxonomies, $args = '') {
        if ( 'all' == $fields )
                $select_this = 't.*, tt.*';
        else if ( 'ids' == $fields )
        if ( 'all' == $fields )
                $select_this = 't.*, tt.*';
        else if ( 'ids' == $fields )
-               $select_this = 't.term_id';
+               $select_this = 't.term_id, tt.parent, tt.count';
        else if ( 'names' == $fields )
        else if ( 'names' == $fields )
-               $select_this = 't.name';
+               $select_this = 't.term_id, tt.parent, tt.count, t.name';
 
 
-       $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 $number";
+       $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";
 
 
+       $terms = $wpdb->get_results($query);
        if ( 'all' == $fields ) {
        if ( 'all' == $fields ) {
-               $terms = $wpdb->get_results($query);
                update_term_cache($terms);
                update_term_cache($terms);
-       } else if ( ('ids' == $fields) || ('names' == $fields) ) {
-               $terms = $wpdb->get_col($query);
        }
 
        if ( empty($terms) ) {
                $cache[ $key ] = array();
                wp_cache_set( 'get_terms', $cache, 'terms' );
        }
 
        if ( empty($terms) ) {
                $cache[ $key ] = array();
                wp_cache_set( 'get_terms', $cache, 'terms' );
-               return apply_filters('get_terms', array(), $taxonomies, $args);
+               $terms = apply_filters('get_terms', array(), $taxonomies, $args);
+               return $terms;
        }
 
        }
 
-       if ( $child_of || $hierarchical ) {
+       if ( $child_of ) {
                $children = _get_term_hierarchy($taxonomies[0]);
                if ( ! empty($children) )
                        $terms = & _get_term_children($child_of, $terms, $taxonomies[0]);
        }
 
        // Update term counts to include children.
                $children = _get_term_hierarchy($taxonomies[0]);
                if ( ! empty($children) )
                        $terms = & _get_term_children($child_of, $terms, $taxonomies[0]);
        }
 
        // Update term counts to include children.
-       if ( $pad_counts )
+       if ( $pad_counts && 'all' == $fields )
                _pad_term_counts($terms, $taxonomies[0]);
 
        // Make sure we show empty categories that have children.
                _pad_term_counts($terms, $taxonomies[0]);
 
        // Make sure we show empty categories that have children.
-       if ( $hierarchical && $hide_empty ) {
+       if ( $hierarchical && $hide_empty && is_array($terms) ) {
                foreach ( $terms as $k => $term ) {
                        if ( ! $term->count ) {
                                $children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
                foreach ( $terms as $k => $term ) {
                        if ( ! $term->count ) {
                                $children = _get_term_children($term->term_id, $terms, $taxonomies[0]);
-                               foreach ( $children as $child )
-                                       if ( $child->count )
-                                               continue 2;
+                               if( is_array($children) )
+                                       foreach ( $children as $child )
+                                               if ( $child->count )
+                                                       continue 2;
 
                                // It really is empty
                                unset($terms[$k]);
 
                                // It really is empty
                                unset($terms[$k]);
@@ -736,8 +800,22 @@ function &get_terms($taxonomies, $args = '') {
        }
        reset ( $terms );
 
        }
        reset ( $terms );
 
-       $cache[ $key ] = $terms;
-       wp_cache_set( 'get_terms', $cache, 'terms' );
+       $_terms = array();
+       if ( 'ids' == $fields ) {
+               while ( $term = array_shift($terms) )
+                       $_terms[] = $term->term_id;
+               $terms = $_terms;
+       } elseif ( 'names' == $fields ) {
+               while ( $term = array_shift($terms) )
+                       $_terms[] = $term->name;
+               $terms = $_terms;
+       }
+
+       if ( 0 < $number && intval(@count($terms)) > $number ) {
+               $terms = array_slice($terms, $offset, $number);
+       }
+
+       wp_cache_add( $cache_key, $terms, 'terms' );
 
        $terms = apply_filters('get_terms', $terms, $taxonomies, $args);
        return $terms;
 
        $terms = apply_filters('get_terms', $terms, $taxonomies, $args);
        return $terms;
@@ -750,7 +828,7 @@ function &get_terms($taxonomies, $args = '') {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  *
  *
  * @uses $wpdb
  *
@@ -783,7 +861,7 @@ function is_term($term, $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) )
                        return $result;
        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) )
                        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", $term, $taxonomy), ARRAY_A);
        }
 
@@ -804,7 +882,7 @@ function is_term($term, $taxonomy = '') {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses sanitize_term_field Used to sanitize all fields in a term
  *
  *
  * @uses sanitize_term_field Used to sanitize all fields in a term
  *
@@ -824,13 +902,23 @@ function sanitize_term($term, $taxonomy, $context = 'display') {
        if ( is_object($term) )
                $do_object = true;
 
        if ( is_object($term) )
                $do_object = true;
 
-       foreach ( $fields as $field ) {
-               if ( $do_object )
-                       $term->$field = sanitize_term_field($field, $term->$field, $term->term_id, $taxonomy, $context);
-               else
-                       $term[$field] = sanitize_term_field($field, $term[$field], $term['term_id'], $taxonomy, $context);
+       $term_id = $do_object ? $term->term_id : (isset($term['term_id']) ? $term['term_id'] : 0);
+
+       foreach ( (array) $fields as $field ) {
+               if ( $do_object ) {
+                       if ( isset($term->$field) )
+                               $term->$field = sanitize_term_field($field, $term->$field, $term_id, $taxonomy, $context);
+               } else {
+                       if ( isset($term[$field]) )
+                               $term[$field] = sanitize_term_field($field, $term[$field], $term_id, $taxonomy, $context);
+               }
        }
 
        }
 
+       if ( $do_object )
+               $term->filter = $context;
+       else
+               $term['filter'] = $context;
+
        return $term;
 }
 
        return $term;
 }
 
@@ -849,7 +937,7 @@ function sanitize_term($term, $taxonomy, $context = 'display') {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  *
  *
  * @uses $wpdb
  *
@@ -909,7 +997,7 @@ function sanitize_term_field($field, $value, $term_id, $taxonomy, $context) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses wp_parse_args() Turns strings into arrays and merges defaults into an array.
  *
  * @uses $wpdb
  * @uses wp_parse_args() Turns strings into arrays and merges defaults into an array.
@@ -941,7 +1029,7 @@ function wp_count_terms( $taxonomy, $args = array() ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @param int $object_id The term Object Id that refers to the term
  * @uses $wpdb
  *
  * @param int $object_id The term Object Id that refers to the term
@@ -955,11 +1043,11 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
        if ( !is_array($taxonomies) )
                $taxonomies = array($taxonomies);
 
        if ( !is_array($taxonomies) )
                $taxonomies = array($taxonomies);
 
-       foreach ( $taxonomies as $taxonomy ) {
-               $terms = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
-               $in_terms = "'" . implode("', '", $terms) . "'";
-               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_terms)", $object_id) );
-               wp_update_term_count($terms, $taxonomy);
+       foreach ( (array) $taxonomies as $taxonomy ) {
+               $tt_ids = wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
+               $in_tt_ids = "'" . implode("', '", $tt_ids) . "'";
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_tt_ids)", $object_id) );
+               wp_update_term_count($tt_ids, $taxonomy);
        }
 }
 
        }
 }
 
@@ -974,7 +1062,7 @@ function wp_delete_object_term_relationships( $object_id, $taxonomies ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action
  *
  * @uses $wpdb
  * @uses do_action() Calls both 'delete_term' and 'delete_$taxonomy' action
@@ -1068,7 +1156,7 @@ function wp_delete_term( $term, $taxonomy, $args = array() ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @param int|array $object_id The id of the object(s) to retrieve.
  * @uses $wpdb
  *
  * @param int|array $object_id The id of the object(s) to retrieve.
@@ -1082,7 +1170,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
        if ( !is_array($taxonomies) )
                $taxonomies = array($taxonomies);
 
        if ( !is_array($taxonomies) )
                $taxonomies = array($taxonomies);
 
-       foreach ( $taxonomies as $taxonomy ) {
+       foreach ( (array) $taxonomies as $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'));
        }
@@ -1192,7 +1280,7 @@ function wp_get_object_terms($object_ids, $taxonomies, $args = array()) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @uses do_action() Calls 'create_term' hook with the term id and taxonomy id as parameters.
  * @uses $wpdb
  *
  * @uses do_action() Calls 'create_term' hook with the term id and taxonomy id as parameters.
@@ -1297,7 +1385,7 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @param int $object_id The object to relate to.
  * @uses $wpdb
  *
  * @param int $object_id The object to relate to.
@@ -1318,32 +1406,32 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
                $terms = array($terms);
 
        if ( ! $append )
                $terms = array($terms);
 
        if ( ! $append )
-               $old_terms =  wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
+               $old_tt_ids =  wp_get_object_terms($object_id, $taxonomy, 'fields=tt_ids');
 
        $tt_ids = array();
        $term_ids = array();
 
 
        $tt_ids = array();
        $term_ids = array();
 
-       foreach ($terms as $term) {
+       foreach ( (array) $terms as $term) {
                if ( !strlen(trim($term)) )
                        continue;
 
                if ( !strlen(trim($term)) )
                        continue;
 
-               if ( !$id = is_term($term, $taxonomy) )
-                       $id = wp_insert_term($term, $taxonomy);
-               if ( is_wp_error($id) )
-                       return $id;
-               $term_ids[] = $id['term_id'];
-               $id = $id['term_taxonomy_id'];
-               $tt_ids[] = $id;
+               if ( !$term_info = is_term($term, $taxonomy) )
+                       $term_info = wp_insert_term($term, $taxonomy);
+               if ( is_wp_error($term_info) )
+                       return $term_info;
+               $term_ids[] = $term_info['term_id'];
+               $tt_id = $term_info['term_taxonomy_id'];
+               $tt_ids[] = $tt_id;
 
 
-               if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $id ) ) )
+               if ( $wpdb->get_var( $wpdb->prepare( "SELECT term_taxonomy_id FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id = %d", $object_id, $tt_id ) ) )
                        continue;
                        continue;
-               $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $id ) );
+               $wpdb->insert( $wpdb->term_relationships, array( 'object_id' => $object_id, 'term_taxonomy_id' => $tt_id ) );
        }
 
        wp_update_term_count($tt_ids, $taxonomy);
 
        if ( ! $append ) {
        }
 
        wp_update_term_count($tt_ids, $taxonomy);
 
        if ( ! $append ) {
-               $delete_terms = array_diff($old_terms, $tt_ids);
+               $delete_terms = array_diff($old_tt_ids, $tt_ids);
                if ( $delete_terms ) {
                        $in_delete_terms = "'" . implode("', '", $delete_terms) . "'";
                        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_delete_terms)", $object_id) );
                if ( $delete_terms ) {
                        $in_delete_terms = "'" . implode("', '", $delete_terms) . "'";
                        $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->term_relationships WHERE object_id = %d AND term_taxonomy_id IN ($in_delete_terms)", $object_id) );
@@ -1383,7 +1471,7 @@ function wp_set_object_terms($object_id, $terms, $taxonomy, $append = false) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @param string $slug The string that will be tried for a unique slug
  * @uses $wpdb
  *
  * @param string $slug The string that will be tried for a unique slug
@@ -1450,7 +1538,7 @@ function wp_unique_term_slug($slug, $term) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses $wpdb
  * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice.
  *
  * @uses $wpdb
  * @uses do_action() Will call both 'edit_term' and 'edit_$taxonomy' twice.
@@ -1547,19 +1635,19 @@ function wp_update_term( $term, $taxonomy, $args = array() ) {
 /**
  * Enable or disable term counting.
  *
 /**
  * Enable or disable term counting.
  *
- * @since 2.6
+ * @since 2.5.0
  *
  *
- * @param bool $defer Optional.
- * @return bool
+ * @param bool $defer Optional. Enable if true, disable if false.
+ * @return bool Whether term counting is enabled or disabled.
  */
  */
-function wp_defer_term_counting($defer=NULL) {
+function wp_defer_term_counting($defer=null) {
        static $_defer = false;
 
        if ( is_bool($defer) ) {
                $_defer = $defer;
                // flush any deferred counts
                if ( !$defer )
        static $_defer = false;
 
        if ( is_bool($defer) ) {
                $_defer = $defer;
                // flush any deferred counts
                if ( !$defer )
-                       wp_update_term_count( NULL, NULL, true );
+                       wp_update_term_count( null, null, true );
        }
 
        return $_defer;
        }
 
        return $_defer;
@@ -1576,10 +1664,10 @@ function wp_defer_term_counting($defer=NULL) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param int|array $terms The ID of the terms
+ * @param int|array $terms The term_taxonomy_id of the terms
  * @param string $taxonomy The context of the term.
  * @return bool If no terms will return false, and if successful will return true.
  */
  * @param string $taxonomy The context of the term.
  * @return bool If no terms will return false, and if successful will return true.
  */
@@ -1587,7 +1675,7 @@ function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
        static $_deferred = array();
 
        if ( $do_deferred ) {
        static $_deferred = array();
 
        if ( $do_deferred ) {
-               foreach ( array_keys($_deferred) as $tax ) {
+               foreach ( (array) array_keys($_deferred) as $tax ) {
                        wp_update_term_count_now( $_deferred[$tax], $tax );
                        unset( $_deferred[$tax] );
                }
                        wp_update_term_count_now( $_deferred[$tax], $tax );
                        unset( $_deferred[$tax] );
                }
@@ -1612,9 +1700,9 @@ function wp_update_term_count( $terms, $taxonomy, $do_deferred=false ) {
 /**
  * Perform term count update immediately.
  *
 /**
  * Perform term count update immediately.
  *
- * @since 2.6
+ * @since 2.5.0
  *
  *
- * @param array $terms IDs of Terms to update.
+ * @param array $terms The term_taxonomy_id of terms to update.
  * @param string $taxonomy The context of the term.
  * @return bool Always true when complete.
  */
  * @param string $taxonomy The context of the term.
  * @return bool Always true when complete.
  */
@@ -1628,7 +1716,7 @@ function wp_update_term_count_now( $terms, $taxonomy ) {
                call_user_func($taxonomy->update_count_callback, $terms);
        } else {
                // Default count updater
                call_user_func($taxonomy->update_count_callback, $terms);
        } else {
                // Default count updater
-               foreach ($terms as $term) {
+               foreach ( (array) $terms as $term) {
                        $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) );
                        $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
                }
                        $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term) );
                        $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
                }
@@ -1654,7 +1742,7 @@ function wp_update_term_count_now( $terms, $taxonomy ) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @see get_object_taxonomies() for more on $object_type
  * @uses do_action() Will call action hook named, 'clean_object_term_cache' after completion.
  *
  * @see get_object_taxonomies() for more on $object_type
  * @uses do_action() Will call action hook named, 'clean_object_term_cache' after completion.
@@ -1680,7 +1768,7 @@ function clean_object_term_cache($object_ids, $object_type) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @param int|array $ids Single or list of Term IDs
  * @uses $wpdb
  *
  * @param int|array $ids Single or list of Term IDs
@@ -1688,6 +1776,7 @@ function clean_object_term_cache($object_ids, $object_type) {
  */
 function clean_term_cache($ids, $taxonomy = '') {
        global $wpdb;
  */
 function clean_term_cache($ids, $taxonomy = '') {
        global $wpdb;
+       static $cleaned = array();
 
        if ( !is_array($ids) )
                $ids = array($ids);
 
        if ( !is_array($ids) )
                $ids = array($ids);
@@ -1710,12 +1799,15 @@ function clean_term_cache($ids, $taxonomy = '') {
        }
 
        foreach ( $taxonomies as $taxonomy ) {
        }
 
        foreach ( $taxonomies as $taxonomy ) {
+               if ( isset($cleaned[$taxonomy]) )
+                       continue;
+               $cleaned[$taxonomy] = true;
                wp_cache_delete('all_ids', $taxonomy);
                wp_cache_delete('get', $taxonomy);
                delete_option("{$taxonomy}_children");
        }
 
                wp_cache_delete('all_ids', $taxonomy);
                wp_cache_delete('get', $taxonomy);
                delete_option("{$taxonomy}_children");
        }
 
-       wp_cache_delete('get_terms', 'terms');
+       wp_cache_set('last_changed', time(), 'terms');
 
        do_action('clean_term_cache', $ids, $taxonomy);
 }
 
        do_action('clean_term_cache', $ids, $taxonomy);
 }
@@ -1726,7 +1818,7 @@ function clean_term_cache($ids, $taxonomy = '') {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses wp_cache_get() Retrieves taxonomy relationship from cache
  *
  *
  * @uses wp_cache_get() Retrieves taxonomy relationship from cache
  *
@@ -1755,7 +1847,7 @@ function &get_object_term_cache($id, $taxonomy) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  * @uses wp_get_object_terms() Used to get terms from the database to update
  *
  * @param string|array $object_ids Single or list of term object ID(s)
  * @uses wp_get_object_terms() Used to get terms from the database to update
  *
  * @param string|array $object_ids Single or list of term object ID(s)
@@ -1815,13 +1907,13 @@ function update_object_term_cache($object_ids, $object_type) {
  *
  * @package WordPress
  * @subpackage Taxonomy
  *
  * @package WordPress
  * @subpackage Taxonomy
- * @since 2.3
+ * @since 2.3.0
  *
  * @param array $terms List of Term objects to change
  * @param string $taxonomy Optional. Update Term to this taxonomy in cache
  */
 function update_term_cache($terms, $taxonomy = '') {
  *
  * @param array $terms List of Term objects to change
  * @param string $taxonomy Optional. Update Term to this taxonomy in cache
  */
 function update_term_cache($terms, $taxonomy = '') {
-       foreach ( $terms as $term ) {
+       foreach ( (array) $terms as $term ) {
                $term_taxonomy = $taxonomy;
                if ( empty($term_taxonomy) )
                        $term_taxonomy = $term->taxonomy;
                $term_taxonomy = $taxonomy;
                if ( empty($term_taxonomy) )
                        $term_taxonomy = $term->taxonomy;
@@ -1841,7 +1933,7 @@ function update_term_cache($terms, $taxonomy = '') {
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
- * @since 2.3
+ * @since 2.3.0
  *
  * @uses update_option() Stores all of the children in "$taxonomy_children"
  *      option. That is the name of the taxonomy, immediately followed by '_children'.
  *
  * @uses update_option() Stores all of the children in "$taxonomy_children"
  *      option. That is the name of the taxonomy, immediately followed by '_children'.
@@ -1869,21 +1961,20 @@ function _get_term_hierarchy($taxonomy) {
 
 
 /**
 
 
 /**
- * Get array of child terms.
+ * Get the subset of $terms that are descendants of $term_id.
  *
  *
- * If $terms is an array of objects, then objects will returned from the
- * function. If $terms is an array of IDs, then an array of ids of children will
- * be returned.
+ * If $terms is an array of objects, then _get_term_children returns an array of objects.
+ * If $terms is an array of IDs, then _get_term_children returns an array of IDs.
  *
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
  *
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
- * @since 2.3
+ * @since 2.3.0
  *
  *
- * @param int $term_id Look for this Term ID in $terms
- * @param array $terms List of Term IDs
- * @param string $taxonomy Term Context
- * @return array Empty if $terms is empty else returns full list of child terms.
+ * @param int $term_id The ancestor term: all returned terms should be descendants of $term_id.
+ * @param array $terms The set of terms---either an array of term objects or term IDs---from which those that are descendants of $term_id will be chosen.
+ * @param string $taxonomy The taxonomy which determines the hierarchy of the terms.
+ * @return array The subset of $terms that are descendants of $term_id.
  */
 function &_get_term_children($term_id, $terms, $taxonomy) {
        $empty_array = array();
  */
 function &_get_term_children($term_id, $terms, $taxonomy) {
        $empty_array = array();
@@ -1896,7 +1987,7 @@ function &_get_term_children($term_id, $terms, $taxonomy) {
        if  ( ( 0 != $term_id ) && ! isset($has_children[$term_id]) )
                return $empty_array;
 
        if  ( ( 0 != $term_id ) && ! isset($has_children[$term_id]) )
                return $empty_array;
 
-       foreach ( $terms as $term ) {
+       foreach ( (array) $terms as $term ) {
                $use_id = false;
                if ( !is_object($term) ) {
                        $term = get_term($term, $taxonomy);
                $use_id = false;
                if ( !is_object($term) ) {
                        $term = get_term($term, $taxonomy);
@@ -1935,7 +2026,7 @@ function &_get_term_children($term_id, $terms, $taxonomy) {
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @param array $terms List of Term IDs
  * @uses $wpdb
  *
  * @param array $terms List of Term IDs
@@ -1956,7 +2047,7 @@ function _pad_term_counts(&$terms, $taxonomy) {
 
        $term_items = array();
 
 
        $term_items = array();
 
-       foreach ( $terms as $key => $term ) {
+       foreach ( (array) $terms as $key => $term ) {
                $terms_by_id[$term->term_id] = & $terms[$key];
                $term_ids[$term->term_taxonomy_id] = $term->term_id;
        }
                $terms_by_id[$term->term_id] = & $terms[$key];
                $term_ids[$term->term_taxonomy_id] = $term->term_id;
        }
@@ -1965,7 +2056,7 @@ function _pad_term_counts(&$terms, $taxonomy) {
        $results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (".join(',', array_keys($term_ids)).") AND post_type = 'post' AND post_status = 'publish'");
        foreach ( $results as $row ) {
                $id = $term_ids[$row->term_taxonomy_id];
        $results = $wpdb->get_results("SELECT object_id, term_taxonomy_id FROM $wpdb->term_relationships INNER JOIN $wpdb->posts ON object_id = ID WHERE term_taxonomy_id IN (".join(',', array_keys($term_ids)).") AND post_type = 'post' AND post_status = 'publish'");
        foreach ( $results as $row ) {
                $id = $term_ids[$row->term_taxonomy_id];
-               ++$term_items[$id][$row->object_id];
+               $term_items[$id][$row->object_id] = isset($term_items[$id][$row->object_id]) ? ++$term_items[$id][$row->object_id] : 1;
        }
 
        // Touch every ancestor's lookup row for each post in each term
        }
 
        // Touch every ancestor's lookup row for each post in each term
@@ -1973,8 +2064,9 @@ function _pad_term_counts(&$terms, $taxonomy) {
                $child = $term_id;
                while ( $parent = $terms_by_id[$child]->parent ) {
                        if ( !empty($term_items[$term_id]) )
                $child = $term_id;
                while ( $parent = $terms_by_id[$child]->parent ) {
                        if ( !empty($term_items[$term_id]) )
-                               foreach ( $term_items[$term_id] as $item_id => $touches )
-                                       ++$term_items[$parent][$item_id];
+                               foreach ( $term_items[$term_id] as $item_id => $touches ) {
+                                       $term_items[$parent][$item_id] = isset($term_items[$parent][$item_id]) ? ++$term_items[$parent][$item_id]: 1;
+                               }
                        $child = $parent;
                }
        }
                        $child = $parent;
                }
        }
@@ -1998,15 +2090,15 @@ function _pad_term_counts(&$terms, $taxonomy) {
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
  * @package WordPress
  * @subpackage Taxonomy
  * @access private
- * @since 2.3
+ * @since 2.3.0
  * @uses $wpdb
  *
  * @uses $wpdb
  *
- * @param array $terms List of Term IDs
+ * @param array $terms List of Term taxonomy IDs
  */
 function _update_post_term_count( $terms ) {
        global $wpdb;
 
  */
 function _update_post_term_count( $terms ) {
        global $wpdb;
 
-       foreach ( $terms as $term ) {
+       foreach ( (array) $terms as $term ) {
                $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 ) );
                $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
        }
                $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 ) );
                $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
        }
@@ -2016,7 +2108,7 @@ function _update_post_term_count( $terms ) {
 /**
  * Generates a permalink for a taxonomy term archive.
  *
 /**
  * Generates a permalink for a taxonomy term archive.
  *
- * @since 2.6
+ * @since 2.5.0
  *
  * @param object|int|string $term
  * @param string $taxonomy
  *
  * @param object|int|string $term
  * @param string $taxonomy
@@ -2072,7 +2164,7 @@ function get_term_link( $term, $taxonomy ) {
  * 'sep' : default is empty string. Separate every taxonomy with value in this.
  * 'after' : default is empty string. Display this after the taxonomies list.
  *
  * 'sep' : default is empty string. Separate every taxonomy with value in this.
  * 'after' : default is empty string. Display this after the taxonomies list.
  *
- * @since 2.6
+ * @since 2.5.0
  * @uses get_the_taxonomies()
  *
  * @param array $args Override the defaults.
  * @uses get_the_taxonomies()
  *
  * @param array $args Override the defaults.
@@ -2097,7 +2189,7 @@ function the_taxonomies($args = array()) {
  * This function can be used within the loop. It will also return an array of
  * the taxonomies with links to the taxonomy and name.
  *
  * This function can be used within the loop. It will also return an array of
  * the taxonomies with links to the taxonomy and name.
  *
- * @since 2.6
+ * @since 2.5.0
  *
  * @param int $post Optional. Post ID or will use Global Post ID (in loop).
  * @return array
  *
  * @param int $post Optional. Post ID or will use Global Post ID (in loop).
  * @return array
@@ -2142,7 +2234,7 @@ function get_the_taxonomies($post = 0) {
 /**
  * Retrieve all taxonomies of a post with just the names.
  *
 /**
  * Retrieve all taxonomies of a post with just the names.
  *
- * @since 2.6
+ * @since 2.5.0
  * @uses get_object_taxonomies()
  *
  * @param int $post Optional. Post ID
  * @uses get_object_taxonomies()
  *
  * @param int $post Optional. Post ID
@@ -2154,4 +2246,54 @@ function get_post_taxonomies($post = 0) {
        return get_object_taxonomies($post);
 }
 
        return get_object_taxonomies($post);
 }
 
-?>
\ No newline at end of file
+/**
+ * Determine if the given object is associated with any of the given terms.
+ *
+ * The given terms are checked against the object's terms' term_ids, names and slugs.
+ * Terms given as integers will only be checked against the object's terms' term_ids.
+ * If no terms are given, determines if object is associated with any terms in the given taxonomy.
+ *
+ * @since 2.7.0
+ * @uses get_object_term_cache()
+ * @uses wp_get_object_terms()
+ *
+ * @param int $object_id.  ID of the object (post ID, link ID, ...)
+ * @param string $taxonomy.  Single taxonomy name
+ * @param int|string|array $terms Optional.  Term term_id, name, slug or array of said
+ * @return bool|WP_Error. WP_Error on input error.
+ */
+function is_object_in_term( $object_id, $taxonomy, $terms = null ) {
+       if ( !$object_id = (int) $object_id )
+               return new WP_Error( 'invalid_object', __( 'Invalid object ID' ) );
+
+       $object_terms = get_object_term_cache( $object_id, $taxonomy );
+       if ( empty( $object_terms ) )
+                $object_terms = wp_get_object_terms( $object_id, $taxonomy );
+
+       if ( is_wp_error( $object_terms ) )
+               return $object_terms;
+       if ( empty( $object_terms ) )
+               return false;
+       if ( empty( $terms ) )
+               return ( !empty( $object_terms ) );
+
+       $terms = (array) $terms;
+
+       if ( $ints = array_filter( $terms, 'is_int' ) )
+               $strs = array_diff( $terms, $ints );
+       else
+               $strs =& $terms;
+
+       foreach ( $object_terms as $object_term ) {
+               if ( $ints && in_array( $object_term->term_id, $ints ) ) return true; // If int, check against term_id
+               if ( $strs ) {
+                       if ( in_array( $object_term->term_id, $strs ) ) return true;
+                       if ( in_array( $object_term->name, $strs ) )    return true;
+                       if ( in_array( $object_term->slug, $strs ) )    return true;
+               }
+       }
+
+       return false;
+}
+
+?>
index 2ed733582d424db9d57ef85a3bb2854a70cdf8b8..4634075a83d49ee0afe4e479ab0b4fd3d8e29074 100644 (file)
@@ -1,30 +1,92 @@
 <?php
 <?php
-/*
- * Theme/template/stylesheet functions.
+/**
+ * Theme, template, and stylesheet functions.
+ *
+ * @package WordPress
+ * @subpackage Template
  */
 
  */
 
+/**
+ * Retrieve name of the current stylesheet.
+ *
+ * The theme name that the administrator has currently set the front end theme
+ * as.
+ *
+ * For all extensive purposes, the template name and the stylesheet name are
+ * going to be the same for most cases.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'stylesheet' filter on stylesheet name.
+ *
+ * @return string Stylesheet name.
+ */
 function get_stylesheet() {
        return apply_filters('stylesheet', get_option('stylesheet'));
 }
 
 function get_stylesheet() {
        return apply_filters('stylesheet', get_option('stylesheet'));
 }
 
+/**
+ * Retrieve stylesheet directory path for current theme.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'stylesheet_directory' filter on stylesheet directory and theme name.
+ *
+ * @return string Path to current theme directory.
+ */
 function get_stylesheet_directory() {
        $stylesheet = get_stylesheet();
        $stylesheet_dir = get_theme_root() . "/$stylesheet";
        return apply_filters('stylesheet_directory', $stylesheet_dir, $stylesheet);
 }
 
 function get_stylesheet_directory() {
        $stylesheet = get_stylesheet();
        $stylesheet_dir = get_theme_root() . "/$stylesheet";
        return apply_filters('stylesheet_directory', $stylesheet_dir, $stylesheet);
 }
 
+/**
+ * Retrieve stylesheet directory URI.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_stylesheet_directory_uri() {
        $stylesheet = get_stylesheet();
        $stylesheet_dir_uri = get_theme_root_uri() . "/$stylesheet";
        return apply_filters('stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet);
 }
 
 function get_stylesheet_directory_uri() {
        $stylesheet = get_stylesheet();
        $stylesheet_dir_uri = get_theme_root_uri() . "/$stylesheet";
        return apply_filters('stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet);
 }
 
+/**
+ * Retrieve URI of current theme stylesheet.
+ *
+ * The stylesheet file name is 'style.css' which is appended to {@link
+ * get_stylesheet_directory_uri() stylesheet directory URI} path.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
+ *
+ * @return string
+ */
 function get_stylesheet_uri() {
        $stylesheet_dir_uri = get_stylesheet_directory_uri();
        $stylesheet_uri = $stylesheet_dir_uri . "/style.css";
        return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
 }
 
 function get_stylesheet_uri() {
        $stylesheet_dir_uri = get_stylesheet_directory_uri();
        $stylesheet_uri = $stylesheet_dir_uri . "/style.css";
        return apply_filters('stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
 }
 
+/**
+ * Retrieve localized stylesheet URI.
+ *
+ * The stylesheet directory for the localized stylesheet files are located, by
+ * default, in the base theme directory. The name of the locale file will be the
+ * locale followed by '.css'. If that does not exist, then the text direction
+ * stylesheet will be checked for existence, for example 'ltr.css'.
+ *
+ * The theme may change the location of the stylesheet directory by either using
+ * the 'stylesheet_directory_uri' filter or the 'locale_stylesheet_uri' filter.
+ * If you want to change the location of the stylesheet files for the entire
+ * WordPress workflow, then change the former. If you just have the locale in a
+ * separate folder, then change the latter.
+ *
+ * @since 2.1.0
+ * @uses apply_filters() Calls 'locale_stylesheet_uri' filter on stylesheet URI path and stylesheet directory URI.
+ *
+ * @return string
+ */
 function get_locale_stylesheet_uri() {
        global $wp_locale;
        $stylesheet_dir_uri = get_stylesheet_directory_uri();
 function get_locale_stylesheet_uri() {
        global $wp_locale;
        $stylesheet_dir_uri = get_stylesheet_directory_uri();
@@ -39,22 +101,66 @@ function get_locale_stylesheet_uri() {
        return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
 }
 
        return apply_filters('locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri);
 }
 
+/**
+ * Retrieve name of the current theme.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'template' filter on template option.
+ *
+ * @return string Template name.
+ */
 function get_template() {
        return apply_filters('template', get_option('template'));
 }
 
 function get_template() {
        return apply_filters('template', get_option('template'));
 }
 
+/**
+ * Retrieve current theme directory.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'template_directory' filter on template directory path and template name.
+ *
+ * @return string Template directory path.
+ */
 function get_template_directory() {
        $template = get_template();
        $template_dir = get_theme_root() . "/$template";
        return apply_filters('template_directory', $template_dir, $template);
 }
 
 function get_template_directory() {
        $template = get_template();
        $template_dir = get_theme_root() . "/$template";
        return apply_filters('template_directory', $template_dir, $template);
 }
 
+/**
+ * Retrieve theme directory URI.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'template_directory_uri' filter on template directory URI path and template name.
+ *
+ * @return string Template directory URI.
+ */
 function get_template_directory_uri() {
        $template = get_template();
        $template_dir_uri = get_theme_root_uri() . "/$template";
        return apply_filters('template_directory_uri', $template_dir_uri, $template);
 }
 
 function get_template_directory_uri() {
        $template = get_template();
        $template_dir_uri = get_theme_root_uri() . "/$template";
        return apply_filters('template_directory_uri', $template_dir_uri, $template);
 }
 
+/**
+ * Retrieve theme data from parsed theme file.
+ *
+ * The description will have the tags filtered with the following HTML elements
+ * whitelisted. The <b>'a'</b> element with the <em>href</em> and <em>title</em>
+ * attributes. The <b>abbr</b> element with the <em>title</em> attribute. The
+ * <b>acronym<b> element with the <em>title</em> attribute allowed. The
+ * <b>code</b>, <b>em</b>, and <b>strong</b> elements also allowed.
+ *
+ * The style.css file must contain theme name, theme URI, and description. The
+ * data can also contain author URI, author, template (parent template),
+ * version, status, and finally tags. Some of these are not used by WordPress
+ * administration panels, but are used by theme directory web sites which list
+ * the theme.
+ *
+ * @since 1.5.0
+ *
+ * @param string $theme_file Theme file path.
+ * @return array Theme data.
+ */
 function get_theme_data( $theme_file ) {
        $themes_allowed_tags = array(
                'a' => array(
 function get_theme_data( $theme_file ) {
        $themes_allowed_tags = array(
                'a' => array(
@@ -80,7 +186,7 @@ function get_theme_data( $theme_file ) {
        if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
                $author_uri = clean_url( trim( $author_uri[1]) );
        else
        if ( preg_match( '|Author URI:(.*)$|mi', $theme_data, $author_uri ) )
                $author_uri = clean_url( trim( $author_uri[1]) );
        else
-               $author_uti = '';
+               $author_uri = '';
 
        if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
                $template = wp_kses( trim( $template[1] ), $themes_allowed_tags );
 
        if ( preg_match( '|Template:(.*)$|mi', $theme_data, $template ) )
                $template = wp_kses( trim( $template[1] ), $themes_allowed_tags );
@@ -119,6 +225,21 @@ function get_theme_data( $theme_file ) {
        return array( 'Name' => $name, 'Title' => $theme, 'URI' => $theme_uri, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Status' => $status, 'Tags' => $tags );
 }
 
        return array( 'Name' => $name, 'Title' => $theme, 'URI' => $theme_uri, 'Description' => $description, 'Author' => $author, 'Version' => $version, 'Template' => $template, 'Status' => $status, 'Tags' => $tags );
 }
 
+/**
+ * Retrieve list of themes with theme data in theme directory.
+ *
+ * The theme is broken, if it doesn't have a parent theme and is missing either
+ * style.css and, or index.php. If the theme has a parent theme then it is
+ * broken, if it is missing style.css; index.php is optional. The broken theme
+ * list is saved in the {@link $wp_broken_themes} global, which is displayed on
+ * the theme list in the administration panels.
+ *
+ * @since 1.5.0
+ * @global array $wp_broken_themes Stores the broken themes.
+ * @global array $wp_themes Stores the working themes.
+ *
+ * @return array Theme list with theme data.
+ */
 function get_themes() {
        global $wp_themes, $wp_broken_themes;
 
 function get_themes() {
        global $wp_themes, $wp_broken_themes;
 
@@ -232,15 +353,20 @@ function get_themes() {
                }
 
                $stylesheet_files = array();
                }
 
                $stylesheet_files = array();
+               $template_files = array();
+
                $stylesheet_dir = @ dir("$theme_root/$stylesheet");
                if ( $stylesheet_dir ) {
                        while ( ($file = $stylesheet_dir->read()) !== false ) {
                $stylesheet_dir = @ dir("$theme_root/$stylesheet");
                if ( $stylesheet_dir ) {
                        while ( ($file = $stylesheet_dir->read()) !== false ) {
-                               if ( !preg_match('|^\.+$|', $file) && preg_match('|\.css$|', $file) )
-                                       $stylesheet_files[] = "$theme_loc/$stylesheet/$file";
+                               if ( !preg_match('|^\.+$|', $file) ) {
+                                       if ( preg_match('|\.css$|', $file) )
+                                               $stylesheet_files[] = "$theme_loc/$stylesheet/$file";
+                                       elseif ( preg_match('|\.php$|', $file) )
+                                               $template_files[] = "$theme_loc/$stylesheet/$file";
+                               }
                        }
                }
 
                        }
                }
 
-               $template_files = array();
                $template_dir = @ dir("$theme_root/$template");
                if ( $template_dir ) {
                        while(($file = $template_dir->read()) !== false) {
                $template_dir = @ dir("$theme_root/$template");
                if ( $template_dir ) {
                        while(($file = $template_dir->read()) !== false) {
@@ -298,15 +424,34 @@ function get_themes() {
        return $themes;
 }
 
        return $themes;
 }
 
+/**
+ * Retrieve theme data.
+ *
+ * @since 1.5.0
+ *
+ * @param string $theme Theme name.
+ * @return array|null Null, if theme name does not exist. Theme data, if exists.
+ */
 function get_theme($theme) {
        $themes = get_themes();
 
        if ( array_key_exists($theme, $themes) )
                return $themes[$theme];
 
 function get_theme($theme) {
        $themes = get_themes();
 
        if ( array_key_exists($theme, $themes) )
                return $themes[$theme];
 
-       return NULL;
+       return null;
 }
 
 }
 
+/**
+ * Retrieve current theme display name.
+ *
+ * If the 'current_theme' option has already been set, then it will be returned
+ * instead. If it is not set, then each theme will be iterated over until both
+ * the current stylesheet and current template name.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_current_theme() {
        if ( $theme = get_option('current_theme') )
                return $theme;
 function get_current_theme() {
        if ( $theme = get_option('current_theme') )
                return $theme;
@@ -332,84 +477,198 @@ function get_current_theme() {
        return $current_theme;
 }
 
        return $current_theme;
 }
 
+/**
+ * Retrieve path to themes directory.
+ *
+ * Does not have trailing slash.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'theme_root' filter on path.
+ *
+ * @return string Theme path.
+ */
 function get_theme_root() {
        return apply_filters('theme_root', WP_CONTENT_DIR . "/themes");
 }
 
 function get_theme_root() {
        return apply_filters('theme_root', WP_CONTENT_DIR . "/themes");
 }
 
+/**
+ * Retrieve URI for themes directory.
+ *
+ * Does not have trailing slash.
+ *
+ * @since 1.5.0
+ *
+ * @return string Themes URI.
+ */
 function get_theme_root_uri() {
        return apply_filters('theme_root_uri', content_url('themes'), get_option('siteurl'));
 }
 
 function get_theme_root_uri() {
        return apply_filters('theme_root_uri', content_url('themes'), get_option('siteurl'));
 }
 
+/**
+ * Retrieve path to file without the use of extension.
+ *
+ * Used to quickly retrieve the path of file without including the file
+ * extension. It will also check the parent template, if the file exists, with
+ * the use of {@link locate_template()}. Allows for more generic file location
+ * without the use of the other get_*_template() functions.
+ *
+ * Can be used with include() or require() to retrieve path.
+ * <code>
+ * if( '' != get_query_template( '404' ) )
+ *     include( get_query_template( '404' ) );
+ * </code>
+ * or the same can be accomplished with
+ * <code>
+ * if( '' != get_404_template() )
+ *     include( get_404_template() );
+ * </code>
+ *
+ * @since 1.5.0
+ *
+ * @param string $type Filename without extension.
+ * @return string Full path to file.
+ */
 function get_query_template($type) {
 function get_query_template($type) {
-       $template = '';
        $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
        $type = preg_replace( '|[^a-z0-9-]+|', '', $type );
-       if ( file_exists(TEMPLATEPATH . "/{$type}.php") )
-               $template = TEMPLATEPATH . "/{$type}.php";
-
-       return apply_filters("{$type}_template", $template);
+       return apply_filters("{$type}_template", locate_template(array("{$type}.php")));
 }
 
 }
 
+/**
+ * Retrieve path of 404 template in current or parent template.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_404_template() {
        return get_query_template('404');
 }
 
 function get_404_template() {
        return get_query_template('404');
 }
 
+/**
+ * Retrieve path of archive template in current or parent template.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_archive_template() {
        return get_query_template('archive');
 }
 
 function get_archive_template() {
        return get_query_template('archive');
 }
 
+/**
+ * Retrieve path of author template in current or parent template.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_author_template() {
        return get_query_template('author');
 }
 
 function get_author_template() {
        return get_query_template('author');
 }
 
+/**
+ * Retrieve path of category template in current or parent template.
+ *
+ * Works by retrieving the current category ID, for example 'category-1.php' and
+ * will fallback to category.php template, if the ID category file doesn't
+ * exist.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'category_template' on file path of category template.
+ *
+ * @return string
+ */
 function get_category_template() {
 function get_category_template() {
-       $template = '';
-       if ( file_exists(TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php') )
-               $template = TEMPLATEPATH . "/category-" . absint( get_query_var('cat') ) . '.php';
-       elseif ( file_exists(TEMPLATEPATH . "/category.php") )
-               $template = TEMPLATEPATH . "/category.php";
-
+       $template = locate_template(array("category-" . absint( get_query_var('cat') ) . '.php', 'category.php'));
        return apply_filters('category_template', $template);
 }
 
        return apply_filters('category_template', $template);
 }
 
+/**
+ * Retrieve path of tag template in current or parent template.
+ *
+ * Works by retrieving the current tag name, for example 'tag-wordpress.php' and will
+ * fallback to tag.php template, if the name tag file doesn't exist.
+ *
+ * @since 2.3.0
+ * @uses apply_filters() Calls 'tag_template' on file path of tag template.
+ *
+ * @return string
+ */
 function get_tag_template() {
 function get_tag_template() {
-       $template = '';
-       if ( file_exists(TEMPLATEPATH . "/tag-" . get_query_var('tag') . '.php') )
-               $template = TEMPLATEPATH . "/tag-" . get_query_var('tag') . '.php';
-       elseif ( file_exists(TEMPLATEPATH . "/tag.php") )
-               $template = TEMPLATEPATH . "/tag.php";
-
+       $template = locate_template(array("tag-" . get_query_var('tag') . '.php', 'tag.php'));
        return apply_filters('tag_template', $template);
 }
 
        return apply_filters('tag_template', $template);
 }
 
+/**
+ * Retrieve path of taxonomy template in current or parent template.
+ *
+ * Retrieves the taxonomy and term, if term is available. The template is
+ * prepended with 'taxonomy-' and followed by both the taxonomy string and
+ * the taxonomy string followed by a dash and then followed by the term.
+ *
+ * The taxonomy and term template is checked and used first, if it exists.
+ * Second, just the taxonomy template is checked, and then finally, taxonomy.php
+ * template is used. If none of the files exist, then it will fall back on to
+ * index.php.
+ *
+ * @since unknown (2.6.0 most likely)
+ * @uses apply_filters() Calls 'taxonomy_template' filter on found path.
+ *
+ * @return string
+ */
 function get_taxonomy_template() {
 function get_taxonomy_template() {
-       $template = '';
        $taxonomy = get_query_var('taxonomy');
        $term = get_query_var('term');
        $taxonomy = get_query_var('taxonomy');
        $term = get_query_var('term');
-       if ( $taxonomy && $term && file_exists(TEMPLATEPATH . "/taxonomy-$taxonomy-$term.php") )
-               $template = TEMPLATEPATH . "/taxonomy-$taxonomy-$term.php";
-       elseif ( $taxonomy && file_exists(TEMPLATEPATH . "/taxonomy-$taxonomy.php") )
-               $template = TEMPLATEPATH . "/taxonomy-$taxonomy.php";
-       elseif ( file_exists(TEMPLATEPATH . "/taxonomy.php") )
-               $template = TEMPLATEPATH . "/taxonomy.php";
 
 
+       $templates = array();
+       if ( $taxonomy && $term )
+               $templates[] = "taxonomy-$taxonomy-$term.php";
+       if ( $taxonomy )
+               $templates[] = "taxonomy-$taxonomy.php";
+
+       $templates[] = "taxonomy.php";
+
+       $template = locate_template($templates);
        return apply_filters('taxonomy_template', $template);
 }
 
        return apply_filters('taxonomy_template', $template);
 }
 
+/**
+ * Retrieve path of date template in current or parent template.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_date_template() {
        return get_query_template('date');
 }
 
 function get_date_template() {
        return get_query_template('date');
 }
 
+/**
+ * Retrieve path of home template in current or parent template.
+ *
+ * Attempts to locate 'home.php' first before falling back to 'index.php'.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'home_template' on file path of home template.
+ *
+ * @return string
+ */
 function get_home_template() {
 function get_home_template() {
-       $template = '';
-
-       if ( file_exists(TEMPLATEPATH . "/home.php") )
-               $template = TEMPLATEPATH . "/home.php";
-       elseif ( file_exists(TEMPLATEPATH . "/index.php") )
-               $template = TEMPLATEPATH . "/index.php";
-
+       $template = locate_template(array('home.php', 'index.php'));
        return apply_filters('home_template', $template);
 }
 
        return apply_filters('home_template', $template);
 }
 
+/**
+ * Retrieve path of page template in current or parent template.
+ *
+ * First attempt is to look for the file in the '_wp_page_template' page meta
+ * data. The second attempt, if the first has a file and is not empty, is to
+ * look for 'page.php'.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_page_template() {
        global $wp_query;
 
 function get_page_template() {
        global $wp_query;
 
@@ -419,28 +678,63 @@ function get_page_template() {
        if ( 'default' == $template )
                $template = '';
 
        if ( 'default' == $template )
                $template = '';
 
-       if ( !empty($template) && !validate_file($template) && file_exists(TEMPLATEPATH . "/$template") )
-               $template = TEMPLATEPATH . "/$template";
-       elseif ( file_exists(TEMPLATEPATH . "/page.php") )
-               $template = TEMPLATEPATH . "/page.php";
-       else
-               $template = '';
+       $templates = array();
+       if ( !empty($template) && !validate_file($template) )
+               $templates[] = $template;
 
 
-       return apply_filters('page_template', $template);
+       $templates[] = "page.php";
+
+       return apply_filters('page_template', locate_template($templates));
 }
 
 }
 
+/**
+ * Retrieve path of paged template in current or parent template.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_paged_template() {
        return get_query_template('paged');
 }
 
 function get_paged_template() {
        return get_query_template('paged');
 }
 
+/**
+ * Retrieve path of search template in current or parent template.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_search_template() {
        return get_query_template('search');
 }
 
 function get_search_template() {
        return get_query_template('search');
 }
 
+/**
+ * Retrieve path of single template in current or parent template.
+ *
+ * @since 1.5.0
+ *
+ * @return string
+ */
 function get_single_template() {
        return get_query_template('single');
 }
 
 function get_single_template() {
        return get_query_template('single');
 }
 
+/**
+ * Retrieve path of attachment template in current or parent template.
+ *
+ * The attachment path first checks if the first part of the mime type exists.
+ * The second check is for the second part of the mime type. The last check is
+ * for both types separated by an underscore. If neither are found then the file
+ * 'attachment.php' is checked and returned.
+ *
+ * Some examples for the 'text/plain' mime type are 'text.php', 'plain.php', and
+ * finally 'text_plain.php'.
+ *
+ * @since 2.0.0
+ *
+ * @return string
+ */
 function get_attachment_template() {
        global $posts;
        $type = explode('/', $posts[0]->post_mime_type);
 function get_attachment_template() {
        global $posts;
        $type = explode('/', $posts[0]->post_mime_type);
@@ -454,15 +748,71 @@ function get_attachment_template() {
                return get_query_template('attachment');
 }
 
                return get_query_template('attachment');
 }
 
+/**
+ * Retrieve path of comment popup template in current or parent template.
+ *
+ * Checks for comment popup template in current template, if it exists or in the
+ * parent template. If it doesn't exist, then it retrieves the comment-popup.php
+ * file from the default theme. The default theme must then exist for it to
+ * work.
+ *
+ * @since 1.5.0
+ * @uses apply_filters() Calls 'comments_popup_template' filter on path.
+ *
+ * @return string
+ */
 function get_comments_popup_template() {
 function get_comments_popup_template() {
-       if ( file_exists( TEMPLATEPATH . '/comments-popup.php') )
-               $template = TEMPLATEPATH . '/comments-popup.php';
-       else
+       $template = locate_template(array("comments-popup.php"));
+       if ('' == $template)
                $template = get_theme_root() . '/default/comments-popup.php';
 
        return apply_filters('comments_popup_template', $template);
 }
 
                $template = get_theme_root() . '/default/comments-popup.php';
 
        return apply_filters('comments_popup_template', $template);
 }
 
+/**
+ * Retrieve the name of the highest priority template file that exists.
+ *
+ * Searches in the STYLESHEETPATH before TEMPLATEPATH so that themes which
+ * inherit from a parent theme can just overload one file.
+ *
+ * @since 2.7.0
+ *
+ * @param array $template_names Array of template files to search for in priority order.
+ * @param bool $load If true the template file will be loaded if it is found.
+ * @return string The template filename if one is located.
+ */
+function locate_template($template_names, $load = false) {
+       if (!is_array($template_names))
+               return '';
+
+       $located = '';
+       foreach($template_names as $template_name) {
+               if ( file_exists(STYLESHEETPATH . '/' . $template_name)) {
+                       $located = STYLESHEETPATH . '/' . $template_name;
+                       break;
+               } else if ( file_exists(TEMPLATEPATH . '/' . $template_name) ) {
+                       $located = TEMPLATEPATH . '/' . $template_name;
+                       break;
+               }
+       }
+
+       if ($load && '' != $located)
+               load_template($located);
+
+       return $located;
+}
+
+/**
+ * Require once the template file with WordPress environment.
+ *
+ * The globals are set up for the template file to ensure that the WordPress
+ * environment is available from within the function. The query variables are
+ * also available.
+ *
+ * @since 1.5.0
+ *
+ * @param string $_template_file Path to template file.
+ */
 function load_template($_template_file) {
        global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
 
 function load_template($_template_file) {
        global $posts, $post, $wp_did_header, $wp_did_template_redirect, $wp_query, $wp_rewrite, $wpdb, $wp_version, $wp, $id, $comment, $user_ID;
 
@@ -472,6 +822,11 @@ function load_template($_template_file) {
        require_once($_template_file);
 }
 
        require_once($_template_file);
 }
 
+/**
+ * Display localized stylesheet link element.
+ *
+ * @since 2.1.0
+ */
 function locale_stylesheet() {
        $stylesheet = get_locale_stylesheet_uri();
        if ( empty($stylesheet) )
 function locale_stylesheet() {
        $stylesheet = get_locale_stylesheet_uri();
        if ( empty($stylesheet) )
@@ -479,6 +834,14 @@ function locale_stylesheet() {
        echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
 }
 
        echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
 }
 
+/**
+ * Start preview theme output buffer.
+ *
+ * Will only preform task if the user has permissions and template and preview
+ * query variables exist.
+ *
+ * @since 2.5.0
+ */
 function preview_theme() {
        if ( ! (isset($_GET['template']) && isset($_GET['preview'])) )
                return;
 function preview_theme() {
        if ( ! (isset($_GET['template']) && isset($_GET['preview'])) )
                return;
@@ -486,29 +849,51 @@ 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]) )
+       if ( validate_file($_GET['template']) )
                return;
 
                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]);
-               if ( validate_file($_GET[stylesheet]) )
+               $_GET['stylesheet'] = preg_replace('|[^a-z0-9_.-/]|i', '', $_GET['stylesheet']);
+               if ( validate_file($_GET['stylesheet']) )
                        return;
                        return;
-               add_filter('stylesheet', create_function('', "return '$_GET[stylesheet]';") );
+               add_filter('stylesheet', create_function('', "return '{$_GET['stylesheet']}';") );
        }
 
        ob_start( 'preview_theme_ob_filter' );
 }
 add_action('setup_theme', 'preview_theme');
 
        }
 
        ob_start( 'preview_theme_ob_filter' );
 }
 add_action('setup_theme', 'preview_theme');
 
+/**
+ * Callback function for ob_start() to capture all links in the theme.
+ *
+ * @since unknown
+ * @access private
+ *
+ * @param string $content
+ * @return string
+ */
 function preview_theme_ob_filter( $content ) {
        return preg_replace_callback( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", 'preview_theme_ob_filter_callback', $content );
 }
 
 function preview_theme_ob_filter( $content ) {
        return preg_replace_callback( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", 'preview_theme_ob_filter_callback', $content );
 }
 
+/**
+ * Manipulates preview theme links in order to control and maintain location.
+ *
+ * Callback function for preg_replace_callback() to accept and filter matches.
+ *
+ * @since unknown
+ * @access private
+ *
+ * @param array $matches
+ * @return string
+ */
 function preview_theme_ob_filter_callback( $matches ) {
 function preview_theme_ob_filter_callback( $matches ) {
+       if ( strpos($matches[4], 'onclick') !== false )
+               $matches[4] = preg_replace('#onclick=([\'"]).*?(?<!\\\)\\1#i', '', $matches[4]); //Strip out any onclicks from rest of <a>. (?<!\\\) means to ignore the '" if its escaped by \  to prevent breaking mid-attribute.
        if (
                ( false !== strpos($matches[3], '/wp-admin/') )
        ||
        if (
                ( false !== strpos($matches[3], '/wp-admin/') )
        ||
@@ -526,6 +911,15 @@ function preview_theme_ob_filter_callback( $matches ) {
        return $matches[1] . attribute_escape( $link ) . $matches[4];
 }
 
        return $matches[1] . attribute_escape( $link ) . $matches[4];
 }
 
+/**
+ * Switches current theme to new template and stylesheet names.
+ *
+ * @since unknown
+ * @uses do_action() Calls 'switch_theme' action on updated theme display name.
+ *
+ * @param string $template Template name
+ * @param string $stylesheet Stylesheet name.
+ */
 function switch_theme($template, $stylesheet) {
        update_option('template', $template);
        update_option('stylesheet', $stylesheet);
 function switch_theme($template, $stylesheet) {
        update_option('template', $template);
        update_option('stylesheet', $stylesheet);
@@ -534,9 +928,22 @@ function switch_theme($template, $stylesheet) {
        do_action('switch_theme', $theme);
 }
 
        do_action('switch_theme', $theme);
 }
 
+/**
+ * Checks that current theme files 'index.php' and 'style.css' exists.
+ *
+ * Does not check the 'default' theme. The 'default' theme should always exist
+ * or should have another theme renamed to that template name and directory
+ * path. Will switch theme to default if current theme does not validate.
+ * You can use the 'validate_current_theme' filter to return FALSE to
+ * disable this functionality.
+ *
+ * @since 1.5.0
+ *
+ * @return bool
+ */
 function validate_current_theme() {
        // Don't validate during an install/upgrade.
 function validate_current_theme() {
        // Don't validate during an install/upgrade.
-       if ( defined('WP_INSTALLING') )
+       if ( defined('WP_INSTALLING') || !apply_filters( 'validate_current_theme', true ) )
                return true;
 
        if ( get_template() != 'default' && !file_exists(get_template_directory() . '/index.php') ) {
                return true;
 
        if ( get_template() != 'default' && !file_exists(get_template_directory() . '/index.php') ) {
@@ -552,6 +959,21 @@ function validate_current_theme() {
        return true;
 }
 
        return true;
 }
 
+/**
+ * Retrieve theme modification value for the current theme.
+ *
+ * If the modification name does not exist, then the $default will be passed
+ * through {@link http://php.net/sprintf sprintf()} PHP function with the first
+ * string the template directory URI and the second string the stylesheet
+ * directory URI.
+ *
+ * @since 2.1.0
+ * @uses apply_filters() Calls 'theme_mod_$name' filter on the value.
+ *
+ * @param string $name Theme modification name.
+ * @param bool|string $default
+ * @return string
+ */
 function get_theme_mod($name, $default = false) {
        $theme = get_current_theme();
 
 function get_theme_mod($name, $default = false) {
        $theme = get_current_theme();
 
@@ -563,6 +985,14 @@ function get_theme_mod($name, $default = false) {
        return apply_filters( "theme_mod_$name", sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri()) );
 }
 
        return apply_filters( "theme_mod_$name", sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri()) );
 }
 
+/**
+ * Update theme modification value for the current theme.
+ *
+ * @since 2.1.0
+ *
+ * @param string $name Theme modification name.
+ * @param string $value theme modification value.
+ */
 function set_theme_mod($name, $value) {
        $theme = get_current_theme();
 
 function set_theme_mod($name, $value) {
        $theme = get_current_theme();
 
@@ -574,6 +1004,17 @@ function set_theme_mod($name, $value) {
        wp_cache_delete("mods_$theme", 'options');
 }
 
        wp_cache_delete("mods_$theme", 'options');
 }
 
+/**
+ * Remove theme modification name from current theme list.
+ *
+ * If removing the name also removes all elements, then the entire option will
+ * be removed.
+ *
+ * @since 2.1.0
+ *
+ * @param string $name Theme modification name.
+ * @return null
+ */
 function remove_theme_mod( $name ) {
        $theme = get_current_theme();
 
 function remove_theme_mod( $name ) {
        $theme = get_current_theme();
 
@@ -591,28 +1032,73 @@ function remove_theme_mod( $name ) {
        wp_cache_delete("mods_$theme", 'options');
 }
 
        wp_cache_delete("mods_$theme", 'options');
 }
 
+/**
+ * Remove theme modifications option for current theme.
+ *
+ * @since 2.1.0
+ */
 function remove_theme_mods() {
        $theme = get_current_theme();
 
        delete_option("mods_$theme");
 }
 
 function remove_theme_mods() {
        $theme = get_current_theme();
 
        delete_option("mods_$theme");
 }
 
+/**
+ * Retrieve text color for custom header.
+ *
+ * @since 2.1.0
+ * @uses HEADER_TEXTCOLOR
+ *
+ * @return string
+ */
 function get_header_textcolor() {
        return get_theme_mod('header_textcolor', HEADER_TEXTCOLOR);
 }
 
 function get_header_textcolor() {
        return get_theme_mod('header_textcolor', HEADER_TEXTCOLOR);
 }
 
+/**
+ * Display text color for custom header.
+ *
+ * @since 2.1.0
+ */
 function header_textcolor() {
        echo get_header_textcolor();
 }
 
 function header_textcolor() {
        echo get_header_textcolor();
 }
 
+/**
+ * Retrieve header image for custom header.
+ *
+ * @since 2.1.0
+ * @uses HEADER_IMAGE
+ *
+ * @return string
+ */
 function get_header_image() {
        return get_theme_mod('header_image', HEADER_IMAGE);
 }
 
 function get_header_image() {
        return get_theme_mod('header_image', HEADER_IMAGE);
 }
 
+/**
+ * Display header image path.
+ *
+ * @since 2.1.0
+ */
 function header_image() {
        echo get_header_image();
 }
 
 function header_image() {
        echo get_header_image();
 }
 
+/**
+ * Add callbacks for image header display.
+ *
+ * The parameter $header_callback callback will be required to display the
+ * content for the 'wp_head' action. The parameter $admin_header_callback
+ * callback will be added to Custom_Image_Header class and that will be added
+ * to the 'admin_menu' action.
+ *
+ * @since 2.1.0
+ * @uses Custom_Image_Header Sets up for $admin_header_callback for administration panel display.
+ *
+ * @param callback $header_callback Call on 'wp_head' action.
+ * @param callback $admin_header_callback Call on administration panels.
+ */
 function add_custom_image_header($header_callback, $admin_header_callback) {
        if ( ! empty($header_callback) )
                add_action('wp_head', $header_callback);
 function add_custom_image_header($header_callback, $admin_header_callback) {
        if ( ! empty($header_callback) )
                add_action('wp_head', $header_callback);
index beeee9fcfe2913700b0e5f807a893ddf9307fd67..483b1229188ce42676daf2f5fadffb687d3018d0 100644 (file)
@@ -1,33 +1,36 @@
 <?php
 /**
 <?php
 /**
- * A simple set of functions to check our version 1.0 update service
+ * A simple set of functions to check our version 1.0 update service.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.3
+ * @since 2.3.0
  */
 
 /**
  */
 
 /**
- * wp_version_check() - Check WordPress version against the newest version.
+ * Check WordPress version against the newest version.
  *
  *
- * The WordPress version, PHP version, and Locale is sent. Checks against the WordPress server at
- * api.wordpress.org. Will only check if PHP has fsockopen enabled and WordPress isn't installing.
+ * The WordPress version, PHP version, and Locale is sent. Checks against the
+ * WordPress server at api.wordpress.org server. Will only check if WordPress
+ * isn't installing.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.3
+ * @since 2.3.0
  * @uses $wp_version Used to check against the newest WordPress version.
  *
  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
  */
 function wp_version_check() {
  * @uses $wp_version Used to check against the newest WordPress version.
  *
  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
  */
 function wp_version_check() {
-       if ( !function_exists('fsockopen') || defined('WP_INSTALLING') )
+       if ( defined('WP_INSTALLING') )
                return;
 
                return;
 
-       global $wp_version;
+       global $wp_version, $wpdb, $wp_local_package;
        $php_version = phpversion();
 
        $current = get_option( 'update_core' );
        $php_version = phpversion();
 
        $current = get_option( 'update_core' );
-       $locale = get_locale();
+       if ( ! is_object($current) )
+               $current = new stdClass;
 
 
+       $locale = get_locale();
        if (
                isset( $current->last_checked ) &&
                43200 > ( time() - $current->last_checked ) &&
        if (
                isset( $current->last_checked ) &&
                43200 > ( time() - $current->last_checked ) &&
@@ -35,51 +38,66 @@ function wp_version_check() {
        )
                return false;
 
        )
                return false;
 
-       $new_option = '';
-       $new_option->last_checked = time(); // this gets set whether we get a response or not, so if something is down or misconfigured it won't delay the page load for more than 3 seconds, twice a day
-       $new_option->version_checked = $wp_version;
+       // Update last_checked for current to prevent multiple blocking requests if request hangs
+       $current->last_checked = time();
+       update_option( 'update_core', $current );
 
 
-       $http_request  = "GET /core/version-check/1.1/?version=$wp_version&php=$php_version&locale=$locale HTTP/1.0\r\n";
-       $http_request .= "Host: api.wordpress.org\r\n";
-       $http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
-       $http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
-       $http_request .= "\r\n";
+       if ( method_exists( $wpdb, 'db_version' ) )
+               $mysql_version = preg_replace('/[^0-9.].*/', '', $wpdb->db_version($wpdb->users));
+       else
+               $mysql_version = 'N/A';
+       $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";
 
 
-       $response = '';
-       if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) && is_resource($fs) ) {
-               fwrite( $fs, $http_request );
-               while ( !feof( $fs ) )
-                       $response .= fgets( $fs, 1160 ); // One TCP-IP packet
-               fclose( $fs );
+       $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')
+       );
 
 
-               $response = explode("\r\n\r\n", $response, 2);
-               if ( !preg_match( '|HTTP/.*? 200|', $response[0] ) )
-                       return false;
+       $response = wp_remote_request($url, $options);
 
 
-               $body = trim( $response[1] );
-               $body = str_replace(array("\r\n", "\r"), "\n", $body);
+       if ( is_wp_error( $response ) )
+               return false;
 
 
-               $returns = explode("\n", $body);
+       if ( 200 != $response['response']['code'] )
+               return false;
 
 
+       $body = trim( $response['body'] );
+       $body = str_replace(array("\r\n", "\r"), "\n", $body);
+       $new_options = array();
+       foreach( explode( "\n\n", $body ) as $entry) {
+               $returns = explode("\n", $entry);
+               $new_option = new stdClass();
                $new_option->response = attribute_escape( $returns[0] );
                if ( isset( $returns[1] ) )
                        $new_option->url = clean_url( $returns[1] );
                if ( isset( $returns[2] ) )
                $new_option->response = attribute_escape( $returns[0] );
                if ( isset( $returns[1] ) )
                        $new_option->url = clean_url( $returns[1] );
                if ( isset( $returns[2] ) )
-                       $new_option->current = attribute_escape( $returns[2] );
+                       $new_option->package = clean_url( $returns[2] );
+               if ( isset( $returns[3] ) )
+                       $new_option->current = attribute_escape( $returns[3] );
+               if ( isset( $returns[4] ) )
+                       $new_option->locale = attribute_escape( $returns[4] );
+               $new_options[] = $new_option;
        }
        }
-       update_option( 'update_core', $new_option );
+
+       $updates = new stdClass();
+       $updates->updates = $new_options;
+       $updates->last_checked = time();
+       $updates->version_checked = $wp_version;
+       update_option( 'update_core',  $updates);
 }
 add_action( 'init', 'wp_version_check' );
 
 /**
 }
 add_action( 'init', 'wp_version_check' );
 
 /**
- * wp_update_plugins() - Check plugin versions against the latest versions hosted on WordPress.org.
+ * Check plugin versions against the latest versions hosted on WordPress.org.
  *
  *
- * The WordPress version, PHP version, and Locale is sent along with a list of all plugins installed.
- * Checks against the WordPress server at api.wordpress.org.
- * Will only check if PHP has fsockopen enabled and WordPress isn't installing.
+ * The WordPress version, PHP version, and Locale is sent along with a list of
+ * all plugins installed. Checks against the WordPress server at
+ * api.wordpress.org. Will only check if WordPress isn't installing.
  *
  * @package WordPress
  *
  * @package WordPress
- * @since 2.3
+ * @since 2.3.0
  * @uses $wp_version Used to notidy the WordPress version.
  *
  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
  * @uses $wp_version Used to notidy the WordPress version.
  *
  * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
@@ -87,7 +105,7 @@ add_action( 'init', 'wp_version_check' );
 function wp_update_plugins() {
        global $wp_version;
 
 function wp_update_plugins() {
        global $wp_version;
 
-       if ( !function_exists('fsockopen') || defined('WP_INSTALLING') )
+       if ( defined('WP_INSTALLING') )
                return false;
 
        // If running blog-side, bail unless we've not checked in the last 12 hours
                return false;
 
        // If running blog-side, bail unless we've not checked in the last 12 hours
@@ -97,6 +115,8 @@ function wp_update_plugins() {
        $plugins = get_plugins();
        $active  = get_option( 'active_plugins' );
        $current = get_option( 'update_plugins' );
        $plugins = get_plugins();
        $active  = get_option( 'active_plugins' );
        $current = get_option( 'update_plugins' );
+       if ( ! is_object($current) )
+               $current = new stdClass;
 
        $new_option = '';
        $new_option->last_checked = time();
 
        $new_option = '';
        $new_option->last_checked = time();
@@ -115,9 +135,11 @@ function wp_update_plugins() {
                        $plugin_changed = true;
        }
 
                        $plugin_changed = true;
        }
 
-       foreach ( (array) $current->response as $plugin_file => $update_details ) {
-               if ( ! isset($plugins[ $plugin_file ]) ) {
-                       $plugin_changed = true;
+       if ( isset ( $current->response ) && is_array( $current->response ) ) {
+               foreach ( $current->response as $plugin_file => $update_details ) {
+                       if ( ! isset($plugins[ $plugin_file ]) ) {
+                               $plugin_changed = true;
+                       }
                }
        }
 
                }
        }
 
@@ -125,37 +147,125 @@ function wp_update_plugins() {
        if ( $time_not_changed && !$plugin_changed )
                return false;
 
        if ( $time_not_changed && !$plugin_changed )
                return false;
 
+       // 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 );
        $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')
+       );
+
+       $raw_response = wp_remote_request('http://api.wordpress.org/plugins/update-check/1.0/', $options);
+
+       if ( is_wp_error( $raw_response ) )
+               return false;
 
 
-       $request = 'plugins=' . urlencode( $send );
-       $http_request  = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
-       $http_request .= "Host: api.wordpress.org\r\n";
-       $http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
-       $http_request .= "Content-Length: " . strlen($request) . "\r\n";
-       $http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
-       $http_request .= "\r\n";
-       $http_request .= $request;
-
-       $response = '';
-       if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
-               fwrite($fs, $http_request);
-
-               while ( !feof($fs) )
-                       $response .= fgets($fs, 1160); // One TCP-IP packet
-               fclose($fs);
-               $response = explode("\r\n\r\n", $response, 2);
+       if( 200 != $raw_response['response']['code'] ) {
+               return false;
        }
 
        }
 
-       $response = unserialize( $response[1] );
+       $response = unserialize( $raw_response['body'] );
 
 
-       if ( $response )
+       if ( false !== $response )
                $new_option->response = $response;
                $new_option->response = $response;
+       else
+               $new_option->response = array();
 
        update_option( 'update_plugins', $new_option );
 }
 
 
        update_option( 'update_plugins', $new_option );
 }
 
+/**
+ * Check theme versions against the latest versions hosted on WordPress.org.
+ *
+ * A list of all themes installed in sent to WP. Checks against the
+ * WordPress server at api.wordpress.org. Will only check if WordPress isn't
+ * installing.
+ *
+ * @package WordPress
+ * @since 2.7.0
+ * @uses $wp_version Used to notidy the WordPress version.
+ *
+ * @return mixed Returns null if update is unsupported. Returns false if check is too soon.
+ */
+function wp_update_themes( ) {
+       global $wp_version;
+
+       if( defined( 'WP_INSTALLING' ) )
+               return false;
+
+       if( !function_exists( 'get_themes' ) )
+               require_once( ABSPATH . 'wp-includes/theme.php' );
+
+       $installed_themes = get_themes( );
+       $current_theme = get_option( 'update_themes' );
+       if ( ! is_object($current_theme) )
+               $current_theme = new stdClass;
+
+       $new_option = '';
+       $new_option->last_checked = time( );
+       $time_not_changed = isset( $current_theme->last_checked ) && 43200 > ( 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();
+       update_option( 'update_themes', $current_theme );
+
+       $themes = array( );
+       $themes['current_theme'] = $current_theme;
+       foreach( (array) $installed_themes as $theme_title => $theme ) {
+               $themes[$theme['Template']] = array( );
+
+               foreach( (array) $theme as $key => $value ) {
+                       $themes[$theme['Template']][$key] = $value;
+               }
+       }
+
+       $options = array(
+               'method'                => 'POST',
+               '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' )
+       );
+
+       $raw_response = wp_remote_request( 'http://api.wordpress.org/themes/update-check/1.0/', $options );
+
+       if( is_wp_error( $raw_response ) )
+               return false;
+
+       if( 200 != $raw_response['response']['code'] )
+               return false;
+
+       $response = unserialize( $raw_response['body'] );
+       if( $response )
+               $new_option->response = $response;
+
+       update_option( 'update_themes', $new_option );
+}
+
+/**
+ * Check the last time plugins were run before checking plugin versions.
+ *
+ * This might have been backported to WordPress 2.6.1 for performance reasons.
+ * This is used for the wp-admin to check only so often instead of every page
+ * load.
+ *
+ * @since 2.7.0
+ * @access private
+ */
 function _maybe_update_plugins() {
        $current = get_option( 'update_plugins' );
        if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
 function _maybe_update_plugins() {
        $current = get_option( 'update_plugins' );
        if ( isset( $current->last_checked ) && 43200 > ( time() - $current->last_checked ) )
@@ -163,11 +273,36 @@ function _maybe_update_plugins() {
        wp_update_plugins();
 }
 
        wp_update_plugins();
 }
 
+/**
+ * Check themes versions only after a duration of time.
+ *
+ * This is for performance reasons to make sure that on the theme version
+ * checker is not run on every page load.
+ *
+ * @since 2.7.0
+ * @access private
+ */
+function _maybe_update_themes( ) {
+       $current = get_option( 'update_themes' );
+       if( isset( $current->last_checked ) && 43200 > ( time( ) - $current->last_checked ) )
+               return;
+
+       wp_update_themes( );
+}
+
 add_action( 'load-plugins.php', '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( 'admin_init', '_maybe_update_plugins' );
 add_action( 'wp_update_plugins', 'wp_update_plugins' );
 
-if ( !wp_next_scheduled('wp_update_plugins') )
+add_action( 'admin_init', '_maybe_update_themes' );
+add_action( 'wp_update_themes', 'wp_update_themes' );
+
+if ( !wp_next_scheduled('wp_update_plugins') && !defined('WP_INSTALLING') )
        wp_schedule_event(time(), 'twicedaily', 'wp_update_plugins');
 
        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');
+
 ?>
 ?>
index f7988638fe1c1f3dddea81398d05989c7fcc8c16..cea1a03d276b55bc0237b3a99fb9001893e2fc92 100644 (file)
@@ -1,5 +1,27 @@
 <?php
 <?php
-
+/**
+ * WordPress User API
+ *
+ * @package WordPress
+ */
+
+/**
+ * Authenticate user with remember capability.
+ *
+ * The credentials is an array that has 'user_login', 'user_password', and
+ * 'remember' indices. If the credentials is not given, then the log in form
+ * will be assumed and used if set.
+ *
+ * The various authentication cookies will be set by this function and will be
+ * set for a longer period depending on if the 'remember' credential is set to
+ * true.
+ *
+ * @since 2.5.0
+ *
+ * @param array $credentials Optional. User info in order to sign on.
+ * @param bool $secure_cookie Optional. Whether to use secure cookie.
+ * @return object Either WP_Error on failure, or WP_User on success.
+ */
 function wp_signon( $credentials = '', $secure_cookie = '' ) {
        if ( empty($credentials) ) {
                if ( ! empty($_POST['log']) )
 function wp_signon( $credentials = '', $secure_cookie = '' ) {
        if ( empty($credentials) ) {
                if ( ! empty($_POST['log']) )
@@ -23,23 +45,23 @@ function wp_signon( $credentials = '', $secure_cookie = '' ) {
 
        if ( '' === $secure_cookie )
                $secure_cookie = is_ssl() ? true : false;
 
        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']) ) {
        // 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);
+               $user = wp_validate_auth_cookie();
+               if ( $user )
+                       return new WP_User($user);
 
 
-                       if ( $secure_cookie )
-                               $auth_cookie = SECURE_AUTH_COOKIE;
-                       else
-                               $auth_cookie = AUTH_COOKIE;
+               if ( $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 ( !empty($_COOKIE[$auth_cookie]) )
+                       return new WP_Error('expired_session', __('Please log in again.'));
 
 
-                       // If the cookie is not set, be silent.
-                       return new WP_Error();
+               // If the cookie is not set, be silent.
+               return new WP_Error();
        }
 
        if ( empty($credentials['user_login']) || empty($credentials['user_password']) ) {
        }
 
        if ( empty($credentials['user_login']) || empty($credentials['user_password']) ) {
@@ -61,6 +83,27 @@ function wp_signon( $credentials = '', $secure_cookie = '' ) {
        return $user;
 }
 
        return $user;
 }
 
+/**
+ * Retrieve user data based on field.
+ *
+ * Use get_profile() will make a database query to get the value of the table
+ * column. The value might be cached using the query cache, but care should be
+ * taken when using the function to not make a lot of queries for retrieving
+ * user profile information.
+ *
+ * If the $user parameter is not used, then the user will be retrieved from a
+ * cookie of the user. Therefore, if the cookie does not exist, then no value
+ * might be returned. Sanity checking must be done to ensure that when using
+ * get_profile() that empty/null/false values are handled and that something is
+ * at least displayed.
+ *
+ * @since 1.5.0
+ * @uses $wpdb WordPress database object to create queries.
+ *
+ * @param string $field User field to retrieve.
+ * @param string $user Optional. User username.
+ * @return string The value in the field.
+ */
 function get_profile($field, $user = false) {
        global $wpdb;
        if ( !$user )
 function get_profile($field, $user = false) {
        global $wpdb;
        if ( !$user )
@@ -68,14 +111,33 @@ function get_profile($field, $user = false) {
        return $wpdb->get_var( $wpdb->prepare("SELECT $field FROM $wpdb->users WHERE user_login = %s", $user) );
 }
 
        return $wpdb->get_var( $wpdb->prepare("SELECT $field FROM $wpdb->users WHERE user_login = %s", $user) );
 }
 
+/**
+ * Number of posts user has written.
+ *
+ * @since 0.71
+ * @uses $wpdb WordPress database object for queries.
+ *
+ * @param int $userid User ID.
+ * @return int Amount of posts user has written.
+ */
 function get_usernumposts($userid) {
        global $wpdb;
        $userid = (int) $userid;
 function get_usernumposts($userid) {
        global $wpdb;
        $userid = (int) $userid;
-       return $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = %d AND post_type = 'post' AND ", $userid) . get_private_posts_cap_sql('post'));
+       $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = %d AND post_type = 'post' AND ", $userid) . get_private_posts_cap_sql('post'));
+       return apply_filters('get_usernumposts', $count, $userid);
 }
 
 }
 
-// TODO: xmlrpc only.  Maybe move to xmlrpc.php.
-function user_pass_ok($user_login,$user_pass) {
+/**
+ * Check that the user login name and password is correct.
+ *
+ * @since 0.71
+ * @todo xmlrpc only. Maybe move to xmlrpc.php.
+ *
+ * @param string $user_login User name.
+ * @param string $user_pass User password.
+ * @return bool False if does not authenticate, true if username and password authenticates.
+ */
+function user_pass_ok($user_login, $user_pass) {
        $user = wp_authenticate($user_login, $user_pass);
        if ( is_wp_error($user) )
                return false;
        $user = wp_authenticate($user_login, $user_pass);
        if ( is_wp_error($user) )
                return false;
@@ -87,7 +149,29 @@ function user_pass_ok($user_login,$user_pass) {
 // User option functions
 //
 
 // User option functions
 //
 
-function get_user_option( $option, $user = 0 ) {
+/**
+ * Retrieve user option that can be either global, user, or blog.
+ *
+ * If the user ID is not given, then the current user will be used instead. If
+ * the user ID is given, then the user data will be retrieved. The filter for
+ * the result, will also pass the original option name and finally the user data
+ * object as the third parameter.
+ *
+ * The option will first check for the non-global name, then the global name,
+ * and if it still doesn't find it, it will try the blog option. The option can
+ * either be modified or set by a plugin.
+ *
+ * @since 2.0.0
+ * @uses $wpdb WordPress database object for queries.
+ * @uses apply_filters() Calls 'get_user_option_$option' hook with result,
+ *             option parameter, and user data object.
+ *
+ * @param string $option User option name.
+ * @param int $user Optional. User ID.
+ * @param bool $check_blog_options Whether to check for an option in the options table if a per-user option does not exist. Default is true.
+ * @return mixed
+ */
+function get_user_option( $option, $user = 0, $check_blog_options = true ) {
        global $wpdb;
 
        $option = preg_replace('|[^a-z0-9_]|i', '', $option);
        global $wpdb;
 
        $option = preg_replace('|[^a-z0-9_]|i', '', $option);
@@ -100,12 +184,30 @@ function get_user_option( $option, $user = 0 ) {
                $result = $user->{$wpdb->prefix . $option};
        elseif ( isset( $user->{$option} ) ) // User specific and cross-blog
                $result = $user->{$option};
                $result = $user->{$wpdb->prefix . $option};
        elseif ( isset( $user->{$option} ) ) // User specific and cross-blog
                $result = $user->{$option};
-       else // Blog global
+       elseif ( $check_blog_options ) // Blog global
                $result = get_option( $option );
                $result = get_option( $option );
-       
+       else
+               $result = false;
+
        return apply_filters("get_user_option_{$option}", $result, $option, $user);
 }
 
        return apply_filters("get_user_option_{$option}", $result, $option, $user);
 }
 
+/**
+ * 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
+ * it will prepend the WordPress table prefix to the option name.
+ *
+ * @since 2.0.0
+ * @uses $wpdb WordPress database object for queries
+ *
+ * @param int $user_id User ID
+ * @param string $option_name User option name.
+ * @param mixed $newvalue User option value.
+ * @param bool $global Optional. Whether option name is blog specific or not.
+ * @return unknown
+ */
 function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
        global $wpdb;
        if ( !$global )
 function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
        global $wpdb;
        if ( !$global )
@@ -113,8 +215,19 @@ function update_user_option( $user_id, $option_name, $newvalue, $global = false
        return update_usermeta( $user_id, $option_name, $newvalue );
 }
 
        return update_usermeta( $user_id, $option_name, $newvalue );
 }
 
-// Get users with capabilities for the current blog.
-// For setups that use the multi-blog feature.
+/**
+ * Get users for the blog.
+ *
+ * For setups that use the multi-blog feature. Can be used outside of the
+ * multi-blog feature.
+ *
+ * @since 2.2.0
+ * @uses $wpdb WordPress database object for queries
+ * @uses $blog_id The Blog id of the blog for those that use more than one blog
+ *
+ * @param int $id Blog ID.
+ * @return array List of users that are part of that Blog ID
+ */
 function get_users_of_blog( $id = '' ) {
        global $wpdb, $blog_id;
        if ( empty($id) )
 function get_users_of_blog( $id = '' ) {
        global $wpdb, $blog_id;
        if ( empty($id) )
@@ -127,6 +240,17 @@ function get_users_of_blog( $id = '' ) {
 // User meta functions
 //
 
 // User meta functions
 //
 
+/**
+ * Remove user meta data.
+ *
+ * @since 2.0.0
+ * @uses $wpdb WordPress database object for queries.
+ *
+ * @param int $user_id User ID.
+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value.
+ * @return bool True deletion completed and false if user_id is not a number.
+ */
 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
        global $wpdb;
        if ( !is_numeric( $user_id ) )
 function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
        global $wpdb;
        if ( !is_numeric( $user_id ) )
@@ -138,7 +262,7 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
        $meta_value = trim( $meta_value );
 
        if ( ! empty($meta_value) )
        $meta_value = trim( $meta_value );
 
        if ( ! empty($meta_value) )
-               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $userid, $meta_key, $meta_value) );
+               $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s AND meta_value = %s", $user_id, $meta_key, $meta_value) );
        else
                $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
 
        else
                $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) );
 
@@ -147,6 +271,21 @@ function delete_usermeta( $user_id, $meta_key, $meta_value = '' ) {
        return true;
 }
 
        return true;
 }
 
+/**
+ * Retrieve user metadata.
+ *
+ * If $user_id is not a number, then the function will fail over with a 'false'
+ * boolean return value. Other returned values depend on whether there is only
+ * one item to be returned, which be that single item type. If there is more
+ * than one metadata value, then it will be list of metadata values.
+ *
+ * @since 2.0.0
+ * @uses $wpdb WordPress database object for queries.
+ *
+ * @param int $user_id User ID
+ * @param string $meta_key Optional. Metadata key.
+ * @return mixed
+ */
 function get_usermeta( $user_id, $meta_key = '') {
        global $wpdb;
        $user_id = (int) $user_id;
 function get_usermeta( $user_id, $meta_key = '') {
        global $wpdb;
        $user_id = (int) $user_id;
@@ -181,13 +320,30 @@ function get_usermeta( $user_id, $meta_key = '') {
                return $metas;
 }
 
                return $metas;
 }
 
+/**
+ * Update metadata of user.
+ *
+ * There is no need to serialize values, they will be serialized if it is
+ * needed. The metadata key can only be a string with underscores. All else will
+ * be removed.
+ *
+ * Will remove the metadata, if the meta value is empty.
+ *
+ * @since 2.0.0
+ * @uses $wpdb WordPress database object for queries
+ *
+ * @param int $user_id User ID
+ * @param string $meta_key Metadata key.
+ * @param mixed $meta_value Metadata value.
+ * @return bool True on successful update, false on failure.
+ */
 function update_usermeta( $user_id, $meta_key, $meta_value ) {
        global $wpdb;
        if ( !is_numeric( $user_id ) )
                return false;
        $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
 
 function update_usermeta( $user_id, $meta_key, $meta_value ) {
        global $wpdb;
        if ( !is_numeric( $user_id ) )
                return false;
        $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
 
-       // FIXME: usermeta data is assumed to be already escaped
+       /** @todo Might need fix because usermeta data is assumed to be already escaped */
        if ( is_string($meta_value) )
                $meta_value = stripslashes($meta_value);
        $meta_value = maybe_serialize($meta_value);
        if ( is_string($meta_value) )
                $meta_value = stripslashes($meta_value);
        $meta_value = maybe_serialize($meta_value);
@@ -216,7 +372,24 @@ function update_usermeta( $user_id, $meta_key, $meta_value ) {
 // Private helper functions
 //
 
 // Private helper functions
 //
 
-// Setup global user vars.  Used by set_current_user() for back compat.
+/**
+ * Setup global user vars.
+ *
+ * Used by set_current_user() for back compat. Might be deprecated in the
+ * future.
+ *
+ * @since 2.0.4
+ * @global string $userdata User description.
+ * @global string $user_login The user username for logging in
+ * @global int $user_level The level of the user
+ * @global int $user_ID The ID of the user
+ * @global string $user_email The email address of the user
+ * @global string $user_url The url in the user's profile
+ * @global string $user_pass_md5 MD5 of the user's password
+ * @global string $user_identity The display name of the user
+ *
+ * @param int $user_id Optional. User ID to setup global data.
+ */
 function setup_userdata($user_id = '') {
        global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
 
 function setup_userdata($user_id = '') {
        global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity;
 
@@ -238,12 +411,44 @@ function setup_userdata($user_id = '') {
        $user_identity  = $user->display_name;
 }
 
        $user_identity  = $user->display_name;
 }
 
+/**
+ * Create dropdown HTML content of users.
+ *
+ * The content can either be displayed, which it is by default or retrieved by
+ * setting the 'echo' argument. The 'include' and 'exclude' arguments do not
+ * need to be used; all users will be displayed in that case. Only one can be
+ * used, either 'include' or 'exclude', but not both.
+ *
+ * The available arguments are as follows:
+ * <ol>
+ * <li>show_option_all - Text to show all and whether HTML option exists.</li>
+ * <li>show_option_none - Text for show none and whether HTML option exists.
+ *     </li>
+ * <li>orderby - SQL order by clause for what order the users appear. Default is
+ * 'display_name'.</li>
+ * <li>order - Default is 'ASC'. Can also be 'DESC'.</li>
+ * <li>include - User IDs to include.</li>
+ * <li>exclude - User IDs to exclude.</li>
+ * <li>multi - Default is 'false'. Whether to skip the ID attribute on the 'select' element.</li>
+ * <li>show - Default is 'display_name'. User table column to display. If the selected item is empty then the user_login will be displayed in parentesis</li>
+ * <li>echo - Default is '1'. Whether to display or retrieve content.</li>
+ * <li>selected - Which User ID is selected.</li>
+ * <li>name - Default is 'user'. Name attribute of select element.</li>
+ * <li>class - Class attribute of select element.</li>
+ * </ol>
+ *
+ * @since 2.3.0
+ * @uses $wpdb WordPress database object for queries
+ *
+ * @param string|array $args Optional. Override defaults.
+ * @return string|null Null on display. String of HTML content on retrieve.
+ */
 function wp_dropdown_users( $args = '' ) {
        global $wpdb;
        $defaults = array(
                'show_option_all' => '', 'show_option_none' => '',
                'orderby' => 'display_name', 'order' => 'ASC',
 function wp_dropdown_users( $args = '' ) {
        global $wpdb;
        $defaults = array(
                'show_option_all' => '', 'show_option_none' => '',
                'orderby' => 'display_name', 'order' => 'ASC',
-               'include' => '', 'exclude' => '',
+               'include' => '', 'exclude' => '', 'multi' => 0,
                'show' => 'display_name', 'echo' => 1,
                'selected' => 0, 'name' => 'user', 'class' => ''
        );
                'show' => 'display_name', 'echo' => 1,
                'selected' => 0, 'name' => 'user', 'class' => ''
        );
@@ -278,7 +483,9 @@ function wp_dropdown_users( $args = '' ) {
 
        $output = '';
        if ( !empty($users) ) {
 
        $output = '';
        if ( !empty($users) ) {
-               $output = "<select name='$name' id='$name' class='$class'>\n";
+               $id = $multi ? "" : "id='$name'";
+
+               $output = "<select name='$name' $id class='$class'>\n";
 
                if ( $show_option_all )
                        $output .= "\t<option value='0'>$show_option_all</option>\n";
 
                if ( $show_option_all )
                        $output .= "\t<option value='0'>$show_option_all</option>\n";
@@ -286,10 +493,11 @@ function wp_dropdown_users( $args = '' ) {
                if ( $show_option_none )
                        $output .= "\t<option value='-1'>$show_option_none</option>\n";
 
                if ( $show_option_none )
                        $output .= "\t<option value='-1'>$show_option_none</option>\n";
 
-               foreach ( $users as $user ) {
+               foreach ( (array) $users as $user ) {
                        $user->ID = (int) $user->ID;
                        $_selected = $user->ID == $selected ? " selected='selected'" : '';
                        $user->ID = (int) $user->ID;
                        $_selected = $user->ID == $selected ? " selected='selected'" : '';
-                       $output .= "\t<option value='$user->ID'$_selected>" . wp_specialchars($user->$show) . "</option>\n";
+                       $display = !empty($user->$show) ? $user->$show : '('. $user->user_login . ')';
+                       $output .= "\t<option value='$user->ID'$_selected>" . wp_specialchars($display) . "</option>\n";
                }
 
                $output .= "</select>";
                }
 
                $output .= "</select>";
@@ -303,6 +511,20 @@ function wp_dropdown_users( $args = '' ) {
        return $output;
 }
 
        return $output;
 }
 
+/**
+ * Add user meta data as properties to given user object.
+ *
+ * The finished user data is cached, but the cache is not used to fill in the
+ * user data for the given object. Once the function has been used, the cache
+ * should be used to retrieve user data. The purpose seems then to be to ensure
+ * that the data in the object is always fresh.
+ *
+ * @access private
+ * @since 2.5.0
+ * @uses $wpdb WordPress database object for queries
+ *
+ * @param object $user The user data object.
+ */
 function _fill_user( &$user ) {
        global $wpdb;
 
 function _fill_user( &$user ) {
        global $wpdb;
 
@@ -311,7 +533,7 @@ function _fill_user( &$user ) {
        $wpdb->show_errors($show);
 
        if ( $metavalues ) {
        $wpdb->show_errors($show);
 
        if ( $metavalues ) {
-               foreach ( $metavalues as $meta ) {
+               foreach ( (array) $metavalues as $meta ) {
                        $value = maybe_unserialize($meta->meta_value);
                        $user->{$meta->meta_key} = $value;
                }
                        $value = maybe_unserialize($meta->meta_value);
                        $user->{$meta->meta_key} = $value;
                }
index dcb659dc7ec2d3daba548211f52b6b52ab74f6b0..6edc5440beb41506b99a19fc0219012abb7afc69 100644 (file)
@@ -34,11 +34,13 @@ if ( is_admin() ) {
 }
 
 // Simple browser detection
 }
 
 // Simple browser detection
-$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = false;
+$is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false;
 
 if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
        $is_lynx = true;
 
 if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
        $is_lynx = true;
-} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') !== false ) {
+} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) {
+       $is_chrome = true;
+} elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'safari') !== false ) {
        $is_safari = true;
 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
        $is_gecko = true;
        $is_safari = true;
 } elseif (strpos($_SERVER['HTTP_USER_AGENT'], 'Gecko') !== false) {
        $is_gecko = true;
@@ -52,6 +54,9 @@ if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) {
        $is_NS4 = true;
 }
 
        $is_NS4 = true;
 }
 
+if ( $is_safari && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'mobile') !== false )
+       $is_iphone = true;
+
 $is_IE = ( $is_macIE || $is_winIE );
 
 // Server detection
 $is_IE = ( $is_macIE || $is_winIE );
 
 // Server detection
@@ -68,4 +73,4 @@ $is_apache = ((strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false) || (strp
  */
 $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;
 
  */
 $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false) ? true : false;
 
-?>
+?>
\ No newline at end of file
index d532c5262ce727d725b6727d201e283af6a16952..6b2150e8c90a5b998e13acee580f42841e427315 100644 (file)
@@ -8,13 +8,13 @@
  *
  * @global string $wp_version
  */
  *
  * @global string $wp_version
  */
-$wp_version = '2.6.2';
+$wp_version = '2.7.1';
 
 /**
  * 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 = 8204;
+$wp_db_version = 9872;
 
 ?>
 
 ?>
index 73e1f6e8ca681f55cf997f78167a92010e001eaf..2d654018338ce60a7e7c2839d4da330458feb118 100644 (file)
@@ -1,15 +1,71 @@
 <?php
 <?php
+/**
+ * API for creating dynamic sidebar without hardcoding functionality into
+ * themes. Includes both internal WordPress routines and theme use routines.
+ *
+ * This functionality was found in a plugin before WordPress 2.2 release which
+ * included it in the core from that point on.
+ *
+ * @link http://codex.wordpress.org/Plugins/WordPress_Widgets WordPress Widgets
+ * @link http://codex.wordpress.org/Plugins/WordPress_Widgets_Api Widgets API
+ *
+ * @package WordPress
+ * @subpackage Widgets
+ */
 
 /* Global Variables */
 
 
 /* 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;
 
+/**
+ * Stores the sidebars, since many themes can have more than one.
+ *
+ * @global array $wp_registered_sidebars
+ * @since 2.2.0
+ */
 $wp_registered_sidebars = array();
 $wp_registered_sidebars = array();
+
+/**
+ * Stores the registered widgets.
+ *
+ * @global array $wp_registered_widgets
+ * @since 2.2.0
+ */
 $wp_registered_widgets = array();
 $wp_registered_widgets = array();
+
+/**
+ * Stores the registered widget control (options).
+ *
+ * @global array $wp_registered_widget_controls
+ * @since 2.2.0
+ */
 $wp_registered_widget_controls = array();
 
 /* Template tags & API functions */
 
 $wp_registered_widget_controls = array();
 
 /* Template tags & API functions */
 
+/**
+ * Creates multiple sidebars.
+ *
+ * If you wanted to quickly create multiple sidebars for a theme or internally.
+ * This function will allow you to do so. If you don't pass the 'name' and/or
+ * 'id' in $args, then they will be built for you.
+ *
+ * The default for the name is "Sidebar #", with '#' being replaced with the
+ * number the sidebar is currently when greater than one. If first sidebar, the
+ * name will be just "Sidebar". The default for id is "sidebar-" followed by the
+ * number the sidebar creation is currently at.
+ *
+ * @since 2.2.0
+ *
+ * @see register_sidebar() The second parameter is documented by register_sidebar() and is the same here.
+ * @uses parse_str() Converts a string to an array to be used in the rest of the function.
+ * @uses register_sidebar() Sends single sidebar information [name, id] to this
+ *     function to handle building the sidebar.
+ *
+ * @param int $number Number of sidebars to create.
+ * @param string|array $args Builds Sidebar based off of 'name' and 'id' values.
+ */
 function register_sidebars($number = 1, $args = array()) {
        global $wp_registered_sidebars;
        $number = (int) $number;
 function register_sidebars($number = 1, $args = array()) {
        global $wp_registered_sidebars;
        $number = (int) $number;
@@ -40,6 +96,40 @@ function register_sidebars($number = 1, $args = array()) {
        }
 }
 
        }
 }
 
+/**
+ * Builds the definition for a single sidebar and returns the ID.
+ *
+ * The $args parameter takes either a string or an array with 'name' and 'id'
+ * contained in either usage. It will be noted that the values will be applied
+ * to all sidebars, so if creating more than one, it will be advised to allow
+ * for WordPress to create the defaults for you.
+ *
+ * Example for string would be <code>'name=whatever;id=whatever1'</code> and for
+ * the array it would be <code>array(
+ *    'name' => 'whatever',
+ *    'id' => 'whatever1')</code>.
+ *
+ * name - The name of the sidebar, which presumably the title which will be
+ *     displayed.
+ * id - The unique identifier by which the sidebar will be called by.
+ * before_widget - The content that will prepended to the widgets when they are
+ *     displayed.
+ * after_widget - The content that will be appended to the widgets when they are
+ *     displayed.
+ * before_title - The content that will be prepended to the title when displayed.
+ * after_title - the content that will be appended to the title when displayed.
+ *
+ * <em>Content</em> is assumed to be HTML and should be formatted as such, but
+ * doesn't have to be.
+ *
+ * @since 2.2.0
+ * @uses $wp_registered_sidebars Stores the new sidebar in this array by sidebar ID.
+ * @uses parse_str() Converts a string to an array to be used in the rest of the function.
+ * @usedby register_sidebars()
+ *
+ * @param string|array $args Builds Sidebar based off of 'name' and 'id' values
+ * @return string The sidebar id that was added.
+ */
 function register_sidebar($args = array()) {
        global $wp_registered_sidebars;
 
 function register_sidebar($args = array()) {
        global $wp_registered_sidebars;
 
@@ -64,6 +154,15 @@ function register_sidebar($args = array()) {
        return $sidebar['id'];
 }
 
        return $sidebar['id'];
 }
 
+/**
+ * Removes a sidebar from the list.
+ *
+ * @since 2.2.0
+ *
+ * @uses $wp_registered_sidebars Stores the new sidebar in this array by sidebar ID.
+ *
+ * @param string $name The ID of the sidebar when it was added.
+ */
 function unregister_sidebar( $name ) {
        global $wp_registered_sidebars;
 
 function unregister_sidebar( $name ) {
        global $wp_registered_sidebars;
 
@@ -71,6 +170,24 @@ 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) ) {
 function register_sidebar_widget($name, $output_callback, $classname = '') {
        // Compat
        if ( is_array($name) ) {
@@ -92,6 +209,26 @@ function register_sidebar_widget($name, $output_callback, $classname = '') {
        call_user_func_array('wp_register_sidebar_widget', $args);
 }
 
        call_user_func_array('wp_register_sidebar_widget', $args);
 }
 
+/**
+ * Register widget for use in sidebars.
+ *
+ * The default widget option is 'classname' that can be override.
+ *
+ * The function can also be used to unregister widgets when $output_callback
+ * parameter is an empty string.
+ *
+ * @since 2.2.0
+ *
+ * @uses $wp_registered_widgets Uses stored registered widgets.
+ * @uses $wp_register_widget_defaults Retrieves widget defaults.
+ *
+ * @param int|string $id Widget ID.
+ * @param string $name Widget display title.
+ * @param callback $output_callback Run when widget is called.
+ * @param array|string Optional. $options Widget Options.
+ * @param mixed $params,... Widget parameters to add to widget.
+ * @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;
 
 function wp_register_sidebar_widget($id, $name, $output_callback, $options = array()) {
        global $wp_registered_widgets;
 
@@ -116,6 +253,18 @@ function wp_register_sidebar_widget($id, $name, $output_callback, $options = arr
                $wp_registered_widgets[$id] = $widget;
 }
 
                $wp_registered_widgets[$id] = $widget;
 }
 
+/**
+ * Retrieve description for widget.
+ *
+ * When registering widgets, the options can also include 'description' that
+ * describes the widget for display on the widget administration panel or
+ * in the theme.
+ *
+ * @since 2.5.0
+ *
+ * @param int|string $id Widget ID.
+ * @return string Widget description, if available. Null on failure to retrieve description.
+ */
 function wp_widget_description( $id ) {
        if ( !is_scalar($id) )
                return;
 function wp_widget_description( $id ) {
        if ( !is_scalar($id) )
                return;
@@ -126,15 +275,48 @@ function wp_widget_description( $id ) {
                return wp_specialchars( $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);
 }
 
 function unregister_sidebar_widget($id) {
        return wp_unregister_sidebar_widget($id);
 }
 
+/**
+ * Remove widget from sidebar.
+ *
+ * @since 2.2.0
+ *
+ * @param int|string $id Widget ID.
+ */
 function wp_unregister_sidebar_widget($id) {
        wp_register_sidebar_widget($id, '', '');
        wp_unregister_widget_control($id);
 }
 
 function wp_unregister_sidebar_widget($id) {
        wp_register_sidebar_widget($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) ) {
 function register_widget_control($name, $control_callback, $width = '', $height = '') {
        // Compat
        if ( is_array($name) ) {
@@ -158,15 +340,27 @@ function register_widget_control($name, $control_callback, $width = '', $height
        call_user_func_array('wp_register_widget_control', $args);
 }
 
        call_user_func_array('wp_register_widget_control', $args);
 }
 
-/* $options: height, width, id_base
- *   height: never used
- *   width:  width of fully expanded control form.  Try hard to use the default width.
- *   id_base: for multi-widgets (widgets which allow multiple instances such as the text widget), an id_base must be provided.
- *            the widget id will ennd up looking like {$id_base}-{$unique_number}
+/**
+ * Registers widget control callback for customizing options.
+ *
+ * The options contains the 'height', 'width', and 'id_base' keys. The 'height'
+ * option is never used. The 'width' option is the width of the fully expanded
+ * control form, but try hard to use the default width. The 'id_base' is for
+ * multi-widgets (widgets which allow multiple instances such as the text
+ * widget), an id_base must be provided. The widget id will end up looking like
+ * {$id_base}-{$unique_number}.
+ *
+ * @since 2.2.0
+ *
+ * @param int|string $id Sidebar ID.
+ * @param string $name Sidebar display name.
+ * @param callback $control_callback Run when sidebar is displayed.
+ * @param array|string $options Optional. Widget options. See above long description.
+ * @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;
  */
 function wp_register_widget_control($id, $name, $control_callback, $options = array()) {
        global $wp_registered_widget_controls;
-       
+
        $id = strtolower($id);
 
        if ( empty($control_callback) ) {
        $id = strtolower($id);
 
        if ( empty($control_callback) ) {
@@ -193,14 +387,49 @@ function wp_register_widget_control($id, $name, $control_callback, $options = ar
        $wp_registered_widget_controls[$id] = $widget;
 }
 
        $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);
 }
 
 function unregister_widget_control($id) {
        return wp_unregister_widget_control($id);
 }
 
+/**
+ * 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, '', '');
 }
 
 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
+ * for 'sidebar-after-post'.
+ *
+ * It is confusing for the $index parameter, but just know that it should just
+ * work. When you register the sidebar in the theme, you will use the same name
+ * for this function or "Pay no heed to the man behind the curtain." Just accept
+ * it as an oddity of WordPress sidebar register and display.
+ *
+ * @since 2.2.0
+ *
+ * @param int|string $index Optional, default is 1. Name or ID of dynamic sidebar.
+ * @return bool True, if widget sidebar was found and called. False if not found or not called.
+ */
 function dynamic_sidebar($index = 1) {
        global $wp_registered_sidebars, $wp_registered_widgets;
 
 function dynamic_sidebar($index = 1) {
        global $wp_registered_sidebars, $wp_registered_widgets;
 
@@ -208,7 +437,7 @@ function dynamic_sidebar($index = 1) {
                $index = "sidebar-$index";
        } else {
                $index = sanitize_title($index);
                $index = "sidebar-$index";
        } else {
                $index = sanitize_title($index);
-               foreach ( $wp_registered_sidebars as $key => $value ) {
+               foreach ( (array) $wp_registered_sidebars as $key => $value ) {
                        if ( sanitize_title($value['name']) == $index ) {
                                $index = $key;
                                break;
                        if ( sanitize_title($value['name']) == $index ) {
                                $index = $key;
                                break;
@@ -224,7 +453,7 @@ function dynamic_sidebar($index = 1) {
        $sidebar = $wp_registered_sidebars[$index];
 
        $did_one = false;
        $sidebar = $wp_registered_sidebars[$index];
 
        $did_one = false;
-       foreach ( $sidebars_widgets[$index] as $id ) {
+       foreach ( (array) $sidebars_widgets[$index] as $id ) {
                $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']
@@ -254,7 +483,18 @@ function dynamic_sidebar($index = 1) {
        return $did_one;
 }
 
        return $did_one;
 }
 
-/* @return mixed false if widget is not active or id of sidebar in which the widget is active
+/**
+ * Whether widget is registered using callback with widget ID.
+ *
+ * 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.
+ *
+ * @since 2.2.0
+ *
+ * @param callback $callback Widget callback to check.
+ * @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.
  */
 function is_active_widget($callback, $widget_id = false) {
        global $wp_registered_widgets;
  */
 function is_active_widget($callback, $widget_id = false) {
        global $wp_registered_widgets;
@@ -271,12 +511,19 @@ function is_active_widget($callback, $widget_id = false) {
        return false;
 }
 
        return false;
 }
 
+/**
+ * Whether the dynamic sidebar is enabled and used by theme.
+ *
+ * @since 2.2.0
+ *
+ * @return bool True, if using widgets. False, if not using widgets.
+ */
 function is_dynamic_sidebar() {
        global $wp_registered_widgets, $wp_registered_sidebars;
        $sidebars_widgets = get_option('sidebars_widgets');
 function is_dynamic_sidebar() {
        global $wp_registered_widgets, $wp_registered_sidebars;
        $sidebars_widgets = get_option('sidebars_widgets');
-       foreach ( $wp_registered_sidebars as $index => $sidebar ) {
+       foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) {
                if ( count($sidebars_widgets[$index]) ) {
                if ( count($sidebars_widgets[$index]) ) {
-                       foreach ( $sidebars_widgets[$index] as $widget )
+                       foreach ( (array) $sidebars_widgets[$index] as $widget )
                                if ( array_key_exists($widget, $wp_registered_widgets) )
                                        return true;
                }
                                if ( array_key_exists($widget, $wp_registered_widgets) )
                                        return true;
                }
@@ -286,10 +533,22 @@ function is_dynamic_sidebar() {
 
 /* Internal Functions */
 
 
 /* Internal Functions */
 
+/**
+ * Retrieve full list of sidebars and their widgets.
+ *
+ * Will upgrade sidebar widget list, if needed. Will also save updated list, if
+ * needed.
+ *
+ * @since 2.2.0
+ * @access private
+ *
+ * @param bool $update Optional, default is true. Whether to save upgrade of widget array list.
+ * @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;
 
 function wp_get_sidebars_widgets($update = true) {
        global $wp_registered_widgets, $wp_registered_sidebars;
 
-       $sidebars_widgets = get_option('sidebars_widgets');
+       $sidebars_widgets = get_option('sidebars_widgets', array());
        $_sidebars_widgets = array();
 
        if ( !isset($sidebars_widgets['array_version']) )
        $_sidebars_widgets = array();
 
        if ( !isset($sidebars_widgets['array_version']) )
@@ -297,9 +556,9 @@ function wp_get_sidebars_widgets($update = true) {
 
        switch ( $sidebars_widgets['array_version'] ) {
                case 1 :
 
        switch ( $sidebars_widgets['array_version'] ) {
                case 1 :
-                       foreach ( $sidebars_widgets as $index => $sidebar )
+                       foreach ( (array) $sidebars_widgets as $index => $sidebar )
                        if ( is_array($sidebar) )
                        if ( is_array($sidebar) )
-                       foreach ( $sidebar as $i => $name ) {
+                       foreach ( (array) $sidebar as $i => $name ) {
                                $id = strtolower($name);
                                if ( isset($wp_registered_widgets[$id]) ) {
                                        $_sidebars_widgets[$index][$i] = $id;
                                $id = strtolower($name);
                                if ( isset($wp_registered_widgets[$id]) ) {
                                        $_sidebars_widgets[$index][$i] = $id;
@@ -338,7 +597,7 @@ function wp_get_sidebars_widgets($update = true) {
                        $sidebars = array_keys( $wp_registered_sidebars );
                        if ( !empty( $sidebars ) ) {
                                // Move the known-good ones first
                        $sidebars = array_keys( $wp_registered_sidebars );
                        if ( !empty( $sidebars ) ) {
                                // Move the known-good ones first
-                               foreach ( $sidebars as $id ) {
+                               foreach ( (array) $sidebars as $id ) {
                                        if ( array_key_exists( $id, $sidebars_widgets ) ) {
                                                $_sidebars_widgets[$id] = $sidebars_widgets[$id];
                                                unset($sidebars_widgets[$id], $sidebars[$id]);
                                        if ( array_key_exists( $id, $sidebars_widgets ) ) {
                                                $_sidebars_widgets[$id] = $sidebars_widgets[$id];
                                                unset($sidebars_widgets[$id], $sidebars[$id]);
@@ -359,21 +618,41 @@ function wp_get_sidebars_widgets($update = true) {
                                update_option('sidebars_widgets', $sidebars_widgets);
        }
 
                                update_option('sidebars_widgets', $sidebars_widgets);
        }
 
-       unset($sidebars_widgets['array_version']);
+       if ( isset($sidebars_widgets['array_version']) )
+               unset($sidebars_widgets['array_version']);
 
 
+       $sidebars_widgets = apply_filters('sidebars_widgets', $sidebars_widgets);
        return $sidebars_widgets;
 }
 
        return $sidebars_widgets;
 }
 
+/**
+ * Set the sidebar widget option to update sidebars.
+ *
+ * @since 2.2.0
+ * @access private
+ *
+ * @param array $sidebars_widgets Sidebar widgets and their settings.
+ */
 function wp_set_sidebars_widgets( $sidebars_widgets ) {
 function wp_set_sidebars_widgets( $sidebars_widgets ) {
+       if ( !isset( $sidebars_widgets['array_version'] ) )
+               $sidebars_widgets['array_version'] = 3;
        update_option( 'sidebars_widgets', $sidebars_widgets );
 }
 
        update_option( 'sidebars_widgets', $sidebars_widgets );
 }
 
+/**
+ * Retrieve default registered sidebars list.
+ *
+ * @since 2.2.0
+ * @access private
+ *
+ * @return array
+ */
 function wp_get_widget_defaults() {
        global $wp_registered_sidebars;
 
        $defaults = array();
 
 function wp_get_widget_defaults() {
        global $wp_registered_sidebars;
 
        $defaults = array();
 
-       foreach ( $wp_registered_sidebars as $index => $sidebar )
+       foreach ( (array) $wp_registered_sidebars as $index => $sidebar )
                $defaults[$index] = array();
 
        return $defaults;
                $defaults[$index] = array();
 
        return $defaults;
@@ -381,6 +660,13 @@ function wp_get_widget_defaults() {
 
 /* Default Widgets */
 
 
 /* Default Widgets */
 
+/**
+ * Display pages widget.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Widget arguments.
+ */
 function wp_widget_pages( $args ) {
        extract( $args );
        $options = get_option( 'widget_pages' );
 function wp_widget_pages( $args ) {
        extract( $args );
        $options = get_option( 'widget_pages' );
@@ -407,9 +693,14 @@ function wp_widget_pages( $args ) {
        }
 }
 
        }
 }
 
+/**
+ * Display and process pages widget options form.
+ *
+ * @since 2.2.0
+ */
 function wp_widget_pages_control() {
        $options = $newoptions = get_option('widget_pages');
 function wp_widget_pages_control() {
        $options = $newoptions = get_option('widget_pages');
-       if ( $_POST['pages-submit'] ) {
+       if ( isset($_POST['pages-submit']) ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST['pages-title']));
 
                $sortby = stripslashes( $_POST['pages-sortby'] );
                $newoptions['title'] = strip_tags(stripslashes($_POST['pages-title']));
 
                $sortby = stripslashes( $_POST['pages-sortby'] );
@@ -448,6 +739,13 @@ function wp_widget_pages_control() {
 <?php
 }
 
 <?php
 }
 
+/**
+ * Display links widget.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Widget arguments.
+ */
 function wp_widget_links($args) {
        extract($args, EXTR_SKIP);
 
 function wp_widget_links($args) {
        extract($args, EXTR_SKIP);
 
@@ -459,26 +757,30 @@ function wp_widget_links($args) {
        )));
 }
 
        )));
 }
 
+/**
+ * Display search widget.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Widget arguments.
+ */
 function wp_widget_search($args) {
        extract($args);
 function wp_widget_search($args) {
        extract($args);
-       $searchform_template = get_template_directory() . '/searchform.php';
-       
        echo $before_widget;
        echo $before_widget;
-       
+
        // Use current theme search form if it exists
        // Use current theme search form if it exists
-       if ( file_exists($searchform_template) ) {
-               include_once($searchform_template);
-       } else { ?>
-               <form id="searchform" method="get" action="<?php bloginfo('url'); ?>/"><div>
-                       <label class="hidden" for="s"><?php _e('Search for:'); ?></label>
-                       <input type="text" name="s" id="s" size="15" value="<?php the_search_query(); ?>" />
-                       <input type="submit" value="<?php echo attribute_escape(__('Search')); ?>" />
-               </div></form>
-       <?php }
-       
+       get_search_form();
+
        echo $after_widget;
 }
 
        echo $after_widget;
 }
 
+/**
+ * Display archives widget.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Widget arguments.
+ */
 function wp_widget_archives($args) {
        extract($args);
        $options = get_option('widget_archives');
 function wp_widget_archives($args) {
        extract($args);
        $options = get_option('widget_archives');
@@ -504,9 +806,14 @@ function wp_widget_archives($args) {
        echo $after_widget;
 }
 
        echo $after_widget;
 }
 
+/**
+ * Display and process archives widget options form.
+ *
+ * @since 2.2.0
+ */
 function wp_widget_archives_control() {
        $options = $newoptions = get_option('widget_archives');
 function wp_widget_archives_control() {
        $options = $newoptions = get_option('widget_archives');
-       if ( $_POST["archives-submit"] ) {
+       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"]));
                $newoptions['count'] = isset($_POST['archives-count']);
                $newoptions['dropdown'] = isset($_POST['archives-dropdown']);
                $newoptions['title'] = strip_tags(stripslashes($_POST["archives-title"]));
@@ -529,6 +836,15 @@ function wp_widget_archives_control() {
 <?php
 }
 
 <?php
 }
 
+/**
+ * Display meta widget.
+ *
+ * Displays log in/out, RSS feed links, etc.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Widget arguments.
+ */
 function wp_widget_meta($args) {
        extract($args);
        $options = get_option('widget_meta');
 function wp_widget_meta($args) {
        extract($args);
        $options = get_option('widget_meta');
@@ -547,9 +863,15 @@ function wp_widget_meta($args) {
                <?php echo $after_widget; ?>
 <?php
 }
                <?php echo $after_widget; ?>
 <?php
 }
+
+/**
+ * Display and process meta widget options form.
+ *
+ * @since 2.2.0
+ */
 function wp_widget_meta_control() {
        $options = $newoptions = get_option('widget_meta');
 function wp_widget_meta_control() {
        $options = $newoptions = get_option('widget_meta');
-       if ( $_POST["meta-submit"] ) {
+       if ( isset($_POST["meta-submit"]) ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST["meta-title"]));
        }
        if ( $options != $newoptions ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST["meta-title"]));
        }
        if ( $options != $newoptions ) {
@@ -563,6 +885,13 @@ function wp_widget_meta_control() {
 <?php
 }
 
 <?php
 }
 
+/**
+ * Display calendar widget.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Widget arguments.
+ */
 function wp_widget_calendar($args) {
        extract($args);
        $options = get_option('widget_calendar');
 function wp_widget_calendar($args) {
        extract($args);
        $options = get_option('widget_calendar');
@@ -575,9 +904,15 @@ function wp_widget_calendar($args) {
        echo '</div>';
        echo $after_widget;
 }
        echo '</div>';
        echo $after_widget;
 }
+
+/**
+ * Display and process calendar widget options form.
+ *
+ * @since 2.2.0
+ */
 function wp_widget_calendar_control() {
        $options = $newoptions = get_option('widget_calendar');
 function wp_widget_calendar_control() {
        $options = $newoptions = get_option('widget_calendar');
-       if ( $_POST["calendar-submit"] ) {
+       if ( isset($_POST["calendar-submit"]) ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST["calendar-title"]));
        }
        if ( $options != $newoptions ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST["calendar-title"]));
        }
        if ( $options != $newoptions ) {
@@ -591,7 +926,19 @@ function wp_widget_calendar_control() {
 <?php
 }
 
 <?php
 }
 
-// See large comment section at end of this file
+/**
+ * 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.
+ *
+ * @since 2.2.0
+ *
+ * @param array $args Widget arguments.
+ * @param int $number Widget number.
+ */
 function wp_widget_text($args, $widget_args = 1) {
        extract( $args, EXTR_SKIP );
        if ( is_numeric($widget_args) )
 function wp_widget_text($args, $widget_args = 1) {
        extract( $args, EXTR_SKIP );
        if ( is_numeric($widget_args) )
@@ -613,6 +960,13 @@ function wp_widget_text($args, $widget_args = 1) {
 <?php
 }
 
 <?php
 }
 
+/**
+ * Display and process text widget options form.
+ *
+ * @since 2.2.0
+ *
+ * @param int $widget_args Widget number.
+ */
 function wp_widget_text_control($widget_args) {
        global $wp_registered_widgets;
        static $updated = false;
 function wp_widget_text_control($widget_args) {
        global $wp_registered_widgets;
        static $updated = false;
@@ -635,7 +989,7 @@ function wp_widget_text_control($widget_args) {
                else
                        $this_sidebar = array();
 
                else
                        $this_sidebar = array();
 
-               foreach ( $this_sidebar as $_widget_id ) {
+               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.
                        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.
@@ -675,6 +1029,11 @@ function wp_widget_text_control($widget_args) {
 <?php
 }
 
 <?php
 }
 
+/**
+ * Register text widget on startup.
+ *
+ * @since 2.2.0
+ */
 function wp_widget_text_register() {
        if ( !$options = get_option('widget_text') )
                $options = array();
 function wp_widget_text_register() {
        if ( !$options = get_option('widget_text') )
                $options = array();
@@ -683,7 +1042,7 @@ function wp_widget_text_register() {
        $name = __('Text');
 
        $id = false;
        $name = __('Text');
 
        $id = false;
-       foreach ( array_keys($options) as $o ) {
+       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;
                // Old widgets can have null values for some reason
                if ( !isset($options[$o]['title']) || !isset($options[$o]['text']) )
                        continue;
@@ -699,7 +1058,16 @@ function wp_widget_text_register() {
        }
 }
 
        }
 }
 
-// See large comment section at end of this file
+/**
+ * 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) )
 function wp_widget_categories($args, $widget_args = 1) {
        extract($args, EXTR_SKIP);
        if ( is_numeric($widget_args) )
@@ -729,13 +1097,13 @@ function wp_widget_categories($args, $widget_args = 1) {
 
 <script type='text/javascript'>
 /* <![CDATA[ */
 
 <script type='text/javascript'>
 /* <![CDATA[ */
-    var dropdown = document.getElementById("cat");
-    function onCatChange() {
+       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;
                }
                if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
                        location.href = "<?php echo get_option('home'); ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;
                }
-    }
-    dropdown.onchange = onCatChange;
+       }
+       dropdown.onchange = onCatChange;
 /* ]]> */
 </script>
 
 /* ]]> */
 </script>
 
@@ -743,9 +1111,9 @@ function wp_widget_categories($args, $widget_args = 1) {
        } else {
 ?>
                <ul>
        } else {
 ?>
                <ul>
-               <?php 
+               <?php
                        $cat_args['title_li'] = '';
                        $cat_args['title_li'] = '';
-                       wp_list_categories($cat_args); 
+                       wp_list_categories($cat_args);
                ?>
                </ul>
 <?php
                ?>
                </ul>
 <?php
@@ -754,6 +1122,13 @@ function wp_widget_categories($args, $widget_args = 1) {
        echo $after_widget;
 }
 
        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;
 function wp_widget_categories_control( $widget_args ) {
        global $wp_registered_widgets;
        static $updated = false;
@@ -777,7 +1152,7 @@ function wp_widget_categories_control( $widget_args ) {
                else
                        $this_sidebar = array();
 
                else
                        $this_sidebar = array();
 
-               foreach ( $this_sidebar as $_widget_id ) {
+               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.
                        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.
@@ -840,6 +1215,11 @@ function wp_widget_categories_control( $widget_args ) {
 <?php
 }
 
 <?php
 }
 
+/**
+ * Register categories widget on startup.
+ *
+ * @since 2.3.0
+ */
 function wp_widget_categories_register() {
        if ( !$options = get_option( 'widget_categories' ) )
                $options = array();
 function wp_widget_categories_register() {
        if ( !$options = get_option( 'widget_categories' ) )
                $options = array();
@@ -852,7 +1232,7 @@ function wp_widget_categories_register() {
        $name = __( 'Categories' );
 
        $id = false;
        $name = __( 'Categories' );
 
        $id = false;
-       foreach ( array_keys($options) as $o ) {
+       foreach ( (array) array_keys($options) as $o ) {
                // Old widgets can have null values for some reason
                if ( !isset($options[$o]['title']) )
                        continue;
                // Old widgets can have null values for some reason
                if ( !isset($options[$o]['title']) )
                        continue;
@@ -868,6 +1248,13 @@ function wp_widget_categories_register() {
        }
 }
 
        }
 }
 
+/**
+ * Upgrade previous category widget to current version.
+ *
+ * @since 2.3.0
+ *
+ * @return array
+ */
 function wp_widget_categories_upgrade() {
        $options = get_option( 'widget_categories' );
 
 function wp_widget_categories_upgrade() {
        $options = get_option( 'widget_categories' );
 
@@ -895,6 +1282,14 @@ function wp_widget_categories_upgrade() {
        return $newoptions;
 }
 
        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') )
 function wp_widget_recent_entries($args) {
        if ( '%BEG_OF_TITLE%' != $args['before_title'] ) {
                if ( $output = wp_cache_get('widget_recent_entries', 'widget') )
@@ -912,7 +1307,7 @@ function wp_widget_recent_entries($args) {
        else if ( $number > 15 )
                $number = 15;
 
        else if ( $number > 15 )
                $number = 15;
 
-       $r = new WP_Query(array('showposts' => $number, 'what_to_show' => 'posts', 'nopaging' => 0, 'post_status' => 'publish'));
+       $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; ?>
        if ($r->have_posts()) :
 ?>
                <?php echo $before_widget; ?>
@@ -931,6 +1326,11 @@ function wp_widget_recent_entries($args) {
                wp_cache_add('widget_recent_entries', ob_get_flush(), 'widget');
 }
 
                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');
 }
 function wp_flush_widget_recent_entries() {
        wp_cache_delete('widget_recent_entries', 'widget');
 }
@@ -939,9 +1339,14 @@ 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');
 
 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');
 function wp_widget_recent_entries_control() {
        $options = $newoptions = get_option('widget_recent_entries');
-       if ( $_POST["recent-entries-submit"] ) {
+       if ( isset($_POST["recent-entries-submit"]) ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST["recent-entries-title"]));
                $newoptions['number'] = (int) $_POST["recent-entries-number"];
        }
                $newoptions['title'] = strip_tags(stripslashes($_POST["recent-entries-title"]));
                $newoptions['number'] = (int) $_POST["recent-entries-number"];
        }
@@ -965,6 +1370,13 @@ function wp_widget_recent_entries_control() {
 <?php
 }
 
 <?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);
 function wp_widget_recent_comments($args) {
        global $wpdb, $comments, $comment;
        extract($args, EXTR_SKIP);
@@ -978,7 +1390,7 @@ function wp_widget_recent_comments($args) {
                $number = 15;
 
        if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
                $number = 15;
 
        if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) {
-               $comments = $wpdb->get_results("SELECT comment_author, comment_author_url, comment_ID, comment_post_ID FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");
+               $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' );
        }
 ?>
                wp_cache_add( 'recent_comments', $comments, 'widget' );
        }
 ?>
@@ -986,22 +1398,32 @@ function wp_widget_recent_comments($args) {
                <?php echo $before_widget; ?>
                        <?php echo $before_title . $title . $after_title; ?>
                        <ul id="recentcomments"><?php
                <?php echo $before_widget; ?>
                        <?php echo $before_title . $title . $after_title; ?>
                        <ul id="recentcomments"><?php
-                       if ( $comments ) : foreach ($comments as $comment) :
-                       echo  '<li class="recentcomments">' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
+                       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
 }
 
                        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' );
 
 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');
 function wp_widget_recent_comments_control() {
        $options = $newoptions = get_option('widget_recent_comments');
-       if ( $_POST["recent-comments-submit"] ) {
+       if ( isset($_POST["recent-comments-submit"]) ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST["recent-comments-title"]));
                $newoptions['number'] = (int) $_POST["recent-comments-number"];
        }
                $newoptions['title'] = strip_tags(stripslashes($_POST["recent-comments-title"]));
                $newoptions['number'] = (int) $_POST["recent-comments-number"];
        }
@@ -1024,12 +1446,22 @@ function wp_widget_recent_comments_control() {
 <?php
 }
 
 <?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
 }
 
 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);
 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);
@@ -1039,7 +1471,16 @@ function wp_widget_recent_comments_register() {
                add_action('wp_head', 'wp_widget_recent_comments_style');
 }
 
                add_action('wp_head', 'wp_widget_recent_comments_style');
 }
 
-// See large comment section at end of this file
+/**
+ * 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) )
 function wp_widget_rss($args, $widget_args = 1) {
        extract($args, EXTR_SKIP);
        if ( is_numeric($widget_args) )
@@ -1091,6 +1532,14 @@ function wp_widget_rss($args, $widget_args = 1) {
        echo $after_widget;
 }
 
        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');
 function wp_widget_rss_output( $rss, $args = array() ) {
        if ( is_string( $rss ) ) {
                require_once(ABSPATH . WPINC . '/rss.php');
@@ -1105,6 +1554,8 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                return;
        }
 
                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;
        extract( $args, EXTR_SKIP );
 
        $items = (int) $items;
@@ -1117,7 +1568,7 @@ function wp_widget_rss_output( $rss, $args = array() ) {
        if ( is_array( $rss->items ) && !empty( $rss->items ) ) {
                $rss->items = array_slice($rss->items, 0, $items);
                echo '<ul>';
        if ( is_array( $rss->items ) && !empty( $rss->items ) ) {
                $rss->items = array_slice($rss->items, 0, $items);
                echo '<ul>';
-               foreach ($rss->items as $item ) {
+               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']));
                        while ( strstr($item['link'], 'http') != $item['link'] )
                                $item['link'] = substr($item['link'], 1);
                        $link = clean_url(strip_tags($item['link']));
@@ -1125,11 +1576,13 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                        if ( empty($title) )
                                $title = __('Untitled');
                        $desc = '';
                        if ( empty($title) )
                                $title = __('Untitled');
                        $desc = '';
-                       $summary = '';
                        if ( isset( $item['description'] ) && is_string( $item['description'] ) )
                        if ( isset( $item['description'] ) && is_string( $item['description'] ) )
-                               $desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['description'], ENT_QUOTES))));
+                               $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'] ) )
                        elseif ( isset( $item['summary'] ) && is_string( $item['summary'] ) )
-                               $desc = $summary = str_replace(array("\n", "\r"), ' ', attribute_escape(strip_tags(html_entity_decode($item['summary'], ENT_QUOTES))));
+                               $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 = '';
 
                        if ( $show_summary ) {
                                $desc = '';
@@ -1163,9 +1616,9 @@ function wp_widget_rss_output( $rss, $args = array() ) {
                        }
 
                        if ( $link == '' ) {
                        }
 
                        if ( $link == '' ) {
-                               echo "<li>$title{$date}{$summary}{$author}</li>"; 
+                               echo "<li>$title{$date}{$summary}{$author}</li>";
                        } else {
                        } else {
-                               echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>"; 
+                               echo "<li><a class='rsswidget' href='$link' title='$desc'>$title</a>{$date}{$summary}{$author}</li>";
                        }
 }
                echo '</ul>';
                        }
 }
                echo '</ul>';
@@ -1174,6 +1627,13 @@ function wp_widget_rss_output( $rss, $args = array() ) {
        }
 }
 
        }
 }
 
+/**
+ * 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;
 function wp_widget_rss_control($widget_args) {
        global $wp_registered_widgets;
        static $updated = false;
@@ -1188,7 +1648,7 @@ function wp_widget_rss_control($widget_args) {
                $options = array();
 
        $urls = array();
                $options = array();
 
        $urls = array();
-       foreach ( $options as $option )
+       foreach ( (array) $options as $option )
                if ( isset($option['url']) )
                        $urls[$option['url']] = true;
 
                if ( isset($option['url']) )
                        $urls[$option['url']] = true;
 
@@ -1201,7 +1661,7 @@ function wp_widget_rss_control($widget_args) {
                else
                        $this_sidebar = array();
 
                else
                        $this_sidebar = array();
 
-               foreach ( $this_sidebar as $_widget_id ) {
+               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.
                        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.
@@ -1237,10 +1697,25 @@ function wp_widget_rss_control($widget_args) {
        wp_widget_rss_form( compact( 'number', 'title', 'url', 'items', 'error', 'show_summary', 'show_author', 'show_date' ) );
 }
 
        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 ) {
 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 );
        $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 );
        $number = attribute_escape( $number );
        $title  = attribute_escape( $title );
        $url    = attribute_escape( $url );
@@ -1309,7 +1784,22 @@ function wp_widget_rss_form( $args, $inputs = null ) {
        endforeach;
 }
 
        endforeach;
 }
 
-// Expects unescaped data
+/**
+ * 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 )
 function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
        $items = (int) $widget_rss['items'];
        if ( $items < 1 || 20 < $items )
@@ -1338,6 +1828,11 @@ function wp_widget_rss_process( $widget_rss, $check_feed = true ) {
        return compact( 'title', 'url', 'link', 'items', 'error', 'show_summary', 'show_author', 'show_date' );
 }
 
        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();
 function wp_widget_rss_register() {
        if ( !$options = get_option('widget_rss') )
                $options = array();
@@ -1346,7 +1841,7 @@ function wp_widget_rss_register() {
        $name = __('RSS');
 
        $id = false;
        $name = __('RSS');
 
        $id = false;
-       foreach ( array_keys($options) as $o ) {
+       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;
                // Old widgets can have null values for some reason
                if ( !isset($options[$o]['url']) || !isset($options[$o]['title']) || !isset($options[$o]['items']) )
                        continue;
@@ -1362,6 +1857,13 @@ function wp_widget_rss_register() {
        }
 }
 
        }
 }
 
+/**
+ * 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');
 function wp_widget_tag_cloud($args) {
        extract($args);
        $options = get_option('widget_tag_cloud');
@@ -1373,10 +1875,17 @@ function wp_widget_tag_cloud($args) {
        echo $after_widget;
 }
 
        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');
 
 function wp_widget_tag_cloud_control() {
        $options = $newoptions = get_option('widget_tag_cloud');
 
-       if ( $_POST['tag-cloud-submit'] ) {
+       if ( isset($_POST['tag-cloud-submit']) ) {
                $newoptions['title'] = strip_tags(stripslashes($_POST['tag-cloud-title']));
        }
 
                $newoptions['title'] = strip_tags(stripslashes($_POST['tag-cloud-title']));
        }
 
@@ -1394,6 +1903,14 @@ function wp_widget_tag_cloud_control() {
 <?php
 }
 
 <?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;
 function wp_widgets_init() {
        if ( !is_blog_installed() )
                return;
@@ -1438,11 +1955,19 @@ function wp_widgets_init() {
 
 add_action('init', 'wp_widgets_init', 1);
 
 
 add_action('init', 'wp_widgets_init', 1);
 
-/* Pattern for multi-widget (allows multiple instances such as the text widget).
-
-// Displays widget on blag
-// $widget_args: number
-//    number: which of the several widgets of this type do we mean
+/*
+ * 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) )
 function widget_many( $args, $widget_args = 1 ) {
        extract( $args, EXTR_SKIP );
        if ( is_numeric($widget_args) )
@@ -1462,9 +1987,13 @@ function widget_many( $args, $widget_args = 1 ) {
        echo $after_widget;
 }
 
        echo $after_widget;
 }
 
-// Displays form for a particular instance of the widget.  Also updates the data after a POST submit
-// $widget_args: number
-//    number: which of the several widgets of this type do we mean
+/**
+ * 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
 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
@@ -1532,7 +2061,9 @@ function widget_many_control( $widget_args = 1 ) {
 <?php
 }
 
 <?php
 }
 
-// Registers each instance of our widget on startup
+/**
+ * Registers each instance of our widget on startup.
+ * /
 function widget_many_register() {
        if ( !$options = get_option('widget_many') )
                $options = array();
 function widget_many_register() {
        if ( !$options = get_option('widget_many') )
                $options = array();
@@ -1562,7 +2093,7 @@ function widget_many_register() {
 }
 
 // This is important
 }
 
 // This is important
-add_action( 'widgets_init', 'widget_many_register' )
+add_action( 'widgets_init', 'widget_many_register' );
 
 */
 
 
 */
 
index 2be48d5a6069385da8edd354cbaabbdbc5992335..eb131473304902952b007864f457b57060261f59 100644 (file)
@@ -5,6 +5,7 @@
   <options>
     <clientType>WordPress</clientType>
        <supportsKeywords>Yes</supportsKeywords>
   <options>
     <clientType>WordPress</clientType>
        <supportsKeywords>Yes</supportsKeywords>
+       <supportsGetTags>Yes</supportsGetTags>
   </options>
   
   <weblog>
   </options>
   
   <weblog>
index db44afe5d03aeaef2a1c5bb1c8e81172ed07740a..ccd3a6ef041a4e458de06db32d8f242a96780468 100644 (file)
@@ -38,7 +38,7 @@ define('ARRAY_N', 'ARRAY_N', false);
  * WordPress Database Access Abstraction Object
  *
  * It is possible to replace this class with your own
  * WordPress Database Access Abstraction Object
  *
  * It is possible to replace this class with your own
- * by setting the $wpdb global variable in wp-content/wpdb.php
+ * by setting the $wpdb global variable in wp-content/db.php
  * file with your class. You can name it wpdb also, since
  * this file will not be included, if the other file is
  * available.
  * file with your class. You can name it wpdb also, since
  * this file will not be included, if the other file is
  * available.
@@ -332,19 +332,19 @@ class wpdb {
 
                $this->ready = true;
 
 
                $this->ready = true;
 
-               if ( $this->supports_collation() ) {
+               if ( $this->has_cap( 'collation' ) ) {
                        $collation_query = '';
                        if ( !empty($this->charset) ) {
                                $collation_query = "SET NAMES '{$this->charset}'";
                                if (!empty($this->collate) )
                                        $collation_query .= " COLLATE '{$this->collate}'";
                        }
                        $collation_query = '';
                        if ( !empty($this->charset) ) {
                                $collation_query = "SET NAMES '{$this->charset}'";
                                if (!empty($this->collate) )
                                        $collation_query .= " COLLATE '{$this->collate}'";
                        }
-                       
+
                        if ( !empty($collation_query) )
                                $this->query($collation_query);
                        if ( !empty($collation_query) )
                                $this->query($collation_query);
-                       
+
                }
                }
-               
+
                $this->select($dbname);
        }
 
                $this->select($dbname);
        }
 
@@ -378,7 +378,7 @@ class wpdb {
                $old_prefix = $this->prefix;
                $this->prefix = $prefix;
 
                $old_prefix = $this->prefix;
                $this->prefix = $prefix;
 
-               foreach ( $this->tables as $table )
+               foreach ( (array) $this->tables as $table )
                        $this->$table = $this->prefix . $table;
 
                if ( defined('CUSTOM_USER_TABLE') )
                        $this->$table = $this->prefix . $table;
 
                if ( defined('CUSTOM_USER_TABLE') )
@@ -410,7 +410,7 @@ class wpdb {
 <ul>
 <li>Are you sure it exists?</li>
 <li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
 <ul>
 <li>Are you sure it exists?</li>
 <li>Does the user <code>%2$s</code> have permission to use the <code>%1$s</code> database?</li>
-<li>On some systems the name of your database is prefixed with your username, so it would be like username_wordpress. Could that be the problem?</li>
+<li>On some systems the name of your database is prefixed with your username, so it would be like <code>username_%1$s</code>. Could that be the problem?</li>
 </ul>
 <p>If you don\'t know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER));
                        return;
 </ul>
 <p>If you don\'t know how to setup a database you should <strong>contact your host</strong>. If all else fails you may find help at the <a href="http://wordpress.org/support/">WordPress Support Forums</a>.</p>'/*/WP_I18N_DB_SELECT_DB*/, $db, DB_USER));
                        return;
@@ -497,7 +497,7 @@ class wpdb {
                        $log_error = false;
 
                $log_file = @ini_get('error_log');
                        $log_error = false;
 
                $log_file = @ini_get('error_log');
-               if ( !empty($log_file) && ('syslog' != $log_file) && !is_writable($log_file) )
+               if ( !empty($log_file) && ('syslog' != $log_file) && !@is_writable($log_file) )
                        $log_error = false;
 
                if ( $log_error )
                        $log_error = false;
 
                if ( $log_error )
@@ -617,7 +617,7 @@ class wpdb {
                        return false;
                }
 
                        return false;
                }
 
-               if ( preg_match("/^\\s*(insert|delete|update|replace) /i",$query) ) {
+               if ( preg_match("/^\\s*(insert|delete|update|replace|alter) /i",$query) ) {
                        $this->rows_affected = mysql_affected_rows($this->dbh);
                        // Take note of the insert_id
                        if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
                        $this->rows_affected = mysql_affected_rows($this->dbh);
                        // Take note of the insert_id
                        if ( preg_match("/^\\s*(insert|replace) /i",$query) ) {
@@ -677,7 +677,7 @@ class wpdb {
        function update($table, $data, $where){
                $data = add_magic_quotes($data);
                $bits = $wheres = array();
        function update($table, $data, $where){
                $data = add_magic_quotes($data);
                $bits = $wheres = array();
-               foreach ( array_keys($data) as $k )
+               foreach ( (array) array_keys($data) as $k )
                        $bits[] = "`$k` = '$data[$k]'";
 
                if ( is_array( $where ) )
                        $bits[] = "`$k` = '$data[$k]'";
 
                if ( is_array( $where ) )
@@ -685,7 +685,7 @@ class wpdb {
                                $wheres[] = "$c = '" . $this->escape( $v ) . "'";
                else
                        return false;
                                $wheres[] = "$c = '" . $this->escape( $v ) . "'";
                else
                        return false;
-                       
+
                return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) );
        }
 
                return $this->query( "UPDATE $table SET " . implode( ', ', $bits ) . ' WHERE ' . implode( ' AND ', $wheres ) );
        }
 
@@ -805,7 +805,7 @@ class wpdb {
                        // Return an integer-keyed array of...
                        if ( $this->last_result ) {
                                $i = 0;
                        // Return an integer-keyed array of...
                        if ( $this->last_result ) {
                                $i = 0;
-                               foreach( $this->last_result as $row ) {
+                               foreach( (array) $this->last_result as $row ) {
                                        if ( $output == ARRAY_N ) {
                                                // ...integer-keyed row arrays
                                                $new_array[$i] = array_values( get_object_vars( $row ) );
                                        if ( $output == ARRAY_N ) {
                                                // ...integer-keyed row arrays
                                                $new_array[$i] = array_values( get_object_vars( $row ) );
@@ -833,7 +833,7 @@ class wpdb {
                if ( $this->col_info ) {
                        if ( $col_offset == -1 ) {
                                $i = 0;
                if ( $this->col_info ) {
                        if ( $col_offset == -1 ) {
                                $i = 0;
-                               foreach($this->col_info as $col ) {
+                               foreach( (array) $this->col_info as $col ) {
                                        $new_array[$i] = $col->{$info_type};
                                        $i++;
                                }
                                        $new_array[$i] = $col->{$info_type};
                                        $i++;
                                }
@@ -904,8 +904,7 @@ class wpdb {
        {
                global $wp_version;
                // Make sure the server has MySQL 4.0
        {
                global $wp_version;
                // Make sure the server has MySQL 4.0
-               $mysql_version = preg_replace('|[^0-9\.]|', '', @mysql_get_server_info($this->dbh));
-               if ( version_compare($mysql_version, '4.0.0', '<') )
+               if ( version_compare($this->db_version(), '4.0.0', '<') )
                        return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
        }
 
                        return new WP_Error('database_version',sprintf(__('<strong>ERROR</strong>: WordPress %s requires MySQL 4.0.0 or higher'), $wp_version));
        }
 
@@ -920,7 +919,27 @@ class wpdb {
         */
        function supports_collation()
        {
         */
        function supports_collation()
        {
-               return ( version_compare(mysql_get_server_info($this->dbh), '4.1.0', '>=') );
+               return $this->has_cap( 'collation' );
+       }
+
+       /**
+        * 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)
+        * @return bool
+        */
+       function has_cap( $db_cap ) {
+               $version = $this->db_version();
+
+               switch ( strtolower( $db_cap ) ) :
+               case 'collation' :    // @since 2.5.0
+               case 'group_concat' : // @since 2.7
+               case 'subqueries' :   // @since 2.7
+                       return version_compare($version, '4.1', '>=');
+                       break;
+               endswitch;
+
+               return false;
        }
 
        /**
        }
 
        /**
@@ -939,29 +958,34 @@ class wpdb {
                        return '';
 
                $bt = debug_backtrace();
                        return '';
 
                $bt = debug_backtrace();
-               $caller = '';
+               $caller = array();
 
 
-               foreach ( $bt as $trace ) {
-                       if ( @$trace['class'] == __CLASS__ )
-                               continue;
-                       elseif ( strtolower(@$trace['function']) == 'call_user_func_array' )
-                               continue;
-                       elseif ( strtolower(@$trace['function']) == 'apply_filters' )
+               $bt = array_reverse( $bt );
+               foreach ( (array) $bt as $call ) {
+                       if ( @$call['class'] == __CLASS__ )
                                continue;
                                continue;
-                       elseif ( strtolower(@$trace['function']) == 'do_action' )
-                               continue;
-
-                       $caller = $trace['function'];
-                       break;
+                       $function = $call['function'];
+                       if ( isset( $call['class'] ) )
+                               $function = $call['class'] . "->$function";
+                       $caller[] = $function;
                }
                }
+               $caller = join( ', ', $caller );
+
                return $caller;
        }
 
                return $caller;
        }
 
+       /**
+        * The database version number
+        * @return false|string false on failure, version number on success
+        */
+       function db_version() {
+               return preg_replace('/[^0-9.].*/', '', mysql_get_server_info( $this->dbh ));
+       }
 }
 
 if ( ! isset($wpdb) ) {
        /**
 }
 
 if ( ! isset($wpdb) ) {
        /**
-        * WordPress Database Object, if it isn't set already in wp-content/wpdb.php
+        * WordPress Database Object, if it isn't set already in wp-content/db.php
         * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database
         * @since 0.71
         */
         * @global object $wpdb Creates a new wpdb object based on wp-config.php Constants for the database
         * @since 0.71
         */
index e43903d80dc06e801b3931d21ad8ecba2b7c4e33..3843223c61d04be3390f817f46a0500af2c97164 100644 (file)
 <?php
 <?php
+/**
+ * WordPress Diff bastard child of old MediaWiki Diff Formatter.
+ *
+ * Basically all that remains is the table structure and some method names.
+ *
+ * @package WordPress
+ * @subpackage Diff
+ */
 
 if ( !class_exists( 'Text_Diff' ) ) {
 
 if ( !class_exists( 'Text_Diff' ) ) {
+       /** Text_Diff class */
        require( dirname(__FILE__).'/Text/Diff.php' );
        require( dirname(__FILE__).'/Text/Diff.php' );
+       /** Text_Diff_Renderer class */
        require( dirname(__FILE__).'/Text/Diff/Renderer.php' );
        require( dirname(__FILE__).'/Text/Diff/Renderer.php' );
+       /** Text_Diff_Renderer_inline class */
        require( dirname(__FILE__).'/Text/Diff/Renderer/inline.php' );
 }
 
        require( dirname(__FILE__).'/Text/Diff/Renderer/inline.php' );
 }
 
-
-/* Descendent of a bastard child of piece of an old MediaWiki Diff Formatter
+/**
+ * Table renderer to display the diff lines.
  *
  *
- * Basically all that remains is the table structure and some method names.
+ * @since 2.6.0
+ * @uses Text_Diff_Renderer Extends
  */
  */
-
 class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
 class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
+
+       /**
+        * @see Text_Diff_Renderer::_leading_context_lines
+        * @var int
+        * @access protected
+        * @since 2.6.0
+        */
        var $_leading_context_lines  = 10000;
        var $_leading_context_lines  = 10000;
+
+       /**
+        * @see Text_Diff_Renderer::_trailing_context_lines
+        * @var int
+        * @access protected
+        * @since 2.6.0
+        */
        var $_trailing_context_lines = 10000;
        var $_trailing_context_lines = 10000;
+
+       /**
+        * {@internal Missing Description}}
+        *
+        * @var float
+        * @access protected
+        * @since 2.6.0
+        */
        var $_diff_threshold = 0.6;
 
        var $_diff_threshold = 0.6;
 
+       /**
+        * Inline display helper object name.
+        *
+        * @var string
+        * @access protected
+        * @since 2.6.0
+        */
        var $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
 
        var $inline_diff_renderer = 'WP_Text_Diff_Renderer_inline';
 
+       /**
+        * PHP4 Constructor - Call parent constructor with params array.
+        *
+        * This will set class properties based on the key value pairs in the array.
+        *
+        * @since unknown
+        *
+        * @param array $params
+        */
        function Text_Diff_Renderer_Table( $params = array() ) {
                $parent = get_parent_class($this);
                $this->$parent( $params );
        }
 
        function Text_Diff_Renderer_Table( $params = array() ) {
                $parent = get_parent_class($this);
                $this->$parent( $params );
        }
 
+       /**
+        * @ignore
+        *
+        * @param string $header
+        * @return string
+        */
        function _startBlock( $header ) {
                return '';
        }
 
        function _startBlock( $header ) {
                return '';
        }
 
+       /**
+        * @ignore
+        *
+        * @param array $lines
+        * @param string $prefix
+        */
        function _lines( $lines, $prefix=' ' ) {
        }
 
        function _lines( $lines, $prefix=' ' ) {
        }
 
-       // HTML-escape parameter before calling this
+       /**
+        * @ignore
+        *
+        * @param string $line HTML-escape the value.
+        * @return string
+        */
        function addedLine( $line ) {
                return "<td>+</td><td class='diff-addedline'>{$line}</td>";
        }
 
        function addedLine( $line ) {
                return "<td>+</td><td class='diff-addedline'>{$line}</td>";
        }
 
-       // HTML-escape parameter before calling this
+       /**
+        * @ignore
+        *
+        * @param string $line HTML-escape the value.
+        * @return string
+        */
        function deletedLine( $line ) {
                return "<td>-</td><td class='diff-deletedline'>{$line}</td>";
        }
 
        function deletedLine( $line ) {
                return "<td>-</td><td class='diff-deletedline'>{$line}</td>";
        }
 
-       // HTML-escape parameter before calling this
+       /**
+        * @ignore
+        *
+        * @param string $line HTML-escape the value.
+        * @return string
+        */
        function contextLine( $line ) {
                return "<td> </td><td class='diff-context'>{$line}</td>";
        }
 
        function contextLine( $line ) {
                return "<td> </td><td class='diff-context'>{$line}</td>";
        }
 
+       /**
+        * @ignore
+        *
+        * @return string
+        */
        function emptyLine() {
                return '<td colspan="2">&nbsp;</td>';
        }
 
        function emptyLine() {
                return '<td colspan="2">&nbsp;</td>';
        }
 
+       /**
+        * @ignore
+        * @access private
+        *
+        * @param array $lines
+        * @param bool $encode
+        * @return string
+        */
        function _added( $lines, $encode = true ) {
                $r = '';
                foreach ($lines as $line) {
        function _added( $lines, $encode = true ) {
                $r = '';
                foreach ($lines as $line) {
@@ -60,6 +149,14 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
                return $r;
        }
 
                return $r;
        }
 
+       /**
+        * @ignore
+        * @access private
+        *
+        * @param array $lines
+        * @param bool $encode
+        * @return string
+        */
        function _deleted( $lines, $encode = true ) {
                $r = '';
                foreach ($lines as $line) {
        function _deleted( $lines, $encode = true ) {
                $r = '';
                foreach ($lines as $line) {
@@ -70,6 +167,14 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
                return $r;
        }
 
                return $r;
        }
 
+       /**
+        * @ignore
+        * @access private
+        *
+        * @param array $lines
+        * @param bool $encode
+        * @return string
+        */
        function _context( $lines, $encode = true ) {
                $r = '';
                foreach ($lines as $line) {
        function _context( $lines, $encode = true ) {
                $r = '';
                foreach ($lines as $line) {
@@ -81,9 +186,19 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
                return $r;
        }
 
                return $r;
        }
 
-       // Process changed lines to do word-by-word diffs for extra highlighting (TRAC style)
-       // sometimes these lines can actually be deleted or added rows - we do additional processing
-       // to figure that out
+       /**
+        * Process changed lines to do word-by-word diffs for extra highlighting.
+        *
+        * (TRAC style) sometimes these lines can actually be deleted or added rows.
+        * We do additional processing to figure that out
+        *
+        * @access private
+        * @since 2.6.0
+        *
+        * @param array $orig
+        * @param array $final
+        * @return string
+        */
        function _changed( $orig, $final ) {
                $r = '';
 
        function _changed( $orig, $final ) {
                $r = '';
 
@@ -151,10 +266,20 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
                return $r;
        }
 
                return $r;
        }
 
-       // Takes changed blocks and matches which rows in orig turned into which rows in final.
-       // Returns
-       //      *_matches ( which rows match with which )
-       //      *_rows ( order of rows in each column interleaved with blank rows as necessary )
+       /**
+        * Takes changed blocks and matches which rows in orig turned into which rows in final.
+        *
+        * Returns
+        *      *_matches ( which rows match with which )
+        *      *_rows ( order of rows in each column interleaved with blank rows as
+        *              necessary )
+        *
+        * @since 2.6.0
+        *
+        * @param unknown_type $orig
+        * @param unknown_type $final
+        * @return unknown
+        */
        function interleave_changed_lines( $orig, $final ) {
 
                // Contains all pairwise string comparisons.  Keys are such that this need only be a one dimensional array.
        function interleave_changed_lines( $orig, $final ) {
 
                // Contains all pairwise string comparisons.  Keys are such that this need only be a one dimensional array.
@@ -279,8 +404,15 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
 */
        }
 
 */
        }
 
-
-       // Computes a number that is intended to reflect the "distance" between two strings.
+       /**
+        * Computes a number that is intended to reflect the "distance" between two strings.
+        *
+        * @since 2.6.0
+        *
+        * @param string $string1
+        * @param string $string2
+        * @return int
+        */
        function compute_string_distance( $string1, $string2 ) {
                // Vectors containing character frequency for all chars in each string
                $chars1 = count_chars($string1);
        function compute_string_distance( $string1, $string2 ) {
                // Vectors containing character frequency for all chars in each string
                $chars1 = count_chars($string1);
@@ -297,15 +429,36 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
                return $difference / strlen($string1);
        }
 
                return $difference / strlen($string1);
        }
 
+       /**
+        * @ignore
+        * @since 2.6.0
+        *
+        * @param int $a
+        * @param int $b
+        * @return int
+        */
        function difference( $a, $b ) {
                return abs( $a - $b );
        }
 
 }
 
        function difference( $a, $b ) {
                return abs( $a - $b );
        }
 
 }
 
-// Better word splitting than the PEAR package provides
+/**
+ * Better word splitting than the PEAR package provides.
+ *
+ * @since 2.6.0
+ * @uses Text_Diff_Renderer_inline Extends
+ */
 class WP_Text_Diff_Renderer_inline extends Text_Diff_Renderer_inline {
 
 class WP_Text_Diff_Renderer_inline extends Text_Diff_Renderer_inline {
 
+       /**
+        * @ignore
+        * @since 2.6.0
+        *
+        * @param string $string
+        * @param string $newlineEscape
+        * @return string
+        */
        function _splitOnWords($string, $newlineEscape = "\n") {
                $string = str_replace("\0", '', $string);
                $words  = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
        function _splitOnWords($string, $newlineEscape = "\n") {
                $string = str_replace("\0", '', $string);
                $words  = preg_split( '/([^\w])/u', $string, -1, PREG_SPLIT_DELIM_CAPTURE );
index 423edf54b4d1b81df0b4cf56ae9bf5176a163728..8e9768f8c386a2bc324a97b7d6d98a0f0af2381c 100644 (file)
@@ -26,7 +26,7 @@ if ( file_exists( ABSPATH . 'wp-config.php') ) {
        /** The config file resides in ABSPATH */
        require_once( ABSPATH . 'wp-config.php' );
 
        /** The config file resides in ABSPATH */
        require_once( ABSPATH . 'wp-config.php' );
 
-} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) ) {
+} elseif ( file_exists( dirname(ABSPATH) . '/wp-config.php' ) && ! file_exists( dirname(ABSPATH) . '/wp-load.php' ) ) {
 
        /** The config file resides one level below ABSPATH */
        require_once( dirname(ABSPATH) . '/wp-config.php' );
 
        /** The config file resides one level below ABSPATH */
        require_once( dirname(ABSPATH) . '/wp-config.php' );
index 265a223f981c4426d658b2113e26f58edfad7009..dab6324f4bb891c9e968ca94b0b194001964fcad 100644 (file)
@@ -18,15 +18,14 @@ if ( force_ssl_admin() && !is_ssl() ) {
                exit();
        } else {
                wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
                exit();
        } else {
                wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
-               exit();                 
+               exit();
        }
 }
 
 /**
        }
 }
 
 /**
- * login_header() - Outputs the header for the login page
+ * Outputs the header for the login page.
  *
  *
- * @package WordPress
- * @uses do_action() Calls the 'login_head' for outputting HTML in the Login
+ * @uses do_action() Calls the 'login_head' for outputting HTML in the Log In
  *             header.
  * @uses apply_filters() Calls 'login_headerurl' for the top login link.
  * @uses apply_filters() Calls 'login_headertitle' for the top login title.
  *             header.
  * @uses apply_filters() Calls 'login_headerurl' for the top login link.
  * @uses apply_filters() Calls 'login_headertitle' for the top login title.
@@ -34,12 +33,12 @@ if ( force_ssl_admin() && !is_ssl() ) {
  *             header.
  * @uses $error The error global, which is checked for displaying errors.
  *
  *             header.
  * @uses $error The error global, which is checked for displaying errors.
  *
- * @param string $title Optional. WordPress Login Page title to display in
+ * @param string $title Optional. WordPress Log In Page title to display in
  *             <title/> element.
  * @param string $message Optional. Message to display in header.
  * @param WP_Error $wp_error Optional. WordPress Error Object
  */
  *             <title/> element.
  * @param string $message Optional. Message to display in header.
  * @param WP_Error $wp_error Optional. WordPress Error Object
  */
-function login_header($title = 'Login', $message = '', $wp_error = '') {
+function login_header($title = 'Log In', $message = '', $wp_error = '') {
        global $error;
 
        if ( empty($wp_error) )
        global $error;
 
        if ( empty($wp_error) )
@@ -87,9 +86,7 @@ function login_header($title = 'Login', $message = '', $wp_error = '') {
 } // End of login_header()
 
 /**
 } // End of login_header()
 
 /**
- * retrieve_password() - Handles sending password retrieval email to user
- *
- * {@internal Missing Long Description}}
+ * Handles sending password retrieval email to user.
  *
  * @uses $wpdb WordPress Database object
  *
  *
  * @uses $wpdb WordPress Database object
  *
@@ -103,7 +100,7 @@ function retrieve_password() {
        if ( empty( $_POST['user_login'] ) && empty( $_POST['user_email'] ) )
                $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
 
        if ( empty( $_POST['user_login'] ) && empty( $_POST['user_email'] ) )
                $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
 
-       if ( strstr($_POST['user_login'], '@') ) {
+       if ( strpos($_POST['user_login'], '@') ) {
                $user_data = get_user_by_email(trim($_POST['user_login']));
                if ( empty($user_data) )
                        $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
                $user_data = get_user_by_email(trim($_POST['user_login']));
                if ( empty($user_data) )
                        $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
@@ -135,7 +132,7 @@ function retrieve_password() {
                return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
        else if ( is_wp_error($allow) )
                return $allow;
                return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
        else if ( is_wp_error($allow) )
                return $allow;
-               
+
        $key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
        if ( empty($key) ) {
                // Generate something random for a key...
        $key = $wpdb->get_var($wpdb->prepare("SELECT user_activation_key FROM $wpdb->users WHERE user_login = %s", $user_login));
        if ( empty($key) ) {
                // Generate something random for a key...
@@ -157,9 +154,7 @@ function retrieve_password() {
 }
 
 /**
 }
 
 /**
- * reset_password() - Handles resetting the user's password
- *
- * {@internal Missing Long Description}}
+ * Handles resetting the user's password.
  *
  * @uses $wpdb WordPress Database object
  *
  *
  * @uses $wpdb WordPress Database object
  *
@@ -190,20 +185,13 @@ function reset_password($key) {
        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>');
 
        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>');
 
-       // send a copy of password change notification to the admin
-       // but check to see if it's the admin whose password we're changing, and skip this
-       if ( $user->user_email != get_option('admin_email') ) {
-               $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
-               wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message);
-       }
+       wp_password_change_notification($user);
 
        return true;
 }
 
 /**
 
        return true;
 }
 
 /**
- * register_new_user() - Handles registering a new user
- *
- * {@internal Missing Long Description}}
+ * Handles registering a new user.
  *
  * @param string $user_login User's username for logging in
  * @param string $user_email User's email address to send password and add
  *
  * @param string $user_login User's username for logging in
  * @param string $user_email User's email address to send password and add
@@ -284,7 +272,7 @@ $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
 switch ($action) {
 
 case 'logout' :
 switch ($action) {
 
 case 'logout' :
-
+       check_admin_referer('log-out');
        wp_logout();
 
        $redirect_to = 'wp-login.php?loggedout=true';
        wp_logout();
 
        $redirect_to = 'wp-login.php?loggedout=true';
@@ -306,16 +294,19 @@ case 'retrievepassword' :
                }
        }
 
                }
        }
 
-       if ( 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
+       if ( isset($_GET['error']) && 'invalidkey' == $_GET['error'] ) $errors->add('invalidkey', __('Sorry, that key does not appear to be valid.'));
 
        do_action('lost_password');
        login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $errors);
 
        do_action('lost_password');
        login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or e-mail address. You will receive a new password via e-mail.') . '</p>', $errors);
+
+       $user_login = isset($_POST['user_login']) ? stripslashes($_POST['user_login']) : '';
+
 ?>
 
 <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(stripslashes($_POST['user_login'])); ?>" size="20" tabindex="10" /></label>
+               <input type="text" name="user_login" id="user_login" class="input" value="<?php echo attribute_escape($user_login); ?>" size="20" tabindex="10" /></label>
        </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>
 <?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>
@@ -332,7 +323,7 @@ case 'retrievepassword' :
 
 </div>
 
 
 </div>
 
-<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
+<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&larr; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
 
 <script type="text/javascript">
 try{document.getElementById('user_login').focus();}catch(e){}
 
 <script type="text/javascript">
 try{document.getElementById('user_login').focus();}catch(e){}
@@ -400,7 +391,7 @@ case 'register' :
 
 </div>
 
 
 </div>
 
-<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
+<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&larr; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
 
 <script type="text/javascript">
 try{document.getElementById('user_login').focus();}catch(e){}
 
 <script type="text/javascript">
 try{document.getElementById('user_login').focus();}catch(e){}
@@ -412,15 +403,30 @@ break;
 
 case 'login' :
 default:
 
 case 'login' :
 default:
-       if ( isset( $_REQUEST['redirect_to'] ) )
+       $secure_cookie = '';
+
+       // If the user wants ssl but the session is not ssl, force a secure cookie.
+       if ( !empty($_POST['log']) && !force_ssl_admin() ) {
+               $user_name = sanitize_user($_POST['log']);
+               if ( $user = get_userdatabylogin($user_name) ) {
+                       if ( get_user_option('use_ssl', $user->ID) ) {
+                               $secure_cookie = true;
+                               force_ssl_admin(true);
+                       }
+               }
+       }
+
+       if ( isset( $_REQUEST['redirect_to'] ) ) {
                $redirect_to = $_REQUEST['redirect_to'];
                $redirect_to = $_REQUEST['redirect_to'];
-       else
+               // Redirect to https if user wants ssl
+               if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
+                       $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
+       } else {
                $redirect_to = admin_url();
                $redirect_to = admin_url();
+       }
 
 
-       if ( is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
+       if ( !$secure_cookie && is_ssl() && force_ssl_login() && !force_ssl_admin() && ( 0 !== strpos($redirect_to, 'https') ) && ( 0 === strpos($redirect_to, 'http') ) )
                $secure_cookie = false;
                $secure_cookie = false;
-       else
-               $secure_cookie = '';
 
        $user = wp_signon('', $secure_cookie);
 
 
        $user = wp_signon('', $secure_cookie);
 
@@ -445,19 +451,22 @@ default:
 
        // Some parts of this script use the main login form to display a message
        if              ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] )                     $errors->add('loggedout', __('You are now logged out.'), 'message');
 
        // Some parts of this script use the main login form to display a message
        if              ( isset($_GET['loggedout']) && TRUE == $_GET['loggedout'] )                     $errors->add('loggedout', __('You are now logged out.'), 'message');
-       elseif  ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $errors->add('registerdiabled', __('User registration is currently not allowed.'));
+       elseif  ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] ) $errors->add('registerdisabled', __('User registration is currently not allowed.'));
        elseif  ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )      $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
        elseif  ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )      $errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
        elseif  ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )   $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
 
        elseif  ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )      $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
        elseif  ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )      $errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
        elseif  ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )   $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
 
-       login_header(__('Login'), '', $errors);
+       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'])) : '';
 ?>
 
 ?>
 
-<form name="loginform" id="loginform" action="<?php echo site_url('wp-login.php', 'login_post') ?>" method="post">
 <?php if ( !isset($_GET['checkemail']) || !in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
 <?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 />
        <p>
                <label><?php _e('Username') ?><br />
-               <input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
+               <input type="text" name="log" id="user_login" class="input" value="<?php echo $user_login; ?>" size="20" tabindex="10" /></label>
        </p>
        <p>
                <label><?php _e('Password') ?><br />
        </p>
        <p>
                <label><?php _e('Password') ?><br />
@@ -470,10 +479,8 @@ default:
                <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
                <input type="hidden" name="testcookie" value="1" />
        </p>
                <input type="hidden" name="redirect_to" value="<?php echo attribute_escape($redirect_to); ?>" />
                <input type="hidden" name="testcookie" value="1" />
        </p>
-<?php else : ?>
-       <p>&nbsp;</p>
-<?php endif; ?>
 </form>
 </form>
+<?php endif; ?>
 
 <p id="nav">
 <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
 
 <p id="nav">
 <?php if ( isset($_GET['checkemail']) && in_array( $_GET['checkemail'], array('confirm', 'newpass') ) ) : ?>
@@ -487,10 +494,19 @@ default:
 
 </div>
 
 
 </div>
 
-<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&laquo; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
+<p id="backtoblog"><a href="<?php bloginfo('url'); ?>/" title="<?php _e('Are you lost?') ?>"><?php printf(__('&larr; Back to %s'), get_bloginfo('title', 'display' )); ?></a></p>
 
 <script type="text/javascript">
 
 <script type="text/javascript">
+<?php if ( $user_login ) { ?>
+setTimeout( function(){ try{
+d = document.getElementById('user_pass');
+d.value = '';
+d.focus();
+} catch(e){}
+}, 200);
+<?php } else { ?>
 try{document.getElementById('user_login').focus();}catch(e){}
 try{document.getElementById('user_login').focus();}catch(e){}
+<?php } ?>
 </script>
 </body>
 </html>
 </script>
 </body>
 </html>
@@ -498,4 +514,4 @@ try{document.getElementById('user_login').focus();}catch(e){}
 
 break;
 } // end action switch
 
 break;
 } // end action switch
-?>
\ No newline at end of file
+?>
index 52d05cb8d3f130337b87305ce3651c59bef2972c..2966dc3642cfb0b0553e37ee6067905523b2e492 100644 (file)
@@ -1,78 +1,81 @@
 <?php
 /**
  * Gets the email message from the user's mailbox to add as
 <?php
 /**
  * Gets the email message from the user's mailbox to add as
- * a WordPress post. Will only run if this is setup and enabled.
+ * a WordPress post. Mailbox connection information must be
+ * configured under Settings > Writing
  *
  * @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');
 
 require(dirname(__FILE__) . '/wp-load.php');
 
-/** Get the POP3 class for 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' );
 
 
-// WTF is this? Use constants instead.
-error_reporting(2037);
-
-$time_difference = get_option('gmt_offset') * 3600;
+$time_difference = absint(get_option('gmt_offset')) * 3600;
 
 $phone_delim = '::';
 
 $pop3 = new POP3();
 
 
 $phone_delim = '::';
 
 $pop3 = new POP3();
 
-if (!$pop3->connect(get_option('mailserver_url'), get_option('mailserver_port')))
-       wp_die(wp_specialchars($pop3->ERROR));
-
-if (!$pop3->user(get_option('mailserver_login')))
-       wp_die(wp_specialchars($pop3->ERROR));
+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();
+               wp_die( ( 0 === $count ) ? __("There doesn't seem to be any new mail.") : wp_specialchars($pop3->ERROR) );
+}
 
 
-$count = $pop3->pass(get_option('mailserver_pass'));
-if (false === $count)
-       wp_die(wp_specialchars($pop3->ERROR));
-if (0 == $count)
-       echo "<p>There doesn't seem to be any new mail.</p>\n"; // will fall-through to end of for loop
-
-for ($i=1; $i <= $count; $i++) :
+for ( $i = 1; $i <= $count; $i++ ) {
 
        $message = $pop3->get($i);
 
 
        $message = $pop3->get($i);
 
+       $bodysignal = false;
+       $boundary = '';
+       $charset = '';
        $content = '';
        $content_type = '';
        $content_transfer_encoding = '';
        $content = '';
        $content_type = '';
        $content_transfer_encoding = '';
-       $boundary = '';
-       $bodysignal = 0;
        $post_author = 1;
        $author_found = false;
        $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
        $post_author = 1;
        $author_found = false;
        $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
-       foreach ($message as $line) :
-               if (strlen($line) < 3) $bodysignal = 1;
-
-               if ($bodysignal) {
+       foreach ($message as $line) {
+               // body signal
+               if ( strlen($line) < 3 )
+                       $bodysignal = true;
+               if ( $bodysignal ) {
                        $content .= $line;
                } else {
                        $content .= $line;
                } else {
-                       if (preg_match('/Content-Type: /i', $line)) {
+                       if ( preg_match('/Content-Type: /i', $line) ) {
                                $content_type = trim($line);
                                $content_type = trim($line);
-                               $content_type = substr($content_type, 14, strlen($content_type)-14);
+                               $content_type = substr($content_type, 14, strlen($content_type) - 14);
                                $content_type = explode(';', $content_type);
                                $content_type = explode(';', $content_type);
+                               if ( ! empty( $content_type[1] ) ) {
+                                       $charset = explode('=', $content_type[1]);
+                                       $charset = ( ! empty( $charset[1] ) ) ? trim($charset[1]) : '';
+                               }
                                $content_type = $content_type[0];
                        }
                                $content_type = $content_type[0];
                        }
-                       if (preg_match('/Content-Transfer-Encoding: /i', $line)) {
+                       if ( preg_match('/Content-Transfer-Encoding: /i', $line) ) {
                                $content_transfer_encoding = trim($line);
                                $content_transfer_encoding = trim($line);
-                               $content_transfer_encoding = substr($content_transfer_encoding, 27, strlen($content_transfer_encoding)-14);
+                               $content_transfer_encoding = substr($content_transfer_encoding, 27, strlen($content_transfer_encoding) - 27);
                                $content_transfer_encoding = explode(';', $content_transfer_encoding);
                                $content_transfer_encoding = $content_transfer_encoding[0];
                        }
                                $content_transfer_encoding = explode(';', $content_transfer_encoding);
                                $content_transfer_encoding = $content_transfer_encoding[0];
                        }
-                       if (($content_type == 'multipart/alternative') && (preg_match('/boundary="/', $line)) && ($boundary == '')) {
+                       if ( ( $content_type == 'multipart/alternative' ) && ( false !== strpos($line, 'boundary="') ) && ( '' == $boundary ) ) {
                                $boundary = trim($line);
                                $boundary = explode('"', $boundary);
                                $boundary = $boundary[1];
                        }
                        if (preg_match('/Subject: /i', $line)) {
                                $subject = trim($line);
                                $boundary = trim($line);
                                $boundary = explode('"', $boundary);
                                $boundary = $boundary[1];
                        }
                        if (preg_match('/Subject: /i', $line)) {
                                $subject = trim($line);
-                               $subject = substr($subject, 9, strlen($subject)-9);
-                               $subject = wp_iso_descrambler($subject);
+                               $subject = substr($subject, 9, strlen($subject) - 9);
                                // Captures any text in the subject before $phone_delim as the subject
                                // Captures any text in the subject before $phone_delim as the subject
+                               if ( function_exists('iconv_mime_decode') ) {
+                                       $subject = iconv_mime_decode($subject, 2, get_option('blog_charset'));
+                               } else {
+                                       $subject = wp_iso_descrambler($subject);
+                               }
                                $subject = explode($phone_delim, $subject);
                                $subject = $subject[0];
                        }
                                $subject = explode($phone_delim, $subject);
                                $subject = $subject[0];
                        }
@@ -86,17 +89,15 @@ for ($i=1; $i <= $count; $i++) :
                                        $author = trim($line);
                                $author = sanitize_email($author);
                                if ( is_email($author) ) {
                                        $author = trim($line);
                                $author = sanitize_email($author);
                                if ( is_email($author) ) {
-                                       echo "Author = {$author} <p>";
+                                       echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
                                        $userdata = get_user_by_email($author);
                                        $userdata = get_user_by_email($author);
-                                       if (!$userdata) {
-                                               $post_author = 1;
+                                       if ( empty($userdata) ) {
                                                $author_found = false;
                                        } else {
                                                $post_author = $userdata->ID;
                                                $author_found = true;
                                        }
                                } else {
                                                $author_found = false;
                                        } else {
                                                $post_author = $userdata->ID;
                                                $author_found = true;
                                        }
                                } else {
-                                       $post_author = 1;
                                        $author_found = false;
                                }
                        }
                                        $author_found = false;
                                }
                        }
@@ -105,7 +106,7 @@ for ($i=1; $i <= $count; $i++) :
                                $ddate = trim($line);
                                $ddate = str_replace('Date: ', '', $ddate);
                                if (strpos($ddate, ',')) {
                                $ddate = trim($line);
                                $ddate = str_replace('Date: ', '', $ddate);
                                if (strpos($ddate, ',')) {
-                                       $ddate = trim(substr($ddate, strpos($ddate, ',')+1, strlen($ddate)));
+                                       $ddate = trim(substr($ddate, strpos($ddate, ',') + 1, strlen($ddate)));
                                }
                                $date_arr = explode(' ', $ddate);
                                $date_time = explode(':', $date_arr[3]);
                                }
                                $date_arr = explode(' ', $ddate);
                                $date_time = explode(':', $date_arr[3]);
@@ -117,8 +118,8 @@ for ($i=1; $i <= $count; $i++) :
                                $ddate_m = $date_arr[1];
                                $ddate_d = $date_arr[0];
                                $ddate_Y = $date_arr[2];
                                $ddate_m = $date_arr[1];
                                $ddate_d = $date_arr[0];
                                $ddate_Y = $date_arr[2];
-                               for ($j=0; $j<12; $j++) {
-                                       if ($ddate_m == $dmonths[$j]) {
+                               for ( $j = 0; $j < 12; $j++ ) {
+                                       if ( $ddate_m == $dmonths[$j] ) {
                                                $ddate_m = $j+1;
                                        }
                                }
                                                $ddate_m = $j+1;
                                        }
                                }
@@ -130,15 +131,12 @@ for ($i=1; $i <= $count; $i++) :
                                $post_date_gmt = gmdate('Y-m-d H:i:s', $ddate_U);
                        }
                }
                                $post_date_gmt = gmdate('Y-m-d H:i:s', $ddate_U);
                        }
                }
-       endforeach;
+       }
 
        // Set $post_status based on $author_found and on author's publish_posts capability
 
        // Set $post_status based on $author_found and on author's publish_posts capability
-       if ($author_found) {
+       if ( $author_found ) {
                $user = new WP_User($post_author);
                $user = new WP_User($post_author);
-               if ($user->has_cap('publish_posts'))
-                       $post_status = 'publish';
-               else
-                       $post_status = 'pending';
+               $post_status = ( $user->has_cap('publish_posts') ) ? 'publish' : 'pending';
        } else {
                // Author not found in DB, set status to pending.  Author already set to admin.
                $post_status = 'pending';
        } else {
                // Author not found in DB, set status to pending.  Author already set to admin.
                $post_status = 'pending';
@@ -146,21 +144,29 @@ for ($i=1; $i <= $count; $i++) :
 
        $subject = trim($subject);
 
 
        $subject = trim($subject);
 
-       if ($content_type == 'multipart/alternative') {
+       if ( $content_type == 'multipart/alternative' ) {
                $content = explode('--'.$boundary, $content);
                $content = $content[2];
                $content = explode('--'.$boundary, $content);
                $content = $content[2];
-               $content = explode('Content-Transfer-Encoding: quoted-printable', $content);
-               $content = strip_tags($content[1], '<img><p><br><i><b><u><em><strong><strike><font><span><div>');
+               // match case-insensitive content-transfer-encoding
+               if ( preg_match( '/Content-Transfer-Encoding: quoted-printable/i', $content, $delim) ) {
+                       $content = explode($delim[0], $content);
+                       $content = $content[1];
+               }
+               $content = strip_tags($content, '<img><p><br><i><b><u><em><strong><strike><font><span><div>');
        }
        $content = trim($content);
 
        }
        $content = trim($content);
 
-       if (stripos($content_transfer_encoding, "quoted-printable") !== false) {
+       if ( false !== stripos($content_transfer_encoding, "quoted-printable") ) {
                $content = quoted_printable_decode($content);
        }
 
                $content = quoted_printable_decode($content);
        }
 
+       if ( function_exists('iconv') && ! empty( $charset ) ) {
+               $content = iconv($charset, get_option('blog_charset'), $content);
+       }
+
        // Captures any text in the body after $phone_delim as the body
        $content = explode($phone_delim, $content);
        // Captures any text in the body after $phone_delim as the body
        $content = explode($phone_delim, $content);
-       $content[1] ? $content = $content[1] : $content = $content[0];
+       $content = empty( $content[1] ) ? $content[0] : $content[1];
 
        $content = trim($content);
 
 
        $content = trim($content);
 
@@ -170,9 +176,7 @@ for ($i=1; $i <= $count; $i++) :
 
        if ($post_title == '') $post_title = $subject;
 
 
        if ($post_title == '') $post_title = $subject;
 
-       if (empty($post_categories)) $post_categories[] = get_option('default_email_category');
-
-       $post_category = $post_categories;
+       $post_category = array(get_option('default_email_category'));
 
        $post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status');
        $post_data = add_magic_quotes($post_data);
 
        $post_data = compact('post_content','post_title','post_date','post_date_gmt','post_author','post_category', 'post_status');
        $post_data = add_magic_quotes($post_data);
@@ -181,26 +185,25 @@ for ($i=1; $i <= $count; $i++) :
        if ( is_wp_error( $post_ID ) )
                echo "\n" . $post_ID->get_error_message();
 
        if ( is_wp_error( $post_ID ) )
                echo "\n" . $post_ID->get_error_message();
 
-       if (!$post_ID) {
-               // we couldn't post, for whatever reason. better move forward to the next email
+       // We couldn't post, for whatever reason. Better move forward to the next email.
+       if ( empty( $post_ID ) )
                continue;
                continue;
-       }
 
        do_action('publish_phone', $post_ID);
 
 
        do_action('publish_phone', $post_ID);
 
-       echo "\n<p><b>Author:</b> " . wp_specialchars($post_author) . "</p>";
-       echo "\n<p><b>Posted title:</b> " . wp_specialchars($post_title) . "<br />";
+       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>';
 
        if(!$pop3->delete($i)) {
 
        if(!$pop3->delete($i)) {
-               echo '<p>Oops '.wp_specialchars($pop3->ERROR).'</p></div>';
+               echo '<p>' . sprintf(__('Oops: %s'), wp_specialchars($pop3->ERROR)) . '</p>';
                $pop3->reset();
                exit;
        } else {
                $pop3->reset();
                exit;
        } else {
-               echo "<p>Mission complete, message <strong>$i</strong> deleted.</p>";
+               echo '<p>' . sprintf(__('Mission complete.  Message <strong>%s</strong> deleted.'), $i) . '</p>';
        }
 
        }
 
-endfor;
+}
 
 $pop3->quit();
 
 
 $pop3->quit();
 
-?>
\ No newline at end of file
+?>
index fac4a8da2e280bb99e376f13a2800fac23107987..3c8f005ff9739a2abf7cd1f54ada280c982e3970 100644 (file)
@@ -1,23 +1,12 @@
 <?php
 /**
 <?php
 /**
- * Outputs the RDF feed using the feed-rdf.php
- * file in wp-includes folder.
- *
- * This file only sets the feed format and includes the
- * feed-rdf.php.
- *
- * This file is no longer used in WordPress and while it is
- * not deprecated now. This file will most likely be
- * deprecated or removed in a later version.
+ * Redirects to the RDF feed
+ * This file is deprecated and only exists for backwards compatibility
  *
  * @package WordPress
  */
 
  *
  * @package WordPress
  */
 
-if (empty($wp)) {
-       require_once('./wp-load.php');
-       wp('feed=rdf');
-}
-
-require (ABSPATH . WPINC . '/feed-rdf.php');
+require( './wp-load.php' );
+wp_redirect( get_bloginfo( 'rdf_url' ), 301 );
 
 ?>
\ No newline at end of file
 
 ?>
\ No newline at end of file
index 705c1f5cc5db7ab1669a0c39eede84222306b5e9..0ae63a2380d2770b7cbe9f210c28e60fd06c55ee 100644 (file)
@@ -1,23 +1,12 @@
 <?php
 /**
 <?php
 /**
- * Outputs the RSS feed RDF format using the feed-rss.php
- * file in wp-includes folder.
- *
- * This file only sets the feed format and includes the
- * feed-rss.php.
- *
- * This file is no longer used in WordPress and while it is
- * not deprecated now. This file will most likely be
- * deprecated or removed in a later version.
+ * Redirects to the RSS feed
+ * This file is deprecated and only exists for backwards compatibility
  *
  * @package WordPress
  */
 
  *
  * @package WordPress
  */
 
-if (empty($wp)) {
-       require_once('./wp-load.php');
-       wp('feed=rss');
-}
-
-require (ABSPATH . WPINC . '/feed-rss.php');
+require( './wp-load.php' );
+wp_redirect( get_bloginfo( 'rss_url' ), 301 );
 
 ?>
\ No newline at end of file
 
 ?>
\ No newline at end of file
index ba84ce99f5a409ed4d51f1f44a34ab20f73a7f7e..78daa6d226fb042f92607279ef1741f315378156 100644 (file)
@@ -1,21 +1,12 @@
 <?php
 /**
 <?php
 /**
- * Outputs the RSS2 feed XML format using the feed-rss2.php file in wp-includes
- * folder. This file only sets the feed format and includes the feed-rss2.php.
- *
- * This file is no longer used in WordPress and while it is not deprecated now.
- * This file will most likely be deprecated or removed in a later version.
- *
- * The link for the rss2 feed is /index.php?feed=rss2 with permalinks off.
+ * Redirects to the RSS2 feed
+ * This file is deprecated and only exists for backwards compatibility
  *
  * @package WordPress
  */
 
  *
  * @package WordPress
  */
 
-if (empty($wp)) {
-       require_once('./wp-load.php');
-       wp('feed=rss2');
-}
-
-require (ABSPATH . WPINC . '/feed-rss2.php');
+require( './wp-load.php' );
+wp_redirect( get_bloginfo( 'rss2_url' ), 301 );
 
 ?>
\ No newline at end of file
 
 ?>
\ No newline at end of file
index 466f04a16774c947dbabe97dadb88b0ddae8446c..553c67d4b789e98606cc0ed90ff42401dcd12ccd 100644 (file)
@@ -15,9 +15,11 @@ if ( !defined('WP_MEMORY_LIMIT') )
 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
        @ini_set('memory_limit', WP_MEMORY_LIMIT);
 
 if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) )
        @ini_set('memory_limit', WP_MEMORY_LIMIT);
 
+set_magic_quotes_runtime(0);
+@ini_set('magic_quotes_sybase', 0);
 
 /**
 
 /**
- * wp_unregister_GLOBALS() - Turn register globals off
+ * Turn register globals off.
  *
  * @access private
  * @since 2.1.0
  *
  * @access private
  * @since 2.1.0
@@ -107,16 +109,47 @@ if ( version_compare( '4.3', phpversion(), '>' ) ) {
 if ( !defined('WP_CONTENT_DIR') )
        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
 
 if ( !defined('WP_CONTENT_DIR') )
        define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' ); // no trailing slash, full paths only - WP_CONTENT_URL is defined further down
 
+if ( file_exists(ABSPATH . '.maintenance') && !defined('WP_INSTALLING') ) {
+       include(ABSPATH . '.maintenance');
+       // If the $upgrading timestamp is older than 10 minutes, don't die.
+       if ( ( time() - $upgrading ) < 600 ) {
+               if ( file_exists( WP_CONTENT_DIR . '/maintenance.php' ) ) {
+                       require_once( WP_CONTENT_DIR . '/maintenance.php' );
+                       die();
+               }
+
+               $protocol = $_SERVER["SERVER_PROTOCOL"];
+               if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )
+                       $protocol = 'HTTP/1.0';
+               header( "$protocol 503 Service Unavailable", true, 503 );
+               header( 'Content-Type: text/html; charset=utf-8' );
+?>
+<!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>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+       <title>Maintenance</title>
+
+</head>
+<body>
+       <h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1>
+</body>
+</html>
+<?php
+               die();
+       }
+}
+
 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
        die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
 
 /**
 if ( !extension_loaded('mysql') && !file_exists(WP_CONTENT_DIR . '/db.php') )
        die( /*WP_I18N_OLD_MYSQL*/'Your PHP installation appears to be missing the MySQL extension which is required by WordPress.'/*/WP_I18N_OLD_MYSQL*/ );
 
 /**
- * timer_start() - PHP 4 standard microtime start capture
+ * PHP 4 standard microtime start capture.
  *
  * @access private
  * @since 0.71
  *
  * @access private
  * @since 0.71
- * @global int $timestart Seconds and Microseconds added together from when function is called
- * @return bool Always returns true
+ * @global int $timestart Seconds and Microseconds added together from when function is called.
+ * @return bool Always returns true.
  */
 function timer_start() {
        global $timestart;
  */
 function timer_start() {
        global $timestart;
@@ -127,7 +160,7 @@ function timer_start() {
 }
 
 /**
 }
 
 /**
- * timer_stop() - Return and/or display the time from the page start to when function is called.
+ * Return and/or display the time from the page start to when function is called.
  *
  * You can get the results and print them by doing:
  * <code>
  *
  * You can get the results and print them by doing:
  * <code>
@@ -168,7 +201,13 @@ 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 {
-       error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
+       // 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 );
+       else
+               error_reporting(E_ALL ^ E_NOTICE ^ E_USER_NOTICE);
 }
 
 // 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
@@ -276,6 +315,7 @@ require (ABSPATH . WPINC . '/update.php');
 require (ABSPATH . WPINC . '/canonical.php');
 require (ABSPATH . WPINC . '/shortcodes.php');
 require (ABSPATH . WPINC . '/media.php');
 require (ABSPATH . WPINC . '/canonical.php');
 require (ABSPATH . WPINC . '/shortcodes.php');
 require (ABSPATH . WPINC . '/media.php');
+require (ABSPATH . WPINC . '/http.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
@@ -283,28 +323,36 @@ if ( !defined('WP_CONTENT_URL') )
 /**
  * Allows for the plugins directory to be moved from the default location.
  *
 /**
  * Allows for the plugins directory to be moved from the default location.
  *
- * @since 2.6
+ * @since 2.6.0
  */
 if ( !defined('WP_PLUGIN_DIR') )
        define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
  */
 if ( !defined('WP_PLUGIN_DIR') )
        define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // full path, no trailing slash
+
+/**
+ * Allows for the plugins directory to be moved from the default location.
+ *
+ * @since 2.6.0
+ */
 if ( !defined('WP_PLUGIN_URL') )
        define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
 if ( !defined('WP_PLUGIN_URL') )
        define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // full url, no trailing slash
+
+/**
+ * Allows for the plugins directory to be moved from the default location.
+ *
+ * @since 2.1.0
+ */
 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.
 
-if ( ! defined('WP_INSTALLING') ) {
-       // Used to guarantee unique hash cookies
-       $cookiehash = md5(get_option('siteurl'));
-       /**
-        * Used to guarantee unique hash cookies
-        * @since 1.5
-        */
-       define('COOKIEHASH', $cookiehash);
-}
+/**
+ * Used to guarantee unique hash cookies
+ * @since 1.5
+ */
+define('COOKIEHASH', md5(get_option('siteurl')));
 
 /**
  * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
 
 /**
  * Should be exactly the same as the default value of SECRET_KEY in wp-config-sample.php
- * @since 2.5
+ * @since 2.5.0
  */
 $wp_default_secret_key = 'put your unique phrase here';
 
  */
 $wp_default_secret_key = 'put your unique phrase here';
 
@@ -324,21 +372,21 @@ if ( !defined('PASS_COOKIE') )
 
 /**
  * It is possible to define this in wp-config.php
 
 /**
  * It is possible to define this in wp-config.php
- * @since 2.5
+ * @since 2.5.0
  */
 if ( !defined('AUTH_COOKIE') )
        define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
 
 /**
  * It is possible to define this in wp-config.php
  */
 if ( !defined('AUTH_COOKIE') )
        define('AUTH_COOKIE', 'wordpress_' . COOKIEHASH);
 
 /**
  * It is possible to define this in wp-config.php
- * @since 2.6
+ * @since 2.6.0
  */
 if ( !defined('SECURE_AUTH_COOKIE') )
        define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
 
 /**
  * It is possible to define this in wp-config.php
  */
 if ( !defined('SECURE_AUTH_COOKIE') )
        define('SECURE_AUTH_COOKIE', 'wordpress_sec_' . COOKIEHASH);
 
 /**
  * It is possible to define this in wp-config.php
- * @since 2.6
+ * @since 2.6.0
  */
 if ( !defined('LOGGED_IN_COOKIE') )
        define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
  */
 if ( !defined('LOGGED_IN_COOKIE') )
        define('LOGGED_IN_COOKIE', 'wordpress_logged_in_' . COOKIEHASH);
@@ -366,14 +414,14 @@ if ( !defined('SITECOOKIEPATH') )
 
 /**
  * It is possible to define this in wp-config.php
 
 /**
  * It is possible to define this in wp-config.php
- * @since 2.6
+ * @since 2.6.0
  */
 if ( !defined('ADMIN_COOKIE_PATH') )
        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
 
 /**
  * It is possible to define this in wp-config.php
  */
 if ( !defined('ADMIN_COOKIE_PATH') )
        define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );
 
 /**
  * It is possible to define this in wp-config.php
- * @since 2.6
+ * @since 2.6.0
  */
 if ( !defined('PLUGINS_COOKIE_PATH') )
        define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
  */
 if ( !defined('PLUGINS_COOKIE_PATH') )
        define( 'PLUGINS_COOKIE_PATH', preg_replace('|https?://[^/]+|i', '', WP_PLUGIN_URL)  );
@@ -387,7 +435,7 @@ if ( !defined('COOKIE_DOMAIN') )
 
 /**
  * It is possible to define this in wp-config.php
 
 /**
  * It is possible to define this in wp-config.php
- * @since 2.6
+ * @since 2.6.0
  */
 if ( !defined('FORCE_SSL_ADMIN') )
        define('FORCE_SSL_ADMIN', false);
  */
 if ( !defined('FORCE_SSL_ADMIN') )
        define('FORCE_SSL_ADMIN', false);
@@ -395,7 +443,7 @@ force_ssl_admin(FORCE_SSL_ADMIN);
 
 /**
  * It is possible to define this in wp-config.php
 
 /**
  * It is possible to define this in wp-config.php
- * @since 2.6
+ * @since 2.6.0
  */
 if ( !defined('FORCE_SSL_LOGIN') )
        define('FORCE_SSL_LOGIN', false);
  */
 if ( !defined('FORCE_SSL_LOGIN') )
        define('FORCE_SSL_LOGIN', false);
@@ -407,7 +455,7 @@ force_ssl_login(FORCE_SSL_LOGIN);
  */
 if ( !defined( 'AUTOSAVE_INTERVAL' ) )
        define( 'AUTOSAVE_INTERVAL', 60 );
  */
 if ( !defined( 'AUTOSAVE_INTERVAL' ) )
        define( 'AUTOSAVE_INTERVAL', 60 );
-       
+
 
 require (ABSPATH . WPINC . '/vars.php');
 
 
 require (ABSPATH . WPINC . '/vars.php');
 
@@ -417,7 +465,7 @@ if (get_option('hack_file')) {
                require(ABSPATH . 'my-hacks.php');
 }
 
                require(ABSPATH . 'my-hacks.php');
 }
 
-if ( get_option('active_plugins') ) {
+if ( get_option('active_plugins') && !defined('WP_INSTALLING') ) {
        $current_plugins = get_option('active_plugins');
        if ( is_array($current_plugins) ) {
                foreach ($current_plugins as $plugin) {
        $current_plugins = get_option('active_plugins');
        if ( is_array($current_plugins) ) {
                foreach ($current_plugins as $plugin) {
@@ -497,13 +545,13 @@ do_action('setup_theme');
 
 /**
  * Web Path to the current active template directory
 
 /**
  * Web Path to the current active template directory
- * @since 1.5
+ * @since 1.5.0
  */
 define('TEMPLATEPATH', get_template_directory());
 
 /**
  * Web Path to the current active template stylesheet directory
  */
 define('TEMPLATEPATH', get_template_directory());
 
 /**
  * Web Path to the current active template stylesheet directory
- * @since 2.1
+ * @since 2.1.0
  */
 define('STYLESHEETPATH', get_stylesheet_directory());
 
  */
 define('STYLESHEETPATH', get_stylesheet_directory());
 
@@ -536,10 +584,10 @@ if ( file_exists(TEMPLATEPATH . '/functions.php') )
        include(TEMPLATEPATH . '/functions.php');
 
 /**
        include(TEMPLATEPATH . '/functions.php');
 
 /**
- * shutdown_action_hook() - Runs just before PHP shuts down execution.
+ * Runs just before PHP shuts down execution.
  *
  * @access private
  *
  * @access private
- * @since 1.2
+ * @since 1.2.0
  */
 function shutdown_action_hook() {
        do_action('shutdown');
  */
 function shutdown_action_hook() {
        do_action('shutdown');
index e52e454658db0d73444ecfac6db3ea8560bb8503..c45b14fac70aaf0e151ac3cd0ddae8d087d1fb9c 100644 (file)
@@ -99,14 +99,32 @@ if ( isset($HTTP_RAW_POST_DATA) )
        logIO("I", $HTTP_RAW_POST_DATA);
 
 /**
        logIO("I", $HTTP_RAW_POST_DATA);
 
 /**
- * @internal
- * Left undocumented to work on later. If you want to finish, then please do so.
+ * WordPress XMLRPC server implementation.
+ *
+ * Implements compatability for Blogger API, MetaWeblog API, MovableType, and
+ * pingback. Additional WordPress API for managing comments, pages, posts,
+ * options, etc.
+ *
+ * Since WordPress 2.6.0, WordPress XMLRPC server can be disabled in the
+ * administration panels.
  *
  * @package WordPress
  * @subpackage Publishing
  *
  * @package WordPress
  * @subpackage Publishing
+ * @since 1.5.0
  */
 class wp_xmlrpc_server extends IXR_Server {
 
  */
 class wp_xmlrpc_server extends IXR_Server {
 
+       /**
+        * Register all of the XMLRPC methods that XMLRPC server understands.
+        *
+        * PHP4 constructor and sets up server and method property. Passes XMLRPC
+        * methods through the 'xmlrpc_methods' filter to allow plugins to extend
+        * or replace XMLRPC methods.
+        *
+        * @since 1.5.0
+        *
+        * @return wp_xmlrpc_server
+        */
        function wp_xmlrpc_server() {
                $this->methods = array(
                        // WordPress API
        function wp_xmlrpc_server() {
                $this->methods = array(
                        // WordPress API
@@ -119,6 +137,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        'wp.getPageList'                => 'this:wp_getPageList',
                        'wp.getAuthors'                 => 'this:wp_getAuthors',
                        'wp.getCategories'              => 'this:mw_getCategories',             // Alias
                        'wp.getPageList'                => 'this:wp_getPageList',
                        'wp.getAuthors'                 => 'this:wp_getAuthors',
                        'wp.getCategories'              => 'this:mw_getCategories',             // Alias
+                       'wp.getTags'                    => 'this:wp_getTags',
                        'wp.newCategory'                => 'this:wp_newCategory',
                        'wp.deleteCategory'             => 'this:wp_deleteCategory',
                        'wp.suggestCategories'  => 'this:wp_suggestCategories',
                        'wp.newCategory'                => 'this:wp_newCategory',
                        'wp.deleteCategory'             => 'this:wp_deleteCategory',
                        'wp.suggestCategories'  => 'this:wp_suggestCategories',
@@ -129,6 +148,12 @@ class wp_xmlrpc_server extends IXR_Server {
                        'wp.getPageTemplates'   => 'this:wp_getPageTemplates',
                        'wp.getOptions'                 => 'this:wp_getOptions',
                        'wp.setOptions'                 => 'this:wp_setOptions',
                        'wp.getPageTemplates'   => 'this:wp_getPageTemplates',
                        'wp.getOptions'                 => 'this:wp_getOptions',
                        'wp.setOptions'                 => 'this:wp_setOptions',
+                       'wp.getComment'                 => 'this:wp_getComment',
+                       'wp.getComments'                => 'this:wp_getComments',
+                       'wp.deleteComment'              => 'this:wp_deleteComment',
+                       'wp.editComment'                => 'this:wp_editComment',
+                       'wp.newComment'                 => 'this:wp_newComment',
+                       'wp.getCommentStatusList' => 'this:wp_getCommentStatusList',
 
                        // Blogger API
                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
 
                        // Blogger API
                        'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
@@ -179,16 +204,41 @@ class wp_xmlrpc_server extends IXR_Server {
                $this->IXR_Server($this->methods);
        }
 
                $this->IXR_Server($this->methods);
        }
 
+       /**
+        * Test XMLRPC API by saying, "Hello!" to client.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method Parameters.
+        * @return string
+        */
        function sayHello($args) {
                return 'Hello!';
        }
 
        function sayHello($args) {
                return 'Hello!';
        }
 
+       /**
+        * Test XMLRPC API by adding two numbers for client.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method Parameters.
+        * @return int
+        */
        function addTwoNumbers($args) {
                $number1 = $args[0];
                $number2 = $args[1];
                return $number1 + $number2;
        }
 
        function addTwoNumbers($args) {
                $number1 = $args[0];
                $number2 = $args[1];
                return $number1 + $number2;
        }
 
+       /**
+        * Check user's credentials.
+        *
+        * @since 1.5.0
+        *
+        * @param string $user_login User's username.
+        * @param string $user_pass User's password.
+        * @return bool Whether authentication passed.
+        */
        function login_pass_ok($user_login, $user_pass) {
                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') ) );
        function login_pass_ok($user_login, $user_pass) {
                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') ) );
@@ -202,6 +252,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return true;
        }
 
                return true;
        }
 
+       /**
+        * Sanitize string or array of strings for database.
+        *
+        * @since 1.5.2
+        *
+        * @param string|array $array Sanitize single string or array of strings.
+        * @return string|array Type matches $array and sanitized for the database.
+        */
        function escape(&$array) {
                global $wpdb;
 
        function escape(&$array) {
                global $wpdb;
 
@@ -221,6 +279,14 @@ class wp_xmlrpc_server extends IXR_Server {
                }
        }
 
                }
        }
 
+       /**
+        * Retrieve custom fields for post.
+        *
+        * @since 2.5.0
+        *
+        * @param int $post_id Post ID.
+        * @return array Custom fields, if exist.
+        */
        function get_custom_fields($post_id) {
                $post_id = (int) $post_id;
 
        function get_custom_fields($post_id) {
                $post_id = (int) $post_id;
 
@@ -242,6 +308,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $custom_fields;
        }
 
                return $custom_fields;
        }
 
+       /**
+        * Set custom fields for post.
+        *
+        * @since 2.5.0
+        *
+        * @param int $post_id Post ID.
+        * @param array $fields Custom fields.
+        */
        function set_custom_fields($post_id, $fields) {
                $post_id = (int) $post_id;
 
        function set_custom_fields($post_id, $fields) {
                $post_id = (int) $post_id;
 
@@ -264,6 +338,13 @@ class wp_xmlrpc_server extends IXR_Server {
                }
        }
 
                }
        }
 
+       /**
+        * Setup blog options property.
+        *
+        * Passes property through 'xmlrpc_blog_options' filter.
+        *
+        * @since 2.6.0
+        */
        function initialise_blog_option_info( ) {
                global $wp_version;
 
        function initialise_blog_option_info( ) {
                global $wp_version;
 
@@ -317,8 +398,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_getUsersBlogs
+        * Retrieve the blogs of the user.
+        *
+        * @since 2.6.0
+        *
+        * @param array $args Method parameters.
+        * @return array
         */
        function wp_getUsersBlogs( $args ) {
                // If this isn't on WPMU then just use blogger_getUsersBlogs
         */
        function wp_getUsersBlogs( $args ) {
                // If this isn't on WPMU then just use blogger_getUsersBlogs
@@ -344,7 +429,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                foreach( $blogs as $blog ) {
                        // Don't include blogs that aren't hosted at this site
 
                foreach( $blogs as $blog ) {
                        // Don't include blogs that aren't hosted at this site
-                       if( $blog->site_id != 1 )
+                       if( $blog->site_id != $current_site->id )
                                continue;
 
                        $blog_id = $blog->userblog_id;
                                continue;
 
                        $blog_id = $blog->userblog_id;
@@ -358,14 +443,20 @@ class wp_xmlrpc_server extends IXR_Server {
                                'blogName'              => get_option( 'blogname' ),
                                'xmlrpc'                => get_option( 'home' ) . '/xmlrpc.php'
                        );
                                'blogName'              => get_option( 'blogname' ),
                                'xmlrpc'                => get_option( 'home' ) . '/xmlrpc.php'
                        );
+
+                       restore_current_blog( );
                }
 
                return $struct;
        }
 
        /**
                }
 
                return $struct;
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_getPage
+        * Retrieve page.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return array
         */
        function wp_getPage($args) {
                $this->escape($args);
         */
        function wp_getPage($args) {
                $this->escape($args);
@@ -458,8 +549,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_getPages
+        * Retrieve Pages.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return array
         */
        function wp_getPages($args) {
                $this->escape($args);
         */
        function wp_getPages($args) {
                $this->escape($args);
@@ -467,6 +562,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $blog_id        = (int) $args[0];
                $username       = $args[1];
                $password       = $args[2];
                $blog_id        = (int) $args[0];
                $username       = $args[1];
                $password       = $args[2];
+               $num_pages      = (int) $args[3];
 
                if(!$this->login_pass_ok($username, $password)) {
                        return($this->error);
 
                if(!$this->login_pass_ok($username, $password)) {
                        return($this->error);
@@ -478,8 +574,12 @@ class wp_xmlrpc_server extends IXR_Server {
 
                do_action('xmlrpc_call', 'wp.getPages');
 
 
                do_action('xmlrpc_call', 'wp.getPages');
 
-               // Lookup info on pages.
-               $pages = get_pages();
+               $page_limit = 10;
+               if( isset( $num_pages ) ) {
+                       $page_limit = $num_pages;
+               }
+
+               $pages = get_posts( "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.
@@ -502,8 +602,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_newPage
+        * Create new page.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return unknown
         */
        function wp_newPage($args) {
                // Items not escaped here will be escaped in newPost.
         */
        function wp_newPage($args) {
                // Items not escaped here will be escaped in newPost.
@@ -533,8 +637,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_deletePage
+        * Delete page.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return bool True, if success.
         */
        function wp_deletePage($args) {
                $this->escape($args);
         */
        function wp_deletePage($args) {
                $this->escape($args);
@@ -576,8 +684,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_editPage
+        * Edit page.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return unknown
         */
        function wp_editPage($args) {
                // Items not escaped here will be escaped in editPost.
         */
        function wp_editPage($args) {
                // Items not escaped here will be escaped in editPost.
@@ -626,8 +738,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_getPageList
+        * Retrieve page list.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return unknown
         */
        function wp_getPageList($args) {
                global $wpdb;
         */
        function wp_getPageList($args) {
                global $wpdb;
@@ -677,8 +793,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_getAuthors
+        * Retrieve authors list.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return array
         */
        function wp_getAuthors($args) {
 
         */
        function wp_getAuthors($args) {
 
@@ -695,7 +815,7 @@ class wp_xmlrpc_server extends IXR_Server {
                set_current_user(0, $username);
                if(!current_user_can("edit_posts")) {
                        return(new IXR_Error(401, __("Sorry, you can not edit posts on this blog.")));
                set_current_user(0, $username);
                if(!current_user_can("edit_posts")) {
                        return(new IXR_Error(401, __("Sorry, you can not edit posts on this blog.")));
-        }
+               }
 
                do_action('xmlrpc_call', 'wp.getAuthors');
 
 
                do_action('xmlrpc_call', 'wp.getAuthors');
 
@@ -712,8 +832,56 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_newCategory
+        * Get list of all tags
+        *
+        * @since 2.7
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
+       function wp_getTags( $args ) {
+               $this->escape( $args );
+
+               $blog_id                = (int) $args[0];
+               $username               = $args[1];
+               $password               = $args[2];
+
+               if( !$this->login_pass_ok( $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 on this blog in order to view tags.' ) );
+               }
+
+               do_action( 'xmlrpc_call', 'wp.getKeywords' );
+
+               $tags = array( );
+
+               if( $all_tags = get_tags( ) ) {
+                       foreach( (array) $all_tags as $tag ) {
+                               $struct['tag_id']                       = $tag->term_id;
+                               $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 ) );
+
+                               $tags[] = $struct;
+                       }
+               }
+
+               return $tags;
+       }
+
+       /**
+        * Create new category.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return int Category ID.
         */
        function wp_newCategory($args) {
                $this->escape($args);
         */
        function wp_newCategory($args) {
                $this->escape($args);
@@ -768,8 +936,12 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 
        /**
        }
 
        /**
-        * WordPress XML-RPC API
-        * wp_deleteCategory
+        * Remove category.
+        *
+        * @since 2.5.0
+        *
+        * @param array $args Method parameters.
+        * @return mixed See {@link wp_delete_category()} for return info.
         */
        function wp_deleteCategory($args) {
                $this->escape($args);
         */
        function wp_deleteCategory($args) {
                $this->escape($args);
@@ -793,10 +965,13 @@ class wp_xmlrpc_server extends IXR_Server {
                return wp_delete_category( $category_id );
        }
 
                return wp_delete_category( $category_id );
        }
 
-
        /**
        /**
-        * WordPress XML-RPC API
-        * wp_suggestCategories
+        * Retrieve category list.
+        *
+        * @since 2.2.0
+        *
+        * @param array $args Method parameters.
+        * @return array
         */
        function wp_suggestCategories($args) {
                $this->escape($args);
         */
        function wp_suggestCategories($args) {
                $this->escape($args);
@@ -829,6 +1004,348 @@ class wp_xmlrpc_server extends IXR_Server {
                return($category_suggestions);
        }
 
                return($category_suggestions);
        }
 
+       /**
+        * Retrieve comment.
+        *
+        * @since 2.7.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
+       function wp_getComment($args) {
+               $this->escape($args);
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+               $comment_id     = (int) $args[3];
+
+               if ( !$this->login_pass_ok( $username, $password ) )
+                       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.' ) );
+
+               do_action('xmlrpc_call', 'wp.getComment');
+
+               if ( ! $comment = get_comment($comment_id) )
+                       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);
+
+               if ( 0 == $comment->comment_approved )
+                       $comment_status = 'hold';
+               else if ( 'spam' == $comment->comment_approved )
+                       $comment_status = 'spam';
+               else if ( 1 == $comment->comment_approved )
+                       $comment_status = 'approve';
+               else
+                       $comment_status = $comment->comment_approved;
+
+               $link = get_comment_link($comment);
+
+               $comment_struct = array(
+                       "date_created_gmt"              => new IXR_Date($comment_date_gmt),
+                       "user_id"                               => $comment->user_id,
+                       "comment_id"                    => $comment->comment_ID,
+                       "parent"                                => $comment->comment_parent,
+                       "status"                                => $comment_status,
+                       "content"                               => $comment->comment_content,
+                       "link"                                  => $link,
+                       "post_id"                               => $comment->comment_post_ID,
+                       "post_title"                    => get_the_title($comment->comment_post_ID),
+                       "author"                                => $comment->comment_author,
+                       "author_url"                    => $comment->comment_author_url,
+                       "author_email"                  => $comment->comment_author_email,
+                       "author_ip"                             => $comment->comment_author_IP,
+                       "type"                                  => $comment->comment_type,
+               );
+
+               return $comment_struct;
+       }
+
+       /**
+        * Retrieve comments.
+        *
+        * @since 2.7.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
+       function wp_getComments($args) {
+               $this->escape($args);
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+               $struct         = $args[3];
+
+               if ( !$this->login_pass_ok($username, $password) )
+                       return($this->error);
+
+               set_current_user( 0, $username );
+               if ( !current_user_can( 'moderate_comments' ) )
+                       return new IXR_Error( 401, __( 'Sorry, you can not edit comments.' ) );
+
+               do_action('xmlrpc_call', 'wp.getComments');
+
+               if ( isset($struct['status']) )
+                       $status = $struct['status'];
+               else
+                       $status = '';
+
+               $post_id = '';
+               if ( isset($struct['post_id']) )
+                       $post_id = absint($struct['post_id']);
+
+               $offset = 0;
+               if ( isset($struct['offset']) )
+                       $offset = absint($struct['offset']);
+
+               $number = 10;
+               if ( isset($struct['number']) )
+                       $number = absint($struct['number']);
+
+               $comments = get_comments( array('status' => $status, 'post_id' => $post_id, 'offset' => $offset, 'number' => $number ) );
+               $num_comments = count($comments);
+
+               if ( ! $num_comments )
+                       return array();
+
+               $comments_struct = array();
+
+               for ( $i = 0; $i < $num_comments; $i++ ) {
+                       $comment = wp_xmlrpc_server::wp_getComment(array(
+                               $blog_id, $username, $password, $comments[$i]->comment_ID,
+                       ));
+                       $comments_struct[] = $comment;
+               }
+
+               return $comments_struct;
+       }
+
+       /**
+        * Remove comment.
+        *
+        * @since 2.7.0
+        *
+        * @param array $args Method parameters.
+        * @return mixed {@link wp_delete_comment()}
+        */
+       function wp_deleteComment($args) {
+               $this->escape($args);
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+               $comment_ID     = (int) $args[3];
+
+               if ( !$this->login_pass_ok( $username, $password ) )
+                       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.' ) );
+
+               do_action('xmlrpc_call', 'wp.deleteComment');
+
+               if ( ! get_comment($comment_ID) )
+                       return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+               return wp_delete_comment($comment_ID);
+       }
+
+       /**
+        * Edit comment.
+        *
+        * @since 2.7.0
+        *
+        * @param array $args Method parameters.
+        * @return bool True, on success.
+        */
+       function wp_editComment($args) {
+               $this->escape($args);
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+               $comment_ID     = (int) $args[3];
+               $content_struct = $args[4];
+
+               if ( !$this->login_pass_ok( $username, $password ) )
+                       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.' ) );
+
+               do_action('xmlrpc_call', 'wp.editComment');
+
+               if ( ! get_comment($comment_ID) )
+                       return new IXR_Error( 404, __( 'Invalid comment ID.' ) );
+
+               if ( isset($content_struct['status']) ) {
+                       $statuses = get_comment_statuses();
+                       $statuses = array_keys($statuses);
+
+                       if ( ! in_array($content_struct['status'], $statuses) )
+                               return new IXR_Error( 401, __( 'Invalid comment status.' ) );
+                       $comment_approved = $content_struct['status'];
+               }
+
+               // Do some timestamp voodoo
+               if ( !empty( $content_struct['date_created_gmt'] ) ) {
+                       $dateCreated = str_replace( 'Z', '', $content_struct['date_created_gmt']->getIso() ) . 'Z'; // We know this is supposed to be GMT, so we're going to slap that Z on there by force
+                       $comment_date = get_date_from_gmt(iso8601_to_datetime($dateCreated));
+                       $comment_date_gmt = iso8601_to_datetime($dateCreated, GMT);
+               }
+
+               if ( isset($content_struct['content']) )
+                       $comment_content = $content_struct['content'];
+
+               if ( isset($content_struct['author']) )
+                       $comment_author = $content_struct['author'];
+
+               if ( isset($content_struct['author_url']) )
+                       $comment_author_url = $content_struct['author_url'];
+
+               if ( isset($content_struct['author_email']) )
+                       $comment_author_email = $content_struct['author_email'];
+
+               // We've got all the data -- post it:
+               $comment = compact('comment_ID', 'comment_content', 'comment_approved', 'comment_date', 'comment_date_gmt', 'comment_author', 'comment_author_email', 'comment_author_url');
+
+               $result = wp_update_comment($comment);
+               if ( is_wp_error( $result ) )
+                       return new IXR_Error(500, $result->get_error_message());
+
+               if ( !$result )
+                       return new IXR_Error(500, __('Sorry, the comment could not be edited. Something wrong happened.'));
+
+               return true;
+       }
+
+       /**
+        * Create new comment.
+        *
+        * @since 2.7.0
+        *
+        * @param array $args Method parameters.
+        * @return mixed {@link wp_new_comment()}
+        */
+       function wp_newComment($args) {
+               global $wpdb;
+
+               $this->escape($args);
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+               $post           = $args[3];
+               $content_struct = $args[4];
+
+               $allow_anon = apply_filters('xmlrpc_allow_anonymous_comments', false);
+
+               if ( !$this->login_pass_ok( $username, $password ) ) {
+                       $logged_in = false;
+                       if ( $allow_anon && get_option('comment_registration') )
+                               return new IXR_Error( 403, __( 'You must be registered to comment' ) );
+                       else if ( !$allow_anon )
+                               return $this->error;
+               } else {
+                       $logged_in = true;
+                       set_current_user( 0, $username );
+               }
+
+               if ( is_numeric($post) )
+                       $post_id = absint($post);
+               else
+                       $post_id = url_to_postid($post);
+
+               if ( ! $post_id )
+                       return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+               if ( ! get_post($post_id) )
+                       return new IXR_Error( 404, __( 'Invalid post ID.' ) );
+
+               $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['user_ID'] = $user->ID;
+               } else {
+                       $comment['comment_author'] = '';
+                       if ( isset($content_struct['author']) )
+                               $comment['comment_author'] = $content_struct['author'];
+
+                       $comment['comment_author_email'] = '';
+                       if ( isset($content_struct['author_email']) )
+                               $comment['comment_author_email'] = $content_struct['author_email'];
+
+                       $comment['comment_author_url'] = '';
+                       if ( isset($content_struct['author_url']) )
+                               $comment['comment_author_url'] = $content_struct['author_url'];
+
+                       $comment['user_ID'] = 0;
+
+                       if ( get_option('require_name_email') ) {
+                               if ( 6 > strlen($comment['comment_author_email']) || '' == $comment['comment_author'] )
+                                       return new IXR_Error( 403, __( 'Comment author name and email are required' ) );
+                               elseif ( !is_email($comment['comment_author_email']) )
+                                       return new IXR_Error( 403, __( 'A valid email address is required' ) );
+                       }
+               }
+
+               $comment['comment_parent'] = isset($content_struct['comment_parent']) ? absint($content_struct['comment_parent']) : 0;
+
+               $comment['comment_content'] = $content_struct['content'];
+
+               do_action('xmlrpc_call', 'wp.newComment');
+
+               return wp_new_comment($comment);
+       }
+
+       /**
+        * Retrieve all of the comment status.
+        *
+        * @since 2.7.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
+       function wp_getCommentStatusList($args) {
+               $this->escape( $args );
+
+               $blog_id        = (int) $args[0];
+               $username       = $args[1];
+               $password       = $args[2];
+
+               if ( !$this->login_pass_ok( $username, $password ) )
+                       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.' ) );
+
+               do_action('xmlrpc_call', 'wp.getCommentStatusList');
+
+               return get_comment_statuses( );
+       }
+
+       /**
+        * Retrieve comment count.
+        *
+        * @since 2.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function wp_getCommentCount( $args ) {
                $this->escape($args);
 
        function wp_getCommentCount( $args ) {
                $this->escape($args);
 
@@ -857,7 +1374,14 @@ class wp_xmlrpc_server extends IXR_Server {
                );
        }
 
                );
        }
 
-
+       /**
+        * Retrieve post statuses.
+        *
+        * @since 2.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function wp_getPostStatusList( $args ) {
                $this->escape( $args );
 
        function wp_getPostStatusList( $args ) {
                $this->escape( $args );
 
@@ -879,7 +1403,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return get_post_statuses( );
        }
 
                return get_post_statuses( );
        }
 
-
+       /**
+        * Retrieve page statuses.
+        *
+        * @since 2.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function wp_getPageStatusList( $args ) {
                $this->escape( $args );
 
        function wp_getPageStatusList( $args ) {
                $this->escape( $args );
 
@@ -901,6 +1432,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return get_page_statuses( );
        }
 
                return get_page_statuses( );
        }
 
+       /**
+        * Retrieve page templates.
+        *
+        * @since 2.6.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function wp_getPageTemplates( $args ) {
                $this->escape( $args );
 
        function wp_getPageTemplates( $args ) {
                $this->escape( $args );
 
@@ -923,6 +1462,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $templates;
        }
 
                return $templates;
        }
 
+       /**
+        * Retrieve blog options.
+        *
+        * @since 2.6.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function wp_getOptions( $args ) {
                $this->escape( $args );
 
        function wp_getOptions( $args ) {
                $this->escape( $args );
 
@@ -944,6 +1491,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $this->_getOptions($options);
        }
 
                return $this->_getOptions($options);
        }
 
+       /**
+        * Retrieve blog options value from list.
+        *
+        * @since 2.6.0
+        *
+        * @param array $options Options to retrieve.
+        * @return array
+        */
        function _getOptions($options)
        {
                $data = array( );
        function _getOptions($options)
        {
                $data = array( );
@@ -962,6 +1517,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $data;
        }
 
                return $data;
        }
 
+       /**
+        * Update blog options.
+        *
+        * @since 2.6.0
+        *
+        * @param array $args Method parameters.
+        * @return unknown
+        */
        function wp_setOptions( $args ) {
                $this->escape( $args );
 
        function wp_setOptions( $args ) {
                $this->escape( $args );
 
@@ -995,12 +1558,20 @@ class wp_xmlrpc_server extends IXR_Server {
                return $this->_getOptions($option_names);
        }
 
                return $this->_getOptions($option_names);
        }
 
-       /* Blogger API functions
+       /* Blogger API functions.
         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
         */
 
         * specs on http://plant.blogger.com/api and http://groups.yahoo.com/group/bloggerDev/
         */
 
-
-       /* blogger.getUsersBlogs will make more sense once we support multiple blogs */
+       /**
+        * Retrieve blogs that user owns.
+        *
+        * Will make more sense once we support multiple blogs.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function blogger_getUsersBlogs($args) {
 
                $this->escape($args);
        function blogger_getUsersBlogs($args) {
 
                $this->escape($args);
@@ -1028,8 +1599,16 @@ class wp_xmlrpc_server extends IXR_Server {
                return array($struct);
        }
 
                return array($struct);
        }
 
-
-       /* blogger.getUsersInfo gives your client some info about you, so you don't have to */
+       /**
+        * Retrieve user's data.
+        *
+        * Gives your client some info about you, so you don't have to.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function blogger_getUserInfo($args) {
 
                $this->escape($args);
        function blogger_getUserInfo($args) {
 
                $this->escape($args);
@@ -1060,8 +1639,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $struct;
        }
 
                return $struct;
        }
 
-
-       /* blogger.getPost ...gets a post */
+       /**
+        * Retrieve post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function blogger_getPost($args) {
 
                $this->escape($args);
        function blogger_getPost($args) {
 
                $this->escape($args);
@@ -1098,8 +1683,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $struct;
        }
 
                return $struct;
        }
 
-
-       /* blogger.getRecentPosts ...gets recent posts */
+       /**
+        * Retrieve list of recent posts.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function blogger_getRecentPosts($args) {
 
                $this->escape($args);
        function blogger_getRecentPosts($args) {
 
                $this->escape($args);
@@ -1152,44 +1743,56 @@ class wp_xmlrpc_server extends IXR_Server {
                return $recent_posts;
        }
 
                return $recent_posts;
        }
 
-
-       /* blogger.getTemplate returns your blog_filename */
+       /**
+        * Retrieve blog_filename content.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return string
+        */
        function blogger_getTemplate($args) {
 
                $this->escape($args);
 
        function blogger_getTemplate($args) {
 
                $this->escape($args);
 
-         $blog_ID    = (int) $args[1];
-         $user_login = $args[2];
-         $user_pass  = $args[3];
-         $template   = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
+               $blog_ID    = (int) $args[1];
+               $user_login = $args[2];
+               $user_pass  = $args[3];
+               $template   = $args[4]; /* could be 'main' or 'archiveIndex', but we don't use it */
 
 
-         if (!$this->login_pass_ok($user_login, $user_pass)) {
-           return $this->error;
-         }
+               if (!$this->login_pass_ok($user_login, $user_pass)) {
+                       return $this->error;
+               }
 
 
-         do_action('xmlrpc_call', 'blogger.getTemplate');
+               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.'));
-         }
+               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.'));
+               }
 
 
-         /* warning: here we make the assumption that the blog's URL is on the same server */
-         $filename = get_option('home') . '/';
-         $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
+               /* warning: here we make the assumption that the blog's URL is on the same server */
+               $filename = get_option('home') . '/';
+               $filename = preg_replace('#https?://.+?/#', $_SERVER['DOCUMENT_ROOT'].'/', $filename);
 
 
-         $f = fopen($filename, 'r');
-         $content = fread($f, filesize($filename));
-         fclose($f);
+               $f = fopen($filename, 'r');
+               $content = fread($f, filesize($filename));
+               fclose($f);
 
 
-         /* so it is actually editable with a windows/mac client */
-         // FIXME: (or delete me) do we really want to cater to bad clients at the expense of good ones by BEEPing up their line breaks? commented.     $content = str_replace("\n", "\r\n", $content);
+               /* so it is actually editable with a windows/mac client */
+               // FIXME: (or delete me) do we really want to cater to bad clients at the expense of good ones by BEEPing up their line breaks? commented.     $content = str_replace("\n", "\r\n", $content);
 
 
-         return $content;
+               return $content;
        }
 
        }
 
-
-       /* blogger.setTemplate updates the content of blog_filename */
+       /**
+        * Updates the content of blog_filename.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return bool True when done.
+        */
        function blogger_setTemplate($args) {
 
                $this->escape($args);
        function blogger_setTemplate($args) {
 
                $this->escape($args);
@@ -1225,8 +1828,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return true;
        }
 
                return true;
        }
 
-
-       /* blogger.newPost ...creates a new post */
+       /**
+        * Create new post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return int
+        */
        function blogger_newPost($args) {
 
                $this->escape($args);
        function blogger_newPost($args) {
 
                $this->escape($args);
@@ -1275,7 +1884,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $post_ID;
        }
 
                return $post_ID;
        }
 
-       /* blogger.editPost ...edits a post */
+       /**
+        * Edit a post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return bool true when done.
+        */
        function blogger_editPost($args) {
 
                $this->escape($args);
        function blogger_editPost($args) {
 
                $this->escape($args);
@@ -1294,7 +1910,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
 
 
                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
 
-               if (!$actual_post) {
+               if (!$actual_post || $actual_post['post_type'] != 'post') {
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
 
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
 
@@ -1325,8 +1941,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return true;
        }
 
                return true;
        }
 
-
-       /* blogger.deletePost ...deletes a post */
+       /**
+        * Remove a post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return bool True when post is deleted.
+        */
        function blogger_deletePost($args) {
                $this->escape($args);
 
        function blogger_deletePost($args) {
                $this->escape($args);
 
@@ -1343,7 +1965,7 @@ class wp_xmlrpc_server extends IXR_Server {
 
                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
 
 
                $actual_post = wp_get_single_post($post_ID,ARRAY_A);
 
-               if (!$actual_post) {
+               if (!$actual_post || $actual_post['post_type'] != 'post') {
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
 
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
 
@@ -1360,13 +1982,18 @@ class wp_xmlrpc_server extends IXR_Server {
                return true;
        }
 
                return true;
        }
 
-
-
        /* MetaWeblog API functions
         * specs on wherever Dave Winer wants them to be
         */
 
        /* MetaWeblog API functions
         * specs on wherever Dave Winer wants them to be
         */
 
-       /* metaweblog.newPost creates a post */
+       /**
+        * Create a new post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return int
+        */
        function mw_newPost($args) {
                $this->escape($args);
 
        function mw_newPost($args) {
                $this->escape($args);
 
@@ -1596,11 +2223,11 @@ class wp_xmlrpc_server extends IXR_Server {
                        $this->set_custom_fields($post_ID, $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'] ) ) { 
+               // 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'] );
                        add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] );
-               } 
+               }
 
                $this->attach_uploads( $post_ID, $post_content );
 
 
                $this->attach_uploads( $post_ID, $post_content );
 
@@ -1609,6 +2236,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return strval($post_ID);
        }
 
                return strval($post_ID);
        }
 
+       /**
+        * Attach upload to a post.
+        *
+        * @since 2.1.0
+        *
+        * @param int $post_ID Post ID.
+        * @param string $post_content Post Content for attachment.
+        */
        function attach_uploads( $post_ID, $post_content ) {
                global $wpdb;
 
        function attach_uploads( $post_ID, $post_content ) {
                global $wpdb;
 
@@ -1623,7 +2258,14 @@ class wp_xmlrpc_server extends IXR_Server {
                }
        }
 
                }
        }
 
-       /* metaweblog.editPost ...edits a post */
+       /**
+        * Edit a post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return bool True on success.
+        */
        function mw_editPost($args) {
 
                $this->escape($args);
        function mw_editPost($args) {
 
                $this->escape($args);
@@ -1864,11 +2506,11 @@ class wp_xmlrpc_server extends IXR_Server {
                        $this->set_custom_fields($post_ID, $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'] ) ) { 
+               // 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'] );
                        add_post_meta( $post_ID, 'enclosure', $enclosure['url'] . "\n" . $enclosure['length'] . "\n" . $enclosure['type'] );
-               } 
+               }
 
                $this->attach_uploads( $ID, $post_content );
 
 
                $this->attach_uploads( $ID, $post_content );
 
@@ -1877,8 +2519,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return true;
        }
 
                return true;
        }
 
-
-       /* metaweblog.getPost ...returns a post */
+       /**
+        * Retrieve post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mw_getPost($args) {
 
                $this->escape($args);
        function mw_getPost($args) {
 
                $this->escape($args);
@@ -1932,6 +2580,19 @@ class wp_xmlrpc_server extends IXR_Server {
                                $postdata['post_status'] = 'publish';
                        }
 
                                $postdata['post_status'] = 'publish';
                        }
 
+                       $enclosure = array();
+                       foreach ( (array) get_post_custom($post_ID) as $key => $val) {
+                               if ($key == 'enclosure') {
+                                       foreach ( (array) $val as $enc ) {
+                                               $encdata = split("\n", $enc);
+                                               $enclosure['url'] = trim(htmlspecialchars($encdata[0]));
+                                               $enclosure['length'] = trim($encdata[1]);
+                                               $enclosure['type'] = trim($encdata[2]);
+                                               break 2;
+                                       }
+                               }
+                       }
+
                        $resp = array(
                                'dateCreated' => new IXR_Date($post_date),
                                'userid' => $postdata['post_author'],
                        $resp = array(
                                'dateCreated' => new IXR_Date($post_date),
                                'userid' => $postdata['post_author'],
@@ -1957,14 +2618,22 @@ class wp_xmlrpc_server extends IXR_Server {
                                'custom_fields' => $this->get_custom_fields($post_ID)
                        );
 
                                'custom_fields' => $this->get_custom_fields($post_ID)
                        );
 
+                       if (!empty($enclosure)) $resp['enclosure'] = $enclosure;
+
                        return $resp;
                } else {
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
        }
 
                        return $resp;
                } else {
                        return new IXR_Error(404, __('Sorry, no such post.'));
                }
        }
 
-
-       /* metaweblog.getRecentPosts ...returns recent posts */
+       /**
+        * Retrieve list of recent posts.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mw_getRecentPosts($args) {
 
                $this->escape($args);
        function mw_getRecentPosts($args) {
 
                $this->escape($args);
@@ -1983,8 +2652,7 @@ class wp_xmlrpc_server extends IXR_Server {
                $posts_list = wp_get_recent_posts($num_posts);
 
                if (!$posts_list) {
                $posts_list = wp_get_recent_posts($num_posts);
 
                if (!$posts_list) {
-                       $this->error = new IXR_Error(500, __('Either there are no posts, or something went wrong.'));
-                       return $this->error;
+                       return array( );
                }
 
                set_current_user( 0, $user_login );
                }
 
                set_current_user( 0, $user_login );
@@ -2035,8 +2703,8 @@ class wp_xmlrpc_server extends IXR_Server {
                                'title' => $entry['post_title'],
                                'link' => $link,
                                'permaLink' => $link,
                                'title' => $entry['post_title'],
                                'link' => $link,
                                'permaLink' => $link,
-// commented out because no other tool seems to use this
-//           'content' => $entry['post_content'],
+                               // commented out because no other tool seems to use this
+                               // 'content' => $entry['post_content'],
                                'categories' => $categories,
                                'mt_excerpt' => $entry['post_excerpt'],
                                'mt_text_more' => $post['extended'],
                                'categories' => $categories,
                                'mt_excerpt' => $entry['post_excerpt'],
                                'mt_text_more' => $post['extended'],
@@ -2062,8 +2730,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $recent_posts;
        }
 
                return $recent_posts;
        }
 
-
-       /* metaweblog.getCategories ...returns the list of categories on a given blog */
+       /**
+        * Retrieve the list of categories on a given blog.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mw_getCategories($args) {
 
                $this->escape($args);
        function mw_getCategories($args) {
 
                $this->escape($args);
@@ -2089,9 +2763,10 @@ class wp_xmlrpc_server extends IXR_Server {
                                $struct['categoryId'] = $cat->term_id;
                                $struct['parentId'] = $cat->parent;
                                $struct['description'] = $cat->name;
                                $struct['categoryId'] = $cat->term_id;
                                $struct['parentId'] = $cat->parent;
                                $struct['description'] = $cat->name;
+                               $struct['categoryDescription'] = $cat->description;
                                $struct['categoryName'] = $cat->name;
                                $struct['htmlUrl'] = wp_specialchars(get_category_link($cat->term_id));
                                $struct['categoryName'] = $cat->name;
                                $struct['htmlUrl'] = wp_specialchars(get_category_link($cat->term_id));
-                               $struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat->term_id, $cat->name));
+                               $struct['rssUrl'] = wp_specialchars(get_category_feed_link($cat->term_id, 'rss2'));
 
                                $categories_struct[] = $struct;
                        }
 
                                $categories_struct[] = $struct;
                        }
@@ -2100,12 +2775,19 @@ class wp_xmlrpc_server extends IXR_Server {
                return $categories_struct;
        }
 
                return $categories_struct;
        }
 
-
-       /* metaweblog.newMediaObject uploads a file, following your settings */
+       /**
+        * Uploads a file, following your settings.
+        *
+        * Adapted from a patch by Johann Richard.
+        *
+        * @link http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mw_newMediaObject($args) {
        function mw_newMediaObject($args) {
-               // adapted from a patch by Johann Richard
-               // http://mycvs.org/archives/2004/06/30/file-upload-to-wordpress-in-ecto/
-
                global $wpdb;
 
                $blog_ID     = (int) $args[0];
                global $wpdb;
 
                $blog_ID     = (int) $args[0];
@@ -2177,12 +2859,18 @@ class wp_xmlrpc_server extends IXR_Server {
                return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) );
        }
 
                return apply_filters( 'wp_handle_upload', array( 'file' => $name, 'url' => $upload[ 'url' ], 'type' => $type ) );
        }
 
-
        /* MovableType API functions
         * specs on http://www.movabletype.org/docs/mtmanual_programmatic.html
         */
 
        /* MovableType API functions
         * specs on http://www.movabletype.org/docs/mtmanual_programmatic.html
         */
 
-       /* mt.getRecentPostTitles ...returns recent posts' titles */
+       /**
+        * Retrieve the post titles of recent posts.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mt_getRecentPostTitles($args) {
 
                $this->escape($args);
        function mt_getRecentPostTitles($args) {
 
                $this->escape($args);
@@ -2232,8 +2920,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $recent_posts;
        }
 
                return $recent_posts;
        }
 
-
-       /* mt.getCategoryList ...returns the list of categories on a given blog */
+       /**
+        * Retrieve list of all categories on blog.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mt_getCategoryList($args) {
 
                $this->escape($args);
        function mt_getCategoryList($args) {
 
                $this->escape($args);
@@ -2266,8 +2960,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $categories_struct;
        }
 
                return $categories_struct;
        }
 
-
-       /* mt.getPostCategories ...returns a post's categories */
+       /**
+        * Retrieve post categories.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mt_getPostCategories($args) {
 
                $this->escape($args);
        function mt_getPostCategories($args) {
 
                $this->escape($args);
@@ -2302,8 +3002,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $categories;
        }
 
                return $categories;
        }
 
-
-       /* mt.setPostCategories ...sets a post's categories */
+       /**
+        * Sets categories for a post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return bool True on success.
+        */
        function mt_setPostCategories($args) {
 
                $this->escape($args);
        function mt_setPostCategories($args) {
 
                $this->escape($args);
@@ -2332,8 +3038,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return true;
        }
 
                return true;
        }
 
-
-       /* mt.supportedMethods ...returns an array of methods supported by this server */
+       /**
+        * Retrieve an array of methods supported by this server.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function mt_supportedMethods($args) {
 
                do_action('xmlrpc_call', 'mt.supportedMethods');
        function mt_supportedMethods($args) {
 
                do_action('xmlrpc_call', 'mt.supportedMethods');
@@ -2346,16 +3058,26 @@ class wp_xmlrpc_server extends IXR_Server {
                return $supported_methods;
        }
 
                return $supported_methods;
        }
 
-
-       /* mt.supportedTextFilters ...returns an empty array because we don't
-                support per-post text filters yet */
+       /**
+        * Retrieve an empty array because we don't support per-post text filters.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        */
        function mt_supportedTextFilters($args) {
                do_action('xmlrpc_call', 'mt.supportedTextFilters');
                return apply_filters('xmlrpc_text_filters', array());
        }
 
        function mt_supportedTextFilters($args) {
                do_action('xmlrpc_call', 'mt.supportedTextFilters');
                return apply_filters('xmlrpc_text_filters', array());
        }
 
-
-       /* mt.getTrackbackPings ...returns trackbacks sent to a given post */
+       /**
+        * Retrieve trackbacks sent to a given post.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return mixed
+        */
        function mt_getTrackbackPings($args) {
 
                global $wpdb;
        function mt_getTrackbackPings($args) {
 
                global $wpdb;
@@ -2392,8 +3114,14 @@ class wp_xmlrpc_server extends IXR_Server {
                return $trackback_pings;
        }
 
                return $trackback_pings;
        }
 
-
-       /* mt.publishPost ...sets a post's publish status to 'publish' */
+       /**
+        * Sets a post's publish status to 'publish'.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return int
+        */
        function mt_publishPost($args) {
 
                $this->escape($args);
        function mt_publishPost($args) {
 
                $this->escape($args);
@@ -2426,13 +3154,18 @@ class wp_xmlrpc_server extends IXR_Server {
                return $result;
        }
 
                return $result;
        }
 
-
-
        /* PingBack functions
         * specs on www.hixie.ch/specs/pingback/pingback
         */
 
        /* PingBack functions
         * specs on www.hixie.ch/specs/pingback/pingback
         */
 
-       /* pingback.ping gets a pingback and registers it */
+       /**
+        * Retrieves a pingback and registers it.
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function pingback_ping($args) {
                global $wpdb;
 
        function pingback_ping($args) {
                global $wpdb;
 
@@ -2508,7 +3241,7 @@ class wp_xmlrpc_server extends IXR_Server {
                        return new IXR_Error(0, __('The source URL and the target URL cannot both point to the same resource.'));
 
                // Check if pings are on
                        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 ( 'closed' == $post->ping_status )
+               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.'));
 
                // Let's check that the remote site didn't already pingback this entry
                        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.'));
 
                // Let's check that the remote site didn't already pingback this entry
@@ -2594,10 +3327,16 @@ class wp_xmlrpc_server extends IXR_Server {
                return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
        }
 
                return sprintf(__('Pingback from %1$s to %2$s registered. Keep the web talking! :-)'), $pagelinkedfrom, $pagelinkedto);
        }
 
-
-       /* pingback.extensions.getPingbacks returns an array of URLs
-       that pingbacked the given URL
-       specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
+       /**
+        * Retrieve array of URLs that pingbacked the given URL.
+        *
+        * Specs on http://www.aquarionics.com/misc/archives/blogite/0198.html
+        *
+        * @since 1.5.0
+        *
+        * @param array $args Method parameters.
+        * @return array
+        */
        function pingback_extensions_getPingbacks($args) {
 
                global $wpdb;
        function pingback_extensions_getPingbacks($args) {
 
                global $wpdb;
@@ -2637,7 +3376,6 @@ class wp_xmlrpc_server extends IXR_Server {
        }
 }
 
        }
 }
 
-
 $wp_xmlrpc_server = new wp_xmlrpc_server();
 
 ?>
 $wp_xmlrpc_server = new wp_xmlrpc_server();
 
 ?>